Exception: java.lang.IllegalStateException Message: Duplicate key E:\Anaconda3\python.exe

zhaiyh
zhaiyh New Altair Community Member
edited November 5 in Community Q&A
I encountered a problem when configuring Python in RapidMiner in Win10.

I have installed Anaconda 3 in E:\anaconda3 and wanted to configure Python in RapidMiner. I opened the Preferences dialog and in the Python Scripting tab, when I was clicking the  droplist of Conda Environment, I encountered the following error. I do not know what I should do next.
Exception: java.lang.IllegalStateException
Message: Duplicate key E:\Anaconda3\python.exe
Stack trace:
java.util.stream.Collectors.lambda$throwingMerger$0(Collectors.java:133)
java.util.HashMap.merge(HashMap.java:1254)
java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320)
java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
java.util.ArrayList$Itr.forEachRemaining(ArrayList.java:899)
java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
com.rapidminer.extension.pythonscripting.operator.scripting.python.PythonSetupTester.forceRefreshCondaEnvironments(PythonSetupTester.java:913)
com.rapidminer.extension.pythonscripting.operator.scripting.python.PythonSetupTester.listCondaEnvironments(PythonSetupTester.java:837)
com.rapidminer.extension.pythonscripting.operator.scripting.python.PythonSetupTester.listCondaEnvironments(PythonSetupTester.java:819)
com.rapidminer.extension.pythonscripting.parameter.CondaEnvironmentSuggestionProvider.getSuggestions(CondaEnvironmentSuggestionProvider.java:27)
com.rapidminer.extension.pythonscripting.gui.properties.celleditors.value.PythonEnvironmentCellEditor.getSuggestions(PythonEnvironmentCellEditor.java:203)
com.rapidminer.gui.properties.celleditors.value.AbstractSuggestionBoxValueCellEditor$SuggestionComboBoxModel$1.run(AbstractSuggestionBoxValueCellEditor.java:263)
com.rapidminer.gui.tools.ProgressThread$3.run(ProgressThread.java:586)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)

Best Answer

  • varunm1
    varunm1 New Altair Community Member
    Answer ✓
    @zhaiyh better do it and also do a complete uninstall, by this I mean to remove all folders as well after uninstall because anaconda doesn't remove some folders even after uninstall, we need to remove manually. Also, be careful with the paths as well, see if you have old paths in environment variables and try to remove them so that it doesn't conflict once you install the new version.

    I saw the following issue with blank environment names in other forums as well and people mostly use the command I provided but if it removes all then better try installing it freshly. Make sure the paths are clear and also once done installing check your environments. Don't forget Rapidminer needs pandas (package) data frame in anaconda.

Answers

  • YYH
    YYH
    Altair Employee
    Hi @zhaiyh,

    Thanks for sharing the error message. Do you have any screenshot on the configuration of python?


  • varunm1
    varunm1 New Altair Community Member
    Hello @zhaiyh

    Does it currently show "base" in conda environment? Something similar to the below image. Also, in the search paths are they pointed out to your folder where the python for anaconda is store something similar to right side image.


  • zhaiyh
    zhaiyh New Altair Community Member
    @yyhuang Thank you for your reply. 

    I do have a screenshot about the configuration and the error, but it seems I cannot post links as a Newbie.

    In addition, I tried the configuration as shown in the screenshot, and then click the Test button, a dialog flashes by. 

    When I execute a script in a process, it shows a similar error:
    Exception: java.lang.IllegalStateException
    Message: java.lang.IllegalStateException: Duplicate key E:\Anaconda3\python.exe
    Stack trace:
    sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)
    java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1005)
    com.rapidminer.studio.concurrency.internal.AbstractConcurrencyContext.collectResults(AbstractConcurrencyContext.java:206)
    com.rapidminer.studio.concurrency.internal.StudioConcurrencyContext.collectResults(StudioConcurrencyContext.java:33)
    com.rapidminer.studio.concurrency.internal.AbstractConcurrencyContext.call(AbstractConcurrencyContext.java:141)
    com.rapidminer.studio.concurrency.internal.StudioConcurrencyContext.call(StudioConcurrencyContext.java:33)
    com.rapidminer.Process.executeRootInPool(Process.java:1349)
    com.rapidminer.Process.execute(Process.java:1314)
    com.rapidminer.Process.run(Process.java:1291)
    com.rapidminer.Process.run(Process.java:1177)
    com.rapidminer.Process.run(Process.java:1130)
    com.rapidminer.Process.run(Process.java:1125)
    com.rapidminer.Process.run(Process.java:1115)
    com.rapidminer.gui.ProcessThread.run(ProcessThread.java:65)

    Cause
    Exception: java.lang.IllegalStateException
    Message: Duplicate key E:\Anaconda3\python.exe
    Stack trace:
    java.util.stream.Collectors.lambda$throwingMerger$0(Collectors.java:133)
    java.util.HashMap.merge(HashMap.java:1254)
    java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320)
    java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
    java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    java.util.ArrayList$Itr.forEachRemaining(ArrayList.java:899)
    java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
    com.rapidminer.extension.pythonscripting.operator.scripting.python.PythonSetupTester.forceRefreshCondaEnvironments(PythonSetupTester.java:913)
    com.rapidminer.extension.pythonscripting.operator.scripting.python.PythonSetupTester.listCondaEnvironments(PythonSetupTester.java:837)
    com.rapidminer.extension.pythonscripting.operator.scripting.python.PythonSetupTester.refreshCondaCache(PythonSetupTester.java:194)
    com.rapidminer.extension.pythonscripting.operator.scripting.python.PythonSetupTester.isCondaExecutable(PythonSetupTester.java:948)
    com.rapidminer.extension.pythonscripting.operator.scripting.python.PythonProcessBuilder.getPathPrefix(PythonProcessBuilder.java:141)
    com.rapidminer.extension.pythonscripting.operator.scripting.python.PythonProcessBuilder.start(PythonProcessBuilder.java:90)
    com.rapidminer.extension.pythonscripting.operator.scripting.python.PythonSetupTester.processTestFast(PythonSetupTester.java:1307)
    com.rapidminer.extension.pythonscripting.operator.scripting.python.PythonSetupTester.scriptingPathTest(PythonSetupTester.java:441)
    com.rapidminer.extension.pythonscripting.operator.scripting.python.PythonSetupTester.isPythonInstalled(PythonSetupTester.java:229)
    com.rapidminer.extension.pythonscripting.operator.scripting.python.PythonScriptingOperator.doWork(PythonScriptingOperator.java:354)
    com.rapidminer.operator.Operator.execute(Operator.java:1031)
    com.rapidminer.operator.execution.SimpleUnitExecutor.execute(SimpleUnitExecutor.java:77)
    com.rapidminer.operator.ExecutionUnit$2.run(ExecutionUnit.java:812)
    com.rapidminer.operator.ExecutionUnit$2.run(ExecutionUnit.java:807)
    java.security.AccessController.doPrivileged(Native Method)
    com.rapidminer.operator.ExecutionUnit.execute(ExecutionUnit.java:807)
    com.rapidminer.operator.OperatorChain.doWork(OperatorChain.java:423)
    com.rapidminer.operator.Operator.execute(Operator.java:1031)
    com.rapidminer.Process.executeRoot(Process.java:1372)
    com.rapidminer.Process.lambda$executeRootInPool$5(Process.java:1351)
    com.rapidminer.studio.concurrency.internal.AbstractConcurrencyContext$AdaptedCallable.exec(AbstractConcurrencyContext.java:328)
    java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
    java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
    java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) 
  • zhaiyh
    zhaiyh New Altair Community Member
    @varunm1 Thank you for your reply. 

    Yes, it shows  the "base" in conda environment. I have tried the configuration as the screenshot shows. When I click the Test button, nothing happens. 

    When I execute a script in a process, it shows a similar error:
    Exception: java.lang.IllegalStateException
    Message: java.lang.IllegalStateException: Duplicate key E:\Anaconda3\python.exe
    Stack trace:
    sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)
    java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1005)
    com.rapidminer.studio.concurrency.internal.AbstractConcurrencyContext.collectResults(AbstractConcurrencyContext.java:206)
    com.rapidminer.studio.concurrency.internal.StudioConcurrencyContext.collectResults(StudioConcurrencyContext.java:33)
    com.rapidminer.studio.concurrency.internal.AbstractConcurrencyContext.call(AbstractConcurrencyContext.java:141)
    com.rapidminer.studio.concurrency.internal.StudioConcurrencyContext.call(StudioConcurrencyContext.java:33)
    com.rapidminer.Process.executeRootInPool(Process.java:1349)
    com.rapidminer.Process.execute(Process.java:1314)
    com.rapidminer.Process.run(Process.java:1291)
    com.rapidminer.Process.run(Process.java:1177)
    com.rapidminer.Process.run(Process.java:1130)
    com.rapidminer.Process.run(Process.java:1125)
    com.rapidminer.Process.run(Process.java:1115)
    com.rapidminer.gui.ProcessThread.run(ProcessThread.java:65)

    Cause
    Exception: java.lang.IllegalStateException
    Message: Duplicate key E:\Anaconda3\python.exe
    Stack trace:
    java.util.stream.Collectors.lambda$throwingMerger$0(Collectors.java:133)
    java.util.HashMap.merge(HashMap.java:1254)
    java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320)
    java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
    java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    java.util.ArrayList$Itr.forEachRemaining(ArrayList.java:899)
    java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
    com.rapidminer.extension.pythonscripting.operator.scripting.python.PythonSetupTester.forceRefreshCondaEnvironments(PythonSetupTester.java:913)
    com.rapidminer.extension.pythonscripting.operator.scripting.python.PythonSetupTester.listCondaEnvironments(PythonSetupTester.java:837)
    com.rapidminer.extension.pythonscripting.operator.scripting.python.PythonSetupTester.refreshCondaCache(PythonSetupTester.java:194)
    com.rapidminer.extension.pythonscripting.operator.scripting.python.PythonSetupTester.getFullPathForCondaEnvironment(PythonSetupTester.java:962)
    com.rapidminer.extension.pythonscripting.PluginInitPythonScripting.getDefaultPythonBinary(PluginInitPythonScripting.java:379)
    com.rapidminer.extension.pythonscripting.operator.scripting.python.PythonScriptingOperator.getPythonBinary(PythonScriptingOperator.java:540)
    com.rapidminer.extension.pythonscripting.operator.scripting.python.PythonScriptingOperator.doWork(PythonScriptingOperator.java:343)
    com.rapidminer.operator.Operator.execute(Operator.java:1031)
    com.rapidminer.operator.execution.SimpleUnitExecutor.execute(SimpleUnitExecutor.java:77)
    com.rapidminer.operator.ExecutionUnit$2.run(ExecutionUnit.java:812)
    com.rapidminer.operator.ExecutionUnit$2.run(ExecutionUnit.java:807)
    java.security.AccessController.doPrivileged(Native Method)
    com.rapidminer.operator.ExecutionUnit.execute(ExecutionUnit.java:807)
    com.rapidminer.operator.OperatorChain.doWork(OperatorChain.java:423)
    com.rapidminer.operator.Operator.execute(Operator.java:1031)
    com.rapidminer.Process.executeRoot(Process.java:1372)
    com.rapidminer.Process.lambda$executeRootInPool$5(Process.java:1351)
    com.rapidminer.studio.concurrency.internal.AbstractConcurrencyContext$AdaptedCallable.exec(AbstractConcurrencyContext.java:328)
    java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
    java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
    java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) 
  • btamas
    btamas New Altair Community Member
    Hi @zhaiyh

    I think this was a bug in an earlier version of the Python scripting Extension. Could you check please, what version of the extension are you using? If not the latest (9.3.0), please upgrade, and try, if it works.

    If you upgraded and still not working, could you please type
    conda env list
    in the Anaconda Prompt and send me the results of the command. (You could also write a private message to me, if you don't want to post the results publicly).

    Best regards,
    Bence Tamás
  • sgenzer
    sgenzer
    Altair Employee
    Hi @zhaiyh I have boosted your rank so you can post images now.

    Scott

  • zhaiyh
    zhaiyh New Altair Community Member
    @sgenzer
    Thank you for help.
  • zhaiyh
    zhaiyh New Altair Community Member
    @btamas
    Thank you for your reply.

    The Python scripting Extension is being up to date:



    The output of 
    conda env list
    is

    The last env was built because I saw some posts saying that it needs to build a special env for RapidMiner.
  • varunm1
    varunm1 New Altair Community Member
    Hello @zhaiyh

    I see a dummy conda environment without any name showing in E:\Anaconda3 above the base env in your screenshot, looks like this is conflicting. I think there is an issue in anaconda installation because it is not in default C. I think if you remove this dummy environment it will work.

    Can you try in anaconda prompt?
    conda env remove -p E:\Anaconda3

  • zhaiyh
    zhaiyh New Altair Community Member
    @varunm1
    It seems that the command conda env remove -p E:\Anaconda3 removes all the files in E:\Anaconda3:


    I want to re-install Anaconda 3; do I need to install it in C:\ ?
  • varunm1
    varunm1 New Altair Community Member
    Answer ✓
    @zhaiyh better do it and also do a complete uninstall, by this I mean to remove all folders as well after uninstall because anaconda doesn't remove some folders even after uninstall, we need to remove manually. Also, be careful with the paths as well, see if you have old paths in environment variables and try to remove them so that it doesn't conflict once you install the new version.

    I saw the following issue with blank environment names in other forums as well and people mostly use the command I provided but if it removes all then better try installing it freshly. Make sure the paths are clear and also once done installing check your environments. Don't forget Rapidminer needs pandas (package) data frame in anaconda.
  • zhaiyh
    zhaiyh New Altair Community Member
    Thank all of you @varunm1, @yyhuang, @btamas, @sgenzer

    I have re-installed Anaconda 3 still in e:\Anaconda3, and it seems all things are working well. I use the command "conda env list" and it shows only one env base. So as @varunm1 said, the issue must be the dummy conda environment. Whatever, it works well now.
  • phellinger
    phellinger New Altair Community Member
    Hi All,

    We are not sure how Anaconda ends up with this kind of environment setup.

    Nevertheless, Python Scripting Extension 9.3.1 is prepared to handle such setup and won't fail.

    Thank you for reporting.
    Best,
    Peter