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

How about checking Python version rather than the executable path? #182

Closed
tkf opened this issue Aug 12, 2018 · 4 comments
Closed

How about checking Python version rather than the executable path? #182

tkf opened this issue Aug 12, 2018 · 4 comments

Comments

@tkf
Copy link
Member

tkf commented Aug 12, 2018

Currently, pyjulia tries to use separate cache if (1) the path of Python interpreters are different or (2) if the current interpreter is statically linked:

use_separate_cache = exe_differs or determine_if_statically_linked()

But according to @stevengj, all that matter is the major part of the Python version number #172 (comment). Then isn't it better to just compare the major version number (which is stored in PyCall/deps/deps.jl)? This would alleviate the issue #173 (difficulty of private cache support in Julia >= 0.7) since this makes Python 3 distributed by some Linux distros (but sadly not Ubuntu) usable with the same PyCall cache. For example, this would make pyjulia usable with Julia >= 0.7 in python Docker image.

If this is the right way to go, I can do the fix (which would be very straightforward, I think).

@stevengj
Copy link
Member

Actually, I think I was wrong — this code will precompile differently if libpython changes (or if libpython is statically linked).

@tkf
Copy link
Member Author

tkf commented Aug 15, 2018

Actually, what I meant to write was to replace the check to see if the path is different (exe_differs) with check for the major version number. I wasn't suggesting to remove determine_if_statically_linked(). (Re-reading it, this is totally not obvious --- sorry about that.)

I also just noticed that checking just major version is not enough since this code also would compile differently in Python < 3.2 and Python >= 3.2. Am I correct?:

https://github.com/JuliaPy/PyCall.jl/blob/3e5831e45421cdedf16397e3653c308f7b4d68c0/src/startup.jl#L108

(Though I think it's OK to drop Python < 3.2. Aren't they somewhat more exotic than 2.7 nowadays?)

So, does it make sense to replace exe_differs with major version check (or major + minor, if we support < 3.2)?

@stevengj
Copy link
Member

The point is, if exe_differs then the path of libpython may differ and hence the pysym macro will change, even if the version number is identical, no?

Also, if the exe is different then the PYTHONHOME may be different, and that is hardcoded into deps.jl.

@tkf
Copy link
Member Author

tkf commented Aug 15, 2018

Ah, I see. Thanks a lot for the explanation. So then my plan won't work...

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