Python environment packages

Hello guys,

I am trying to run a Python function in a node and pass it to another script as a flow variable. I have found an example that have used “import cloudpickle” (which I can import in Anaconda without problem), but when I run it in a Knime Python Source node, I’ve got this error:
ModuleNotFoundError: No module named ‘cloudpickle’.

I have seen that my Anaconda imports packages from different source than Knime, as it follows:

Anaconda environment
C:\Users\conte\anaconda3\lib\site-packages\pandas_init_.py

Knime environment
C:\Users\conte\anaconda3\envs\py3_knime\lib\site-packages\pandas_init_.py

So here comes my question: how should I set the same path in Knime? My Python environment configuration is set to Conda, with Python 3 as default.

Best Regards,
Marcelo Conte

Hi @Marcelo_Conte

Did you instruct Anaconda to install cloudpickle in the py3_knime environment? If not, I’d give this a try.

From the command prompt,

conda env list

will list all the environments you have set up, and you can look at all the installed packages in a given environment using

conda list -n [environment_name]

(without the square brackets).

If you need to install cloudpickle, you can activate the appropriate environment using

conda activate [environment_name]

(again, without the square brackets) and install cloudpickle using pip install or conda-forge.

If you prefer using Anaconda Navigator, then you can select the appropriate environment and search for cloudpickle and/or install it with a click.

4 Likes

Hello @elsamuel,

Thank you for your detailed step by step. I have performed the package installation inside the conda environment and it worked fine!

Best regards,
Marcelo Conte

4 Likes

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