# Python Environment Creation Problem

**URL:** <https://forum.knime.com/t/python-environment-creation-problem/41577>\
**Category:** KNIME Analytics Platform\
**Tags:** python\
**Created:** [April 10, 2022, 11:10pm UTC](https://forum.knime.com/t/python-environment-creation-problem/41577 "2022-04-10T23:10:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rfeigel](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/r/7ea924/32.png) [@rfeigel](https://forum.knime.com/u/rfeigel)\
**Post date:** [April 10, 2022, 11:10pm UTC](https://forum.knime.com/t/python-environment-creation-problem/41577/1 "2022-04-10T23:10:11Z")

</div>

I’m trying to update from Python 3.6 to 3.8. I’ve installed Python through Anaconda. When I try to create the Knime environment I got the following error:

 ![2022-04-10_18-09-07](https://forum-cdn.knime.com/uploads/default/original/3X/d/8/d85b107e33d0eb2d943f2808df67c698ff0a31c1.jpeg)

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [April 10, 2022, 11:21pm UTC](https://forum.knime.com/t/python-environment-creation-problem/41577/2 "2022-04-10T23:21:11Z")

</div>

@rfeigel I would recommend using Miniconda and creating an environment from just conda-forge using the [KNIME examples](https://docs.knime.com/latest/python_installation_guide/index.html#conda-env-manual).

> [@Error with python integration extension on Mac system](https://forum.knime.com/t/error-with-python-integration-extension-on-mac-system/41389/2):
>
> @kvssetty welcome to the KNIME forum You might want to start with the official guide: [https://docs.knime.com/latest/python\_installation\_guide/index.html#\_introduction](https://docs.knime.com/latest/python_installation_guide/index.html#_introduction) Tow entries give you and idea how the [current Python integration](https://forum.knime.com/t/data-passing-to-python-node-still-slow/38333/3) works and how to [set up a an environment](https://forum.knime.com/t/attributeerror-module-keras-optimizers-has-no-attribute-adam/38461/3) (this is for Deep Learning but will be similar for other Python cases also). This example with additional links should give you an initial package how this should work. Including: connecting KNIME and Miniconda (or Anacon…

> [@Which Python versions works better with Knime?](https://forum.knime.com/t/which-python-versions-works-better-with-knime/39205/2):
>
> @JayR the thing is you will have to find the right combination of Python version and packages that would work with KNIME as well as your individual packages What I would do install [Miniconda](https://docs.conda.io/en/latest/miniconda.html) on your system (how to [manage environments](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html)) Choose a major Python version (like 3.8) that would most likely work with you package look up a [suitable YML file provided by KNIME](https://bitbucket.org/KNIME/knime-python/src/master/org.knime.python2.envconfigs/envconfigs/) (python version and operating system) edit the file so it would suite your initial needs. Use only ‘[conda-forge](https://anaconda.org/conda-forge/repo)’ and add additiona…

---

<div class="post-metadata">

**Author:** ![rfeigel](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/r/7ea924/32.png) [@rfeigel](https://forum.knime.com/u/rfeigel)\
**Post date:** [April 11, 2022, 2:08am UTC](https://forum.knime.com/t/python-environment-creation-problem/41577/3 "2022-04-11T02:08:48Z")

</div>

I manually installed numpy and pandas and the error went away. I thought the whole idea of creating a Knime environment was to automatically load the basic dependencies.

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [April 11, 2022, 6:21am UTC](https://forum.knime.com/t/python-environment-creation-problem/41577/4 "2022-04-11T06:21:36Z")

</div>

@rfeigel yes it is and most of the time it does work. No idea why sometimes it does not.

Using a separate yaml file gives you more control also. Concerning the repositories used for example.

---

<div class="post-metadata">

**Author:** ![kienerj](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/k/ce7236/32.png) [@kienerj](https://forum.knime.com/u/kienerj)\
**Post date:** [April 11, 2022, 7:01am UTC](https://forum.knime.com/t/python-environment-creation-problem/41577/5 "2022-04-11T07:01:49Z")

</div>

Agree with yml file. And in my experience so far especially if you keep installing things and at some point need to update conda itself or python version, it will simply not work. So it is often easier to just delete and recreate the environment. But then important to document, what you installed after initial creation and adjust your yml accordingly.

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [April 11, 2022, 10:02am UTC](https://forum.knime.com/t/python-environment-creation-problem/41577/6 "2022-04-11T10:02:25Z")

</div>

@kienerj on a Windows machine you can (currently) see the YAML files used under:

`\knime_4.5.x\plugins\org.knime.python2.envconfigs_4.5.x.yyyyyyyyyy\envconfigs`

that can help to build one’s own configuration. If you already have built an [environment](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html) and want to save it in a ‘clean’ (reusable) way the way to go seems to be the `--from-history` function:

> <https://github.com/conda/conda/issues/4339>
>
> Hi,
> 
> I have several questions about exporting a conda environment. When I'm in…side my env, I use \`conda env export \> environment.yml\` but:
> 1. How can I export my environment \*\*without version numbers\*\* and with only \*\*main packages\*\* (without their dependencies. As dependencies will be installed when packages are being installed). In other words, a 'clean' env like this:
> 
> \`\`\`yml
> name: my-env
> dependencies:
> - python
> - ipython
> \- pandas
> \- scikit-learn
> \- pip:
> - jupyter\_kernel\_gateway
> \`\`\` 
> 
> 2. The last line is the prefix. What is it or what is its purpose? (I could not find the answer in the doc) and how can I prevent conda to export this line with my folder path in 'clear' as it it not 'sharing ready'.
> 
> If I missed something from the doc, please refer to it.
> Thanks

Linux …

> conda env export --from-history | grep -v “prefix” \> environment.yaml

Windows:

> conda env export --from-history | findstr -v “prefix” \> environment.yaml

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [April 25, 2022, 6:20pm UTC](https://forum.knime.com/t/python-environment-creation-problem/41577/7 "2022-04-25T18:20:00Z")

</div>

under MacOSX the YML / YAML files can be found in a path like this:

`/Applications/KNIME 4.5.0.app/Contents/Eclipse/plugins/org.knime.python2.envconfigs_4.5.x.yyyyyyyyyy`

![image](https://forum-cdn.knime.com/uploads/default/original/3X/2/d/2db6a6c8bc19eb6fdca05f489b19ff4440dd011f.png)

The paths might change in further versions.A general article about KNIME, Python and conda environments:

> **[Meta Collection about KNIME and Python – mlauber71](https://hub.knime.com/mlauber71/spaces/Public/_knime_and_python_meta_collection~AvjrddXKOIoZYLV3/current-state)**
>
> KNIME and Python - just good friends

–  
Edit: [KNIME Snippets (5) — Python Overview | by Markus Lauber | Low Code for Data Science | Medium](https://medium.com/low-code-for-advanced-data-science/knime-snippets-5-python-overview-aa4f3a55a768)

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [October 11, 2022, 12:57pm UTC](https://forum.knime.com/t/python-environment-creation-problem/41577/9 "2022-10-11T12:57:03Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
