LoadError: Couldn't find libpython PyCall

I can’t build PyCall on linux mint 18.3

julia> Pkg.build(“PyCall”)
Building Conda ─→ ~/.julia/packages/Conda/hsaaN/deps/build.log
Building PyCall → ~/.julia/packages/PyCall/rUul9/deps/build.log
┌ Error: Error building PyCall :
│ ERROR: LoadError: Couldn’t find libpython; check your PYTHON environment variable.

│ The python executable we tried was python3 (= version 3.5);
│ the library names we tried were [“libpython3.5m.so”, “libpython3.5m”, “libpython3.5”, “libpython”]
│ and the library paths we tried were AbstractString["/usr/lib", “/usr/lib”, “/usr”, “/usr/lib”]
│ Stacktrace:
│ [1] error(::String) at ./error.jl:33
│ [2] find_libpython(::String) at /home/mikhail/.julia/packages/PyCall/rUul9/deps/build.jl:129
│ [3] top-level scope at logging.jl:313
│ [4] top-level scope at /home/mikhail/.julia/packages/PyCall/rUul9/deps/build.jl:196
│ [5] include at ./boot.jl:317 [inlined]
│ [6] include_relative(::Module, ::String) at ./loading.jl:1041
│ [7] include(::Module, ::String) at ./sysimg.jl:29
│ [8] include(::String) at ./client.jl:388
│ [9] top-level scope at none:0
│ in expression starting at /home/mikhail/.julia/packages/PyCall/rUul9/deps/build.jl:170
└ @ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:1069

I have python3.5 at /usr/local/lib

And yes, I saw #565 and #556 and PyCall: couldn’t find libpython
They write that solved issue. But I don’t understand what to do, I’m not such cool programmer as you.

PS
I installed everything without problems in May, what happened?

Can you verify that you have a libpython in one of the exact locations that the error indicates were attempted, and tell us specifically which one?

I have python3.5 at /usr/local/lib

Error says it tried:

library paths we tried were AbstractString["/usr/lib", “/usr/lib”, “/usr”, “/usr/lib”]

So I noticed it, but I don’t know how to fix

Is it libpython or are you talking about the python executable itself? Normally the executable should be in /usr/bin or /usr/sbin and the libraries would be in /usr/lib, /usr/local/lib or a subdirectory thereof.

Can you check which libpython you have in the lib directory?

OK, forget about it. I will just downgrade to older version of julia which worked perfectly or find something else

Ah, I think I can clear this up: I just checked on Ubuntu, /usr/local/lib/python3.5 is where it keeps python scripts. This is not the python library which will appear as libpython3.5.so or something like that.

Can you check to make sure that you have libpython3-dev and python3-dev installed with
apt install libpython3-dev python3-dev?

Many thanks.
I installed libpython3-dev and it worked

1 Like