Long time ago, I have two versions of python installed in my pc, and I registered them all in mathematica. Later I uninstalled one of them, but FindExternalEvaluators["Python"]
still gived me two results, and then when I wanted to run StartExternalSession["Python"]
,it tried to launch the uninstalled one first and gived me a lot of warning. The uninstalled Python is neither in the path of my system nor in the path of mathematica, and UnregisterExternalEvaluator
doesn't work either. So how can I do if I want to get one result when I run FindExternalEvaluators["Python"]
? My system is windows 10, version of mathematica is 11.2.
2 Answers
Update: As of version 12, one should use
FindExternalEvaluators["Python", "ResetCache" -> True]
To turn my comment into an answer, ExternalEvaluate
keeps a cache of evaluators it has found or used previously, and sometimes it can make invalid data persist.
In such cases, it is often useful to start with a clean slate, using the following command
ExternalEvaluate; (* trigger autoloading *)
ExternalEvaluate`Private`resetCache[]
which will clear the cached data.
-
$\begingroup$ This appears to no longer work in version 12.2. $\endgroup$– davidDec 24, 2020 at 20:11
-
-
-
$\begingroup$ @ilian I have the exact same problem with Mathematica 12.3.1 but it doesn't work. Any thoughts? Launching the command give me "The code execution cannot proceed because python37.dll was not found" That's why I want to get rid of it! $\endgroup$– LouNov 24, 2021 at 16:03
Just as additional information. I found the above not to work at all. I received a (not wolfram message) "The code execution cannot proceed because python37.dll was not found". I don't really understand how the external evaluator registration works it's dependency's etc. Would be nice to have WRI document this (like the "ResetCache" option) Anyway I had the Registered status for Python 3.7 as MissingDependencies. I also had an old Anaconda installation with a Python version. But both versions where de-installed through windows add/remove programs
Unregister anaconda version The path shown in the Target was pointing to a path that did not exist. Recreating the path and copying a python.exe in there resolved the issue. This version was successfully unregistered.
Unregister the python 3.7 version What helped at the end was to re-install the same version of python in that directory. Re-Install PyZMQ. Then I could unregister the Python registration. Then I de-installed the Python version again.
After this I installed the latest Python version (3.10), upgraded Pip and installed pyZMQ
after that the FindExternalEvaluators["Python"]
found the installation and the status "Registered" was False. I registered the version manually and now everything works fine.
ExternalEvaluate; ExternalEvaluate`Private`resetCache[]
which will clear the cached external evaluator instances. $\endgroup$