Python Extension not recognizing Anaconda environment in Knime 3.7

Hi mlauber71,

Could you maybe post the error message you are getting and the script you are using? Maybe you forgot to make the script executable?

Currently, just pointing to the environment also works. However, this is not our recommended way as this may lead to unexpected errors.

Which package are you referring to here? Do you mean scikit-learn?

Hi DaveK,

I had success creating the conda environment using the documentation. You were correct in pointing out that one should use the absolute location of the .yml file when creating the conda (conda env create -f C:/Tools/anaconda3/py36_knime.yml). It would be good to mention this in the installation documentation.

I am now at the stage of configuring KNIME. I created the .bat file as follows:

@REM Adapt the folder in the PATH to your system
@SET PATH=C:\Tools\anaconda3\Scripts;%PATH%
@CALL activate py36_knime || ECHO Activating python environment failed
@python %*

When I directly run this .bat file outside of KNIME is launches my python env as excpected:
image

however, when linking to this .bat in KNIME, I receive the following error:

I am running Knime 3.7 and I have updated to latest conda.

Any help would be much appreciated.

Hi rjesud,

I’m sorry that you have troubles with the Python installation. Could you maybe attach the KNIME log file in your next post? Also, it may be a permission problem. You could either try to start KNIME in administrator mode or move the .bat file to e.g. your desktop or user folder.

If this does not resolve the issue, you could provide us with additional information by following these steps:

  1. Download this archive PythonKernelTester.zip (2.6 KB). It contains a .py test script. Put it into the same folder as your .bat file.
  1. Execute the following command in the folder where you put both files:
    py36_knime.bat PythonKernelTester.py 3.0.0

Then paste the outputs here. That would be really helpful.

Cheers
Dave

3 Likes

Hi Dave,

When executing the command, I receive the following error:

image

To summarize

  1. I can link directly to the base python:
    image

  2. I cannot link to the .bat file (I tried running knime as admin and also placing the .bat on desktop)
    image

  3. I cannot link directly to the python.exe in the env folder:
    image

  4. I can execute the .bat directly (outside of knime) and it launches:

Thank you for your support with this issue!

sorry to hear that it is still not running. I still think you would have to make sure you have a ‘clean’ Anaconda managed Python installation. You could try:

  • reinstall a py36_knime environment via the Anaconda navigator like I showed in the screenshots above
  • update the py36_knime environment explicitly using the .yml file from the official installation guide *1) (https://docs.knime.com/2018-12/python_installation_guide/index.html)
  • always test the script “PythonKernelTester.py” mentioned above
  • maybe install Spyder in the py36_knime environment and try a few small commands to see if the Python environment does work at all
  • try to activate the py36_knime environment via Anaconda Navigator and see if that makes any difference
  • I am not sure about the .bat file if that is necessary and working, try both. .bat file and Python.exe directly
  • try installing additional packages strictly via Anaconda

I fear you have to do some trial and error to come up with a solution that does work.


*1)
source activate py36_knime
conda env update -f=/Users/m_lauber/Downloads/py36_knime.yml

Hi rjesud,

there may be a .dll conflict on your system. The following command will show you the location of the .dll mentioned in the error message:
where mkl_intel_thread.dll
If it finds something under C:\Windows\System32\... you could try to remove that temporarily and see if Python works again.

Cheers
Dave

2 Likes

THank you @mlauber71 this one solved my problem. Now, I have openpyxl is working.

2 Likes

log.txt (622.1 KB)

I had previously Anaconda installed, to achieve integration I created new environment with yml file shared in guide. I have followed and finished KNIME integration as mentioned in Guide. When I try to run workflow with Python nodes I receive several errors as below:




Here you can see that Python executable path seems OK.

Below the command window error:
ERROR Python Script (DB) 5:12 Execute failed: Could not start Python kernel. Error during Python installation test: Could not find python executable at the given location: python… See log for details.

I am attaching log file. Do you have any ideas what is wrong?

Hi asenkron,

Would you mind also attaching the knime.log file? (The one you attached is the eclipse .log file.)
Please see here (third and fourth paragraph) to find out how to locate the knime.log file.

Marcel

Hi @MarcelW,

Sorry for delay, here I am attaching Knime.log file.

knime.log (2.5 MB)

Hi asenkron,

Thanks!

This is the root of the first error (first screenshot, Python Script (1 -> 1) node):
ModuleNotFoundError: No module named 'sklearn'.
This error can be resolved by installing scikit-learn in your local Python environment. I wonder, however, why this doesn’t properly show up as a user-visible node error.

Unfortunately, the log doesn’t seem to contain anything related to the failing Python Script (DB) node (second screenshot). Updating KNIME to version 3.7.2 might help here. There was a known bug in versions older than that, where Python versions 2 & 3 might get confused in some situations.

Marcel

After turning back several months later, I reinstalled Anaconda environment, maybe updated on servers as well, now I am running without any error.

Thanks for response.

3 Likes