I am trying to get a conda python environment to run in Mathematica under Windows. It includes the following packages (in case you want to reproduce):

conda install python=3.7
conda install numpy
conda install netcdf4
conda install pyzmq

After I register the python.exe in "C:/Users/me/Miniconda3/envs/myenv/python.exe" using RegisterExternalEvaluator I can start and use python according to:

session = StartExternalSession["Python"]
ExternalEvaluate[session, "1+1"]


This works. However

session = StartExternalSession["Python"]
ExternalEvaluate[session, "import numpy as np"]

fails with: enter image description here

An error that you typically get when the environment is not activated correctly.

How do I properly activate conda environments for python in Mathematica?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.