How to run IJulia using the PythonCall CondaPkg Python installation rather than PyCall.jl/Conda.jl

24 Views Asked by At

It seems that PythonCall.jl and CondaPkg.jl are becoming increasingly useful packages. In particular CondaPkg provides tools for the management of Python's virtual environments via CondaPkg.toml which is very convenient due to its similarity to Project.toml.

However, when using Jupyter Notebook via IJulia, another Python Anaconda installation is being created. That results that tons of dependencies are being duplicated in both Conda.jl and CondaPkg.jl environments.

How to force IJulia to use rather the existing CondaPkg installation rather than allow it to install Jupyter via Conda.jl? How to avoid many condas in my Julia-to-Python Jupyter workflows?

1

There are 1 best solutions below

0
Przemyslaw Szufel On

Such configuration can be achieved via the following commands:

using CondaPkg
CondaPkg.add("jupyter")
ENV["JUPYTER"] = CondaPkg.which("jupyter")

using Pkg
Pkg.add("IJulia") # if IJulia was not yet installed
Pkg.build("IJulia") # To change the configuration of existing installation

With this configuration it is possible to avoid duplicating Python packages and stick to CondaPkg for Python environment management.