PythonCall.jl icon indicating copy to clipboard operation
PythonCall.jl copied to clipboard

PYTHON_JULIACALL_BINDIR not effective?

Open xgdgsc opened this issue 6 months ago • 7 comments

Affects: JuliaCall
From my understanding it still tries to connect the internet when call https://github.com/JuliaPy/PythonCall.jl/blob/0a7d49f274147e9876fee47981d9aa5459f6eb8c/pysrc/juliacall/init.py#L160C44-L160C54 ? Describe the bug PYTHON_JULIACALL_BINDIR not effective. It still tries to connect the internet and install julia?

Image

Your system linux centos 7

Additional context Add any other context about the problem here.

xgdgsc avatar May 29 '25 03:05 xgdgsc

I don' t understand why doing from juliacall import Main as jl would make it trying things online? Can we just make it totoally offline when importing and only do online stuff with juliapkg ?

xgdgsc avatar May 29 '25 03:05 xgdgsc

Ah the docs maybe aren't clear, if you are trying to use a pre-installed Julia, set PYTHON_JULIAPKG_EXE.

cjdoris avatar May 29 '25 07:05 cjdoris

Thanks for the tip. Is there a way to import without any attempt to do online staff? I want to share a depot to other python user on same machine without any knowledge of julia to use a self hosted git master julia package. What' s the recommended way to do something like this now?

xgdgsc avatar May 29 '25 08:05 xgdgsc

I've not had to do that before so not sure, but some combination of PYTHON_JULIAPKG_EXE, PYTHON_JULIAPKG_PROJECT, PYTHON_JULIAPKG_OFFLINE, JULIA_DEPOT might help.

For a bit on how juliapkg works: it will only download things if it needs to, namely it downloads Julia if you don't have a compatible version already and it downloads packages when dependencies change. So if you resolve once it will not go online again unless any of your dependencies change.

So one way to solve your problem would be to resolve once and then copy the whole filesystem state to your offline system.

Let me know if you figure it out - would be good to add this to the FAQs.

cjdoris avatar May 29 '25 09:05 cjdoris

Thinking a bit more:

  • Setting PYTHON_JULIAPKG_EXE will use a specific Julia, so won't download one.
  • Setting PYTHON_JULIAPKG_OFFLINE=yes will prevent any packages from being downloaded.
  • However this means the Julia project used will not have any packages. So you should create the project you need yourself and set PYTHON_JULIAPKG_PROJECT to its path.
  • Possibly set JULIA_DEPOT if your depot is not in the default place.

cjdoris avatar May 29 '25 10:05 cjdoris

If what you actually want is to have a read-only depot but let people create their own projects from it while offline, that may require some changes to juliapkg.

cjdoris avatar May 29 '25 10:05 cjdoris

I think I'm going to change how offline mode behaves in juliapkg. Instead of just skipping installing packages entirely, I'll change it to do the same package install steps but with Julia's package manager in offline mode so it can install already-downloaded packages.

cjdoris avatar May 29 '25 12:05 cjdoris