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

Why must both PYTHON_JULIACALL_PROJECT and PYTHON_JULIACALL_EXE be set together?

Open oxinabox opened this issue 3 months ago • 3 comments

I wanted to set my PYTHON_JULIACALL_PROJECT manually because i wanted to manage my julia dependencies manually, so i could use them both in julia (for testing) and via juliacall. And because i didn't want them to be in my conda directory as that doesn't get version controlled and i wanted the manifest to get version controlled

But I didn't want to set my PYTHON_JULIACALL_EXE because I do not know where julia wil be installed on any of my collaborators machines and am happy to let them be worked out by juliapkg.

But i tried this and then got an error on import juliacall

Exception: Both PYTHON_JULIACALL_PROJECT and PYTHON_JULIACALL_EXE must be set together, not only one of them.

oxinabox avatar Sep 19 '25 05:09 oxinabox

It's because if you have created and instantiated a Julia project (JuliaCall requires the project to be instantiated) then you already have a Julia executable to do that - in which case you should use the same Julia in JuliaCall.

Maybe set PYTHON_JULIAPKG_PROJECT instead? This will still use juliapkg for dependency management.

Or set PYTHON_JULIAPKG_EXE=julia assuming they already have julia in their PATH.

cjdoris avatar Sep 19 '25 08:09 cjdoris

JuliaCall requires the project to be instantiated

That's annoying. I just want to manage my Manifest.toml and Project.toml myself and version control those. I don't want to have to instantiate them manually. As well has have access to that location being implictly on my JULIA_LOAD_PATH (though right now I am doing that manually)

Maybe set PYTHON_JULIAPKG_PROJECT instead? This will still use juliapkg for dependency management.

This doesn't seem to be anywhere in the docs, what does it do?

oxinabox avatar Sep 19 '25 10:09 oxinabox

That's annoying.

That's just how Julia works - if someone gives you a Project.toml and a Manifest.toml, you have to instantiate it first. JuliaCall intentionally doesn't touch Pkg itself, that is delegated to JuliaPkg. So if you want it automatically instantiated you need to stick with JuliaPkg.

This doesn't seem to be anywhere in the docs, what does it do?

It's here in the JuliaPkg docs although yeah it should also get covered in the JuliaCall docs. It lets you specify where the Julia project is that JuliaPkg installs things into. On JuliaPkg v0.1.20+, if it's a pre-existing project then it will leave existing dependencies alone.

cjdoris avatar Sep 19 '25 22:09 cjdoris