Search code examples
pythonmatplotlibjuliacondaminiconda

How to use packages from a previous Miniconda installation in Julia?


I do physics work and I'm not that knowledgeable in computer stuff, so I'm sorry if this question is rather dumb.

I just installed Julia. I've been using Python for a long time for data analysis and I have various packages installed using Miniconda, including matplotlib. Because of that, I installed IJulia and PyPlot in Julia. When I opened up notebook and entered using PyPlot, it seemed like it was installing several packages that I already had. The output was printing things like:

The following NEW packages will be INSTALLED:

  cycler             pkgs/main/win-64::cycler-0.10.0-py38_0
  icu                pkgs/main/win-64::icu-58.2-ha925a31_3
  jpeg               pkgs/main/win-64::jpeg-9b-hb83a4c4_2
  kiwisolver         pkgs/main/win-64::kiwisolver-1.3.1-py38hd77b12b_0
  matplotlib         pkgs/main/win-64::matplotlib-3.3.4-py38haa95532_0
  matplotlib-base    pkgs/main/win-64::matplotlib-base-3.3.4-py38h49ac443_0
  pillow             pkgs/main/win-64::pillow-8.1.2-py38h4fa10fc_0
  pyqt               pkgs/main/win-64::pyqt-5.9.2-py38ha925a31_4
  qt                 pkgs/main/win-64::qt-5.9.7-vc14h73c81de_0
  tk                 pkgs/main/win-64::tk-8.6.10-he774522_0
  tornado            pkgs/main/win-64::tornado-6.1-py38h2bbff1b_0

When I went to my .julia folder, I found a "conda" folder that seemed like an exact copy of my Miniconda folder, so I deleted this.

Then I found Conda.jl and I thought I should first install that in Julia. After that, I thought I could just immediately see my Conda environments (I only have one, which is the home environment) by entering Conda.list() but the console started saying

[ Info: Downloading miniconda installer ...
[ Info: Installing miniconda ...

I keyboard-interrupted this. When I tried run('conda create -n conda_jl python conda') I got the message "ERROR: IOError: could not spawn `conda create -n conda_jl python conda`: no such file or directory (ENOENT)". So at this point I'm not sure what I should do.

I suppose my immediate question is, is there a way to have PyPlot (the Julia one) call the matplotlib package that I already have from my previous Miniconda installation, and not install anything new? All help would be very appreciated! Thank you!

EDIT: I realized, I haven't deleted my conda folder yet in my .julia folder.


Solution

  • By standard Julia uses its own Python installation that is located by default in ~/.julia/conda/3 where ~ is your home folder.

    To change that youn need to tell Julia to use other Python installation:

    using Pkg
    ENV["PYTHON"]="/path/to/python/binary"
    Pkg.build("PyCall")
    

    Basically using the inbuilt Julia is always easier so if you have problems running such configuration you can always revert:

    using Pkg
    ENV["PYTHON"]=""
    Pkg.build("PyCall")