7
$\begingroup$

I have installed Anaconda3 (version 5.3.1 for Windows with Python 3.7, 64-bit) as the Python working enviroment, but when trying to register it as an external evaluator, it RegisterExternalEvaluator fails.

RegisterExternalEvaluator["Python", "C:\\ProgramData\\Anaconda3\\python.exe"]

RegisterExternalEvaluator::invalid: -- Message text not found -- (ExternalEvaluate`Private`reason)

Mathematica can only can find the Python evaluator installed by SystemInstall["Python"], but I need to use the Anaconda version.

$\endgroup$
12
  • $\begingroup$ Please eliminate the trivial issues, make sure you follow the documentation precisely, and if it still does not work, then fully update/rewrite the question (don't just comment), including all relevant information (what did you do, what happened e.g. errors messages, what did you expect to happen) $\endgroup$
    – Szabolcs
    Nov 27 '18 at 10:44
  • $\begingroup$ I am getting a failure (providing the path to the executable) with RegisterExternalEvaluator::invalid: -- Message text not found -- (ExternalEvaluatePrivatereason). $\endgroup$ Nov 27 '18 at 11:26
  • $\begingroup$ See the workflow Configure Python For ExternalEvaluate in the documentation. If after following those instructions you still have an issue then see this post (155821). $\endgroup$
    – Edmund
    Nov 27 '18 at 12:30
  • 1
    $\begingroup$ Did you install pyzmq? $\endgroup$
    – Szabolcs
    Dec 2 '18 at 8:17
  • 1
    $\begingroup$ Yes, pyzmq was intalled via pip command. $\endgroup$
    – Jerry
    Dec 2 '18 at 8:48
3
$\begingroup$

After two days of battling this problem on Windows10, with limited success (including full system reset), the problem was fixed from this link: https://community.wolfram.com/groups/-/m/t/1975953

For posterity, the solution is

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\\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.

  1. (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.

  1. Now the conda should work in Mathematica. You can check it by FindExternalEvaluators["Python"] .
$\endgroup$
3
$\begingroup$

After reinstalling Anaconda different versions many times, it comes true that MMA does not support registering Python3.7 as an external evaluator now, so if Anaconda chosen to be used, choose the right version is necessary here, Anaconda3-5.2.0, which integrated Python3.6, more versions could be found at the archive site .

When Anaconda5.2 installed, follow the offical steps to make it. see more here and help center.

$\endgroup$
5
  • $\begingroup$ I see no problems with Python 3.7 on macOS i.stack.imgur.com/yhuq9.png $\endgroup$
    – Szabolcs
    Dec 2 '18 at 8:20
  • $\begingroup$ @Szabolcs Thanks! I have no idea about ver.3.7 on MacOS, using Windows. $\endgroup$
    – Jerry
    Dec 2 '18 at 8:47
  • $\begingroup$ Have you asked WRI Support? $\endgroup$
    – Kuba
    Dec 2 '18 at 11:09
  • $\begingroup$ @Kuba Not yet. I just try to determine whether it's proper to work with Python in the notebook or not. The default method supported by SystemInstall is enough at the end. $\endgroup$
    – Jerry
    Dec 2 '18 at 11:42
  • $\begingroup$ I cannot get python 3.7.5 working in Mathematica 12.0 in Windows 10 too. So I create an environment of python 3.6 and it works now. $\endgroup$
    – Jake Pan
    Nov 7 '19 at 0:34
0
$\begingroup$

I am using MMA 12.0. After many attempts, I found that any version of Python could work on Windows 10 as long as you are not using anaconda-python. Just properly set the PATH to make sure you can properly install pyzmq. I also tried anaconda with python 3.7.3, but MMA just could not recongnize it (though pyzmq is also installed).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.