Python Integration with environment: The input line is too long

As per instructions on knime homepage I created a bat file and added that in the preferences but I then get the error “The input line is too long”:

below the content of the bat file:

@REM Adapt the directory in the PATH to your system
@SET PATH=%LocalAppData%\anaconda3\Scripts;%PATH%
@CALL activate knime || ECHO Activating failed
@python %*

This is windows 10. same bat with different file paths on different machine works fine. I actually used the full path before using %LocalAppData% but that makes no difference.

Also it takes very long till the error shows and I can paste the commands into cmd, they work. If I run the bat via cmd I get the same error as in knime while it takes a long time (30 sec) for it to show.

This seems to be a win10 issue?

Hi beginner,

Can you check the length of the value of your PATH variable? E.g., by executing echo %path% in cmd.

Marcel

Already did that. It’s 481 chars and hence below all the different limits.

Maybe this helps (at least it describes a similar problem): https://stackoverflow.com/questions/34818282/anaconda-prompt-loading-error-the-input-line-is-too-long/35439610. That is, maybe the problem is not in the start script itself but rather in conda’s activate script.

Unfortunately, I have no access to a configured Windows 10 machine right now, so I’m not able to reproduce the problem for some time.

Hi Marcel,

that link is for anaconda2 and the script is completely different now. also the individual line work fine if not run from a bat file but directly.

I reinstalled anaconda to shorten the file / dir path length (in case that is the issue). I can run the script from the a cmd window and it immediately shows a python prompt form the correct environment.

However in knime right now instead of an error it gets stuck at “Testing Python 3 Installation…”

Has this been tested on win10? For me this now is clearly a knime issue as the env works fine and so does the script.

Glad to hear at least this problem got resolved. Sorry for the wrong pointer.

Yes, this is tested virtually daily. I also checked back with some Windows 10 users here at KNIME and none of them experienced that problem so far.
Would you mind trying to manually execute this installation test outside KNIME and see if it also hangs there? You can do it like that:

  1. Locate the test file in your local KNIME installation. It should be here: <KNIME-installation-directory>\plugins\org.knime.python2_<KNIME-version>\py\PythonKernelTester.py
  2. Open a cmd.
  3. Execute a command of the form: <path-to-Python-start-script> <path-to-test-file> 3.0.0
    Example: C:\Users\Marcel\py36_knime.bat "C:\Programs\KNIME 3.7.1\plugins\org.knime.python2_3.7.1.v201901281201\py\PythonKernelTester.py" 3.0.0
  4. The command should return something like “Python version: 3.6.7” if it ran successfully or return a list of errors if e.g., a required package is missing.

Sorry for the troubles!

Marcel

Hi Marcel,

works fine. Correct python version is displayed:

Alright. So this is just guesswork, but it might be a permissions issue. Could you try to move the python.cmd file to your user directory and/or launch KNIME as administrator, if possible, and retry?

Also, are “.cmd” files and “.bat” files the same, that is, are they interpreted exactly the same by Windows cmd? Maybe renaming the file to “.bat” might be worth a try.

(Just looking for the parts that are different to the setup we test which is the location of the script and its extension, here).

Already did all the steps mentioned.

Note that the cmd prompt I used above was not elevated so theoretically it should also fail.

In the .log file I found this stack trace which seems relevant. this happens at startup before I do any action.

ENTRY org.eclipse.osgi 2 0 2019-02-18 13:40:45.588
!MESSAGE While loading class “org.knime.python.typeextension.PythonModuleExtensions”, thread “Thread[DL-Installation-Test-org.knime.dl.keras.tensorflow.core.DLKerasTensorFlowNetwork,5,main]” timed out waiting (5001ms) for thread “Thread[DL-Installation-Test-org.knime.dl.tensorflow.savedmodel.core.TFSavedModelNetwork,5,main]” to finish starting bundle “org.knime.python.typeextensions_3.5.0.v201811141615 [987]”. To avoid deadlock, thread “Thread[DL-Installation-Test-org.knime.dl.keras.tensorflow.core.DLKerasTensorFlowNetwork,5,main]” is proceeding but “org.knime.python.typeextension.PythonModuleExtensions” may not be fully initialized.
!STACK 0
org.osgi.framework.BundleException: Unable to acquire the state change lock for the module: osgi.identity; type=“osgi.bundle”; version:Version=“3.5.0.v201811141615”; osgi.identity=“org.knime.python.typeextensions”; singleton:=“true” [id=987] STARTED [STARTED]
at org.eclipse.osgi.container.Module.lockStateChange(Module.java:337)
at org.eclipse.osgi.container.Module.start(Module.java:401)
at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:468)
at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:103)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:529)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:328)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:368)
at org.eclipse.osgi.internal.loader.sources.SingleSourcePackage.loadClass(SingleSourcePackage.java:36)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:442)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.knime.dl.python.core.DLPythonDefaultContext.execute(DLPythonDefaultContext.java:130)
at org.knime.dl.python.core.DLPythonAbstractCommands.testInstallation(DLPythonAbstractCommands.java:263)
at org.knime.dl.python.core.DLPythonAbstractNetworkLoader$DLPythonInstallationTester.lambda$0(DLPythonAbstractNetworkLoader.java:117)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.concurrent.TimeoutException: Timeout after waiting 5 seconds to acquire the lock.
at org.eclipse.osgi.container.Module.lockStateChange(Module.java:334)
… 16 more
Root exception:
java.util.concurrent.TimeoutException: Timeout after waiting 5 seconds to acquire the lock.
at org.eclipse.osgi.container.Module.lockStateChange(Module.java:334)
at org.eclipse.osgi.container.Module.start(Module.java:401)
at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:468)
at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:103)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:529)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:328)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:368)
at org.eclipse.osgi.internal.loader.sources.SingleSourcePackage.loadClass(SingleSourcePackage.java:36)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:442)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.knime.dl.python.core.DLPythonDefaultContext.execute(DLPythonDefaultContext.java:130)
at org.knime.dl.python.core.DLPythonAbstractCommands.testInstallation(DLPythonAbstractCommands.java:263)
at org.knime.dl.python.core.DLPythonAbstractNetworkLoader$DLPythonInstallationTester.lambda$0(DLPythonAbstractNetworkLoader.java:117)
at java.lang.Thread.run(Thread.java:748)

!ENTRY org.eclipse.osgi 2 0 2019-02-18 13:40:45.592
!MESSAGE While loading class “org.knime.python.typeextension.PythonModuleExtensions”, thread “Thread[DL-Installation-Test-org.knime.dl.keras.theano.core.DLKerasTheanoNetwork,5,main]” timed out waiting (5001ms) for thread “Thread[DL-Installation-Test-org.knime.dl.tensorflow.savedmodel.core.TFSavedModelNetwork,5,main]” to finish starting bundle “org.knime.python.typeextensions_3.5.0.v201811141615 [987]”. To avoid deadlock, thread “Thread[DL-Installation-Test-org.knime.dl.keras.theano.core.DLKerasTheanoNetwork,5,main]” is proceeding but “org.knime.python.typeextension.PythonModuleExtensions” may not be fully initialized.
!STACK 0
org.osgi.framework.BundleException: Unable to acquire the state change lock for the module: osgi.identity; type=“osgi.bundle”; version:Version=“3.5.0.v201811141615”; osgi.identity=“org.knime.python.typeextensions”; singleton:=“true” [id=987] STARTED [STARTED]
at org.eclipse.osgi.container.Module.lockStateChange(Module.java:337)
at org.eclipse.osgi.container.Module.start(Module.java:401)
at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:468)
at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:103)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:529)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:328)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:368)
at org.eclipse.osgi.internal.loader.sources.SingleSourcePackage.loadClass(SingleSourcePackage.java:36)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:442)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.knime.dl.python.core.DLPythonDefaultContext.execute(DLPythonDefaultContext.java:130)
at org.knime.dl.python.core.DLPythonAbstractCommands.testInstallation(DLPythonAbstractCommands.java:263)
at org.knime.dl.python.core.DLPythonAbstractNetworkLoader$DLPythonInstallationTester.lambda$0(DLPythonAbstractNetworkLoader.java:117)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.concurrent.TimeoutException: Timeout after waiting 5 seconds to acquire the lock.
at org.eclipse.osgi.container.Module.lockStateChange(Module.java:334)
… 16 more
Root exception:
java.util.concurrent.TimeoutException: Timeout after waiting 5 seconds to acquire the lock.
at org.eclipse.osgi.container.Module.lockStateChange(Module.java:334)
at org.eclipse.osgi.container.Module.start(Module.java:401)
at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:468)
at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:103)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:529)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:328)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:368)
at org.eclipse.osgi.internal.loader.sources.SingleSourcePackage.loadClass(SingleSourcePackage.java:36)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:442)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.knime.dl.python.core.DLPythonDefaultContext.execute(DLPythonDefaultContext.java:130)
at org.knime.dl.python.core.DLPythonAbstractCommands.testInstallation(DLPythonAbstractCommands.java:263)
at org.knime.dl.python.core.DLPythonAbstractNetworkLoader$DLPythonInstallationTester.lambda$0(DLPythonAbstractNetworkLoader.java:117)
at java.lang.Thread.run(Thread.java:748)

!ENTRY org.eclipse.osgi 2 0 2019-02-18 13:40:45.596
!MESSAGE While loading class “org.knime.python.typeextension.PythonModuleExtensions”, thread “Thread[DL-Installation-Test-org.knime.dl.keras.cntk.core.DLKerasCNTKNetwork,5,main]” timed out waiting (5001ms) for thread “Thread[DL-Installation-Test-org.knime.dl.tensorflow.savedmodel.core.TFSavedModelNetwork,5,main]” to finish starting bundle “org.knime.python.typeextensions_3.5.0.v201811141615 [987]”. To avoid deadlock, thread “Thread[DL-Installation-Test-org.knime.dl.keras.cntk.core.DLKerasCNTKNetwork,5,main]” is proceeding but “org.knime.python.typeextension.PythonModuleExtensions” may not be fully initialized.
!STACK 0
org.osgi.framework.BundleException: Unable to acquire the state change lock for the module: osgi.identity; type=“osgi.bundle”; version:Version=“3.5.0.v201811141615”; osgi.identity=“org.knime.python.typeextensions”; singleton:=“true” [id=987] STARTED [STARTED]
at org.eclipse.osgi.container.Module.lockStateChange(Module.java:337)
at org.eclipse.osgi.container.Module.start(Module.java:401)
at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:468)
at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:103)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:529)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:328)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:368)
at org.eclipse.osgi.internal.loader.sources.SingleSourcePackage.loadClass(SingleSourcePackage.java:36)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:442)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.knime.dl.python.core.DLPythonDefaultContext.execute(DLPythonDefaultContext.java:130)
at org.knime.dl.python.core.DLPythonAbstractCommands.testInstallation(DLPythonAbstractCommands.java:263)
at org.knime.dl.python.core.DLPythonAbstractNetworkLoader$DLPythonInstallationTester.lambda$0(DLPythonAbstractNetworkLoader.java:117)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.concurrent.TimeoutException: Timeout after waiting 5 seconds to acquire the lock.
at org.eclipse.osgi.container.Module.lockStateChange(Module.java:334)
… 16 more
Root exception:
java.util.concurrent.TimeoutException: Timeout after waiting 5 seconds to acquire the lock.
at org.eclipse.osgi.container.Module.lockStateChange(Module.java:334)
at org.eclipse.osgi.container.Module.start(Module.java:401)
at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:468)
at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:103)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:529)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:328)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:368)
at org.eclipse.osgi.internal.loader.sources.SingleSourcePackage.loadClass(SingleSourcePackage.java:36)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:442)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.knime.dl.python.core.DLPythonDefaultContext.execute(DLPythonDefaultContext.java:130)
at org.knime.dl.python.core.DLPythonAbstractCommands.testInstallation(DLPythonAbstractCommands.java:263)
at org.knime.dl.python.core.DLPythonAbstractNetworkLoader$DLPythonInstallationTester.lambda$0(DLPythonAbstractNetworkLoader.java:117)
at java.lang.Thread.run(Thread.java:748)

I’m gonna reinstall knime. I think the installation is completely borked. I uninstalled the python integration but it’s still there, all the folders and option in knime. It’s not actually removed at all…

So either uninstall is broken or my knime install.

Reinstall helped. It works for now with no changes to python env.

I did not however install all the same knime extensions yet. I did not install h2o, tensorflow and big data.

I’m glad it works now! We’ll have a closer look into the (un)install routines of our integration, thanks for your help on this! :slight_smile: