Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Image Build: PyCall not found in current path #1031

Closed
calvinp0 opened this issue Mar 19, 2023 · 0 comments
Closed

Docker Image Build: PyCall not found in current path #1031

calvinp0 opened this issue Mar 19, 2023 · 0 comments

Comments

@calvinp0
Copy link

calvinp0 commented Mar 19, 2023

Hi,

I am trying to build a docker image with python and julia, and have this set of instructions:

ENV PATH /opt/conda/envs/rmg_env/bin:$PATH
ENV PYTHONPATH /home/mambauser/Code/RMG-Py
ENV PATH /home/mambauser/Code/RMG-Py:$PATH
ENV LD_LIBRARY_PATH /opt/conda/envs/rmg_env/lib
ENV PYTHON=/opt/conda/envs/rmg_env/bin/python
ENV PYCALL_JL_RUNTIME_PYTHON=/opt/conda/envs/rmg_env/bin/python

RUN  /opt/conda/envs/rmg_env/bin/python -c "import julia; julia.install(); import diffeqpy; diffeqpy.install()" \
    && /opt/conda/envs/rmg_env/share/julia/site/julia-1.8.5/bin/julia -e 'using Pkg; \
              ENV["PYCALL_JL_RUNTIME_PYTHON"] = "/opt/conda/envs/rmg_env/bin/python"; \
              ENV["PYTHON"]="/opt/conda/envs/rmg_env/bin/python"; \
              ENV["LD_LIBRARY_PATH"]="/opt/conda/envs/rmg_env/lib"; \
              ENV["PYTHONPATH"]="/home/mambauser/Code/RMG-Py"; \
              ENV["PATH"]="/home/mambauser/Code/RMG-Py:/opt/conda/envs/rmg_env/bin"; \
              Pkg.add(PackageSpec(name="PyCall", rev="master")); \
              Pkg.build("PyCall"); \
              using PyCall; \
              Pkg.add(PackageSpec(name="ReactionMechanismSimulator", rev="main")); \
              using ReactionMechanismSimulator'

Everything goes smoothly, but when I create a container and enter the shell of the container and attempt to do python-jl, I receive the following error:

ERROR: ArgumentError: Package PyCall not found in current path.
- Run `import Pkg; Pkg.add("PyCall")` to install the PyCall package.
Stacktrace:
 [1] macro expansion
   @ ./loading.jl:1163 [inlined]
 [2] macro expansion
   @ ./lock.jl:223 [inlined]
 [3] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1144

If I then follow the instructions by adding PyCall to Julia whilst in the container, it then works fine.

Any advice on how to deal with this issue?

I also found this in the container:

(rmg_env) mambauser@3852866d0c79:~$ cat .julia/environments/v1.8/Project.toml
[deps]
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
ReactionMechanismSimulator = "c2d78dd2-25c4-5b79-bebc-be6c69dd440f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant