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

Make anaconda_conda work in PyJulia imported in python interpreter statically-linked to libpython. #559

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/PyCall.jl
Expand Up @@ -622,6 +622,9 @@ function anaconda_conda()
if conda || !occursin("conda", unsafe_string(ccall(@pysym(:Py_GetVersion), Ptr{UInt8}, ())))
return ""
end
if isempty(pyprogramname)
return ""
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means it will never find conda for statically linked libpython. Is that what we want?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. But, I think that's fine because it's called from a Python executable. I don't think Python packages don't usually install Python package dependencies automatically at runtime.

Having said that, pyimport("sys")[:executable] is technically a valid option here. But I don't think that's the right thing to do. Please see #560

aconda = joinpath(dirname(pyprogramname), "conda")
return isfile(aconda) ? aconda : ""
end
Expand Down
1 change: 1 addition & 0 deletions src/startup.jl
Expand Up @@ -80,6 +80,7 @@ else
# If we're not in charge, assume the user is installing necessary python
# libraries rather than messing with their configuration
const conda = false
const pyprogramname = ""
end

const pyversion = vparse(split(Py_GetVersion(libpy_handle))[1])
Expand Down