I tried to run Python code in Mathematica 12.1 on my Windows 10 computer. However, it seems that the python in conda has MissingDependencies, as shown below.
According to this FAQ thread, Wolfram Support Quick Answers: How do I register custom Python distributions like Anaconda with ExternalEvaluate?, this suggests that I need to install the pyzmq package to fix this issue. However, the pyzmq is already contained in conda…
So, what should I do to make the Conda Python work in Mathematica 12.1?
Problem solved!
With the help of Wolfram support team, I figured out how to get the conda work in MMA in windows.
-
conda’s installation and library path is not in Mathematica’s default Path. So we need to manually add the path by:
SetEnvironment[
“PATH” → Environment[“PATH”] <> “;” <> “C:\Users\\AppData\Local\Continuum\anaconda3”] (for python executable)
SetEnvironment[
“PATH” → Environment[“PATH”] <> “;” <> “C:\Users\\AppData\Local\Continuum\anaconda3\Library\bin”] (for pyzmq library)
just replace the path above with your own conda path.
-
(re-)Register the conda in MMA by:
RegisterExternalEvaluator[“Python”, “C:\Users\\AppData\Local\Continuum\anaconda3\python.exe”]
again replace the path above with your own conda path.
- Now the conda should work in Mathematica. You can check it by FindExternalEvaluators[“Python”] .
You also need to replace "" by "\" in the path for Windows.