JuliaPy / JuliaPy/PyCall.jl

Wrong libpython configuration after changing python dir on Linux

Open
#993 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
1.5k
Forks
186
PR merge metrics
No merged PRs in 30d

Description

I want to make a portable app with PyCall included, so I move conda into a common folder (this folder I would later copy to another machine when deploying compiled app binaries):
```
sudo cp -rf ~/.julia/conda /opt/conda
```

Then I rebuild PyCall and make sure all conda and python-related paths (there are much of them!) point to the right place:
```julia
julia -e 'import Pkg;
ENV["CONDA_JL_HOME"] = "/opt/conda/3";
ENV["PYTHON"] = "/opt/conda/3/bin/python3.9";
Pkg.add("PyCall");
Pkg.build("PyCall");

using PyCall
@info(
"Conda.jl and PyCall.jl configuration after build, BUT wrong libpython!",
PyCall.Conda.ROOTENV,
PyCall.Conda.MINICONDA_VERSION,
PyCall.Conda.deps_file,
PyCall.Conda.PREFIX,
PyCall.Conda.BINDIR,
PyCall.Conda.LIBDIR,
PyCall.Conda.SCRIPTDIR,
PyCall.Conda.PYTHONDIR,
PyCall.Conda.conda,
PyCall.Conda.CONDARC,
PyCall.PYTHONHOME,
PyCall.libpython
)
'
```

Which gives me all paths set right but `PyCall.libpython`, which prevents me from running my compiled app on another machine: (also, I'm not sure about colons in `PyCall.PYTHONHOME`)
```
┌ Info: Conda.jl and PyCall.jl configuration after build, BUT wrong libpython!
│ PyCall.Conda.ROOTENV = "/opt/conda/3"
│ PyCall.Conda.MINICONDA_VERSION = "3"
│ PyCall.Conda.deps_file = "/home/root2/.julia/packages/Conda/x2UxR/src/../deps/deps.jl"
│ PyCall.Conda.PREFIX = "/opt/conda/3"
│ PyCall.Conda.BINDIR = "/opt/conda/3/bin"
│ PyCall.Conda.LIBDIR = "/opt/conda/3/lib"
│ PyCall.Conda.SCRIPTDIR = "/opt/conda/3/bin"
│ PyCall.Conda.PYTHONDIR = "/opt/conda/3/bin"
│ PyCall.Conda.conda = "/opt/conda/3/bin/conda"
│ PyCall.Conda.CONDARC = "/opt/conda/3/condarc-julia.yml"
│ PyCall.PYTHONHOME = "/opt/conda/3:/opt/conda/3"
└ PyCall.libpython = "/home/root2/.julia/conda/3/lib/libpython3.9.so.1.0"
```

Contents of deps.jl:
```bash
$ cat /home/root2/.julia/packages/Conda/x2UxR/src/../deps/deps.jl
const ROOTENV = "/opt/conda/3"
const MINICONDA_VERSION = "3"
const USE_MINIFORGE = true
const CONDA_EXE = "/opt/conda/3/bin/conda"
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the configuration with Pkg.build("PyCall") and inspect the generated deps.jl alongside PyCall.Conda.libpython and PyCall.PYTHONHOME. Trace where PyCall.libpython is selected after the conda directory changes; done means it resolves under /opt/conda/3 and the portable compiled app can run on another machine.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia, python
Domain
backend, build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.