Message Boards Message Boards

Missing Dependencies for Python in Conda in Mathematica 12.1 in Windows 10

Posted 4 years ago

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. enter image description here

According to this FAQ thread, https://support.wolfram.com/42342?src=mathematica, this suggests that I need to install the pyzmq package to fix this issue. However, the pyzmq is already contained in conda... enter image description here

So, what should I do to make the Conda Python work in Mathematica 12.1?

POSTED BY: HH C
2 Replies
Posted 4 years ago

Problem solved!

With the help of Wolfram support team, I figured out how to get the conda work in MMA in windows.

1) 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\\<user>\\AppData\\Local\\Continuum\\anaconda3"] (*for python executable*)

SetEnvironment[
 "PATH" -> Environment["PATH"] <> ";" <> "C:\\Users\\<user>\\AppData\\Local\\Continuum\\anaconda3\\Library\\bin"] (*for pyzmq library*)

just replace the path above with your own conda path.

2) (re-)Register the conda in MMA by:

RegisterExternalEvaluator["Python", "C:\\Users\\<username>\\AppData\\Local\\Continuum\\anaconda3\\python.exe"]

again replace the path above with your own conda path.

3) Now the conda should work in Mathematica. You can check it by FindExternalEvaluators["Python"] .

POSTED BY: HH C
Posted 4 years ago

You also need to replace "\" by "\\" in the path for Windows.

POSTED BY: HH C
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract