Getting Started

You will need

  • Julia 1.0 or higher — download here.
  • Python 3.5 or higher — download here or set JULIA_PYTHONCALL_EXE=CONDA (see below).

Install the Julia package PythonCall

using Pkg
pkg"add PythonCall"

Install the Python package juliacall (optional)

This step is only required if you wish to call Julia from Python.

Currently juliacall is shipped with the source of the Julia package, and must be pip-installed manually. The following should work in most shells (including PowerShell):

pip install $(julia -e "using PythonCall; print(PythonCall.juliacall_pipdir)")

Alternatively you can just copy the package (at PythonCall.juliacall_dir) to somewhere in your PYTHONPATH.

Note that this is a very small "bootstrap" package whose sole job is to locate and load Julia; the main functionality is in the main Julia package. Hence it is not necessary to upgrage juliacall every time you upgrade PythonCall.

Note also that regardless of installing juliacall, a module called juliacall will always be loaded into the interpreter by PythonCall. This means that other Python packages can always import juliacall.

Environment variables

If Julia and Python are in your PATH, then no further set-up is required. Otherwise, the following environment variables control how the package finds these.

  • JULIA_PYTHONCALL_EXE: Path to the Python executable. Or one of the following special values:
    • CONDA: Use Python from the default conda environment. In this case, if conda is not detected then Conda.jl will automatically install miniconda in your Julia depot.
    • CONDA:{env}: Use Python from the given conda environment. Also automatically installs miniconda.
    • PYCALL: Import PyCall and use whichever Python that uses.
  • JULIA_PYTHONCALL_LIB: Path to the Python library. Normally this is inferred from the Python executable, but can be over-ridden.
  • PYTHON_JULIACALL_EXE: Path to the Julia executable.
  • PYTHON_JULIACALL_LIB: Path to the Julia library. Normally this is inferred from the Julia executable, but can be over-ridden.