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?
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?
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?
Unbelievable. This solution from 2018 still applies in 2024.
My devcontainer.json didn’t want to build PyCall but adding the python3 dev packages did the trick.
If someone interested in reproduce it, here is the code for devcontainer.json:
{
"name": "JuliaQuartoPycall",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
// A Feature to install Julia via juliaup. More info: https://github.com/JuliaLang/devcontainer-features/tree/main/src/julia.
"ghcr.io/julialang/devcontainer-features/julia:1": {
"channel": "release"
},
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": "true",
"configureZshAsDefaultShell": true,
"username": "vscode",
"upgradePackages": "true"
},
"ghcr.io/rocker-org/devcontainer-features/quarto-cli:1": {
"version": "latest",
"installTinyTex": false,
"installChromium": false
},
// A comma separated list of Linux packages
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
"packages": "libpython3-dev,python3-dev,python3-pip,qpdf"
}
},
// "onCreateCommand": "pip install --no-cache-dir jupyterlab jupyterlab-git jupyterlab-lsp notebook nbclassic nbconvert",
// "postAttachCommand": "sh ./.devcontainer/install-ijulia.sh",
"postCreateCommand": "julia ./.devcontainer/pkgs.jl",
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Configure tool-specific properties.
// "customizations": {},
"customizations": {
"vscode": {
"extensions": [
"julialang.language-julia",
"tamasfe.even-better-toml",
"ms-python.python",
"ms-toolsai.jupyter"
]
}
}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}