How to use ANACONDA's Python from Julia


#1

Hi,
I am using Pycall to call Python from Julia. From Julia Prompt I used Pkg.add(“PyCall”). During its installation its downloading miniconda for Python.
I have anaconda in my PC and want to use Anaconda’s Python. Is their any way?


#2

From the package README file:

If you want to use a different version of Python than the default [miniconda], you can change the Python version by setting the PYTHON environment variable to the path of the python executable and then re-running Pkg.build(“PyCall”). In Julia:

ENV[“PYTHON”] = "… path of the python program you want …"
Pkg.build(“PyCall”)


#3

Is Anaconda’s Python on the path? If so, it should not download a new Python installation.

As pointed out by @dpsanders in the post below, this is the default only for Linux. Julia on Windows and Mac downloads a minimal private Python installation.


#4

That changes as of IJulia 1.4 (if I remember correctly). The default is now always to download a new conda installation, to try to ensure the correct versions of everything.


#5

How can you do it on Windows?


#6

The same thing should work, or run set PYTHON=c:\path\to\python in a prompt before starting julia.