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

Using Python_jll with PyCall #1025

Open
marius311 opened this issue Jan 29, 2023 · 3 comments
Open

Using Python_jll with PyCall #1025

marius311 opened this issue Jan 29, 2023 · 3 comments

Comments

@marius311
Copy link
Contributor

Is there a reason there's not an easy way to use Python_jll's Python with PyCall, something like ENV["PYTHON"]="Python_jll" or something?

As it stands to get the linking right you can do

LD_LIBRARY_PATH=$(julia -e "using Python_jll; print(Python_jll.LIBPATH[])") \
    PYTHON=$(julia -e "using Python_jll; print(Python_jll.python_path)") \
    julia -e 'using Pkg; Pkg.build("PyCall")'

and then you need using Python_jll, PyCall but this could presumably be automated here.

Would a PR adding this be something of interest?

@marius311 marius311 changed the title Using Python_jl with PyCall Using Python_jll with PyCall Jan 29, 2023
@stevengj
Copy link
Member

stevengj commented Jan 31, 2023

I'm not opposed in principle, but how useful is that? How easy it is to install Python packages into Python_jll?

@marius311
Copy link
Contributor Author

marius311 commented Jan 31, 2023

Yea I think thats indeed the key thing deciding usefulness. Fwiw its pretty easy to do poetry env use $(julia --startup-file=no -e "using Python_jll; print(Python_jll.python_path)") then install anything in that virtual environment, but the dynamic linking isnt 100% right unless you manually set LD_LIBRARY_PATH (theres tantalizingly just one single library, libffi, that isnt on an RPATH). I'm still playing with this set up.

In terms of a PR, what I realize is I'm not sure you can do it without having PyCall depend on Python_jll, which seems unwanted. Its because to get the linking right on the Julia side, you need to load Python_jll in PyCall's init. But PyCall cant do that unless its a dep? I guess you could just assume eval Main Python_jll will work? (still seems not great)

@stevengj
Copy link
Member

stevengj commented Feb 1, 2023

Because we generate a deps.jl file, you wouldn't have to use eval, but could instead put it as an optional dependency in Julia 1.9?

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

2 participants