Error building PyCall in v0.7 / Conda.jl did not install Python?


I’m trying to move to Julia 0.7 on Ubuntu. I installed Conda.jl without errors but I’m having trouble with PyCall:

  Building Conda ─→ `~/.julia/packages/Conda/m7vem/deps/build.log`
  Building PyCall → `~/.julia/packages/PyCall/rUul9/deps/build.log`
┌ Error: Error building `PyCall`: 
│ Traceback (most recent call last):
│   File "<string>", line 1, in <module>
│ ModuleNotFoundError: No module named 'distutils.sysconfig'
│ ┌ Info: No system-wide Python was found; got the following error:
│ │ ErrorException("failed process: Process(setenv(`python3 -c \"import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'))\"`

That Python command indeed fails on Ubuntu. Apparently the reason is that Debian has broken distutils.sysconfig:

But this should all be resolved if I just switch to a Python distribution that did not come from Debian. I thought that that was exactly what Conda.jl was supposed to do. In my Julia v0.6 install I see that Conda has a copy of Python in


But I cannot find a similar Python install now in v0.7/Conda. In fact, Conda doesn’t seem to have installed almost anything at all.

~ % cd ~/.julia/packages/Conda 
~/.julia/packages/Conda % find . -name python
~/.julia/packages/Conda % ls
~/.julia/packages/Conda %
~/.julia/packages/Conda % ls m7vem/deps/usr
~/.julia/packages/Conda %

So I’m not really sure where to go from here. I think that the solution to my problem with PyCall is to use Conda to install a separate copy of Python, but I can’t figure out why that didn’t happen the moment I installed Conda.

Any help would be greatly appreciated.

It probably would be fixed by (See also

BTW, you can find the location of Conda.jl by using Conda; pathof(Conda) in Julia >= 0.7.

Thanks. I can’t figure out how to bring those changes into my local copy of PyCall. I don’t use git a lot; I’m not sure how to handle PRs.

Does executing ] add PyCall#remotes/cache/pull/556/head in Julia REPL work?

That seems to indeed pull the PR. When I tried that I got the errors again, but then I noticed that it was also complaining about curl. Then I figured that this computer doesn’t have curl installed and for some reason I never noticed. I installed curl and rebuilt Conda, PyCall, and PyPlot and all of that seems to have worked. I even have a Python distribution inside Conda now.

I’ve now verified that PyPlot works. So in the end it seems that the problem was a missing curl.

Thanks for the help!

Oh, one follow-up question: I see that ] creates some kind of “pkg” shell. That’s great. Now how do I get out to go back to the regular julia REPL?

backspace (ctrl-h) should do it


PR 556 is supposed to work even without Conda.jl (though using Conda is OK as well). In case you want to switch Python distribution/environment, checkout GitHub - JuliaPy/PyCall.jl: Package to call Python functions from the Julia language

Oh, and don’t forget to do ] free PyCall once the new version of PyCall is released.

Thanks. What does ] free PyCall do?

See ]?free (and also ]?add):

(v1.0) pkg> ?free
  free pkg[=uuid] ...

  Free a pinned package pkg, which allows it to be upgraded or downgraded again. If the package is checked out
  (see help develop) then this command makes the package no longer being checked out.