Improve libpython detection#394
Improve libpython detection#394bsteffensmeier merged 1 commit intoninia:dev_4.1from ctrueden:libpython-conda
Conversation
|
I think both your questions may be related #354. I think miniconda is using setuptools instead of distutils(can you confirm this?) and setuptools is putting jep in an egg instead of where we expect it. Since distutils is deprecated I think sysconfig would be better than distutils.sysconfig but since we have other work to do to move off distutils it doesn't really matter which you use here. On a python install using distutils I do not need to do install_lib, so I am not sure if it needs to be in the documentation. We would need to test it in more environment and make sure it works. I would really like to get some resolution for #354 before releasing jep 4.1 so we might not care what distutils does since you are targeting 4.1 and we will likely need to update many things for that transition. We do not have a firm release schedule but I am not planning to release jep 4.1 before October. If you need this in sooner we could consider putting this in 4.0.4, let me know if that matters to you. |
|
@bsteffensmeier PR updated to use the basename of the detected path from Also updated the
On my side, I think an October release would be OK, although of course releasing earlier helps the Linux portion of our user community to try out this functionality more easily. I don't want to make extra work for you, but I'm happy to rebase this PR against |
I guess so, since this is the output I see: Which looks a lot like setuptools to me. 😆 The |
PYTHON_LDLIBRARY is used to reload a library that is already loaded. It's my understanding that at that point the path to the library is irrelevant and as long as the basename matches it will be reloaded so what you have is correct.
I am fine either way. It looks like get_python_lib_dir is dead code now and only special on windows while this code is only relevant on linux so it really makes no difference right now.
Let's leave it in dev_4.1. If anything else comes up for a new 4.0 release I will definitely cherry pick it back but otherwise I would rather wait for 4.1. The python code looks good to me but I do not understand the change to the README. I do not see any difference in running setup.py with or without install_lib, as far as I can tell install always runs the install_lib task. The jep script has problems for me in miniconda because of setuptools putting the libraries in an egg. From my brief research I am thinking the readme should probably recommend running |
|
Thanks @bsteffensmeier. I removed the README change for now, until I have time to investigate in more detail why it was necessary for me. If I figure anything out related to that, I'll open a new issue or PR for it. |
This version incorporates ninia/jep#394, which we need for jep to work with conda-based environments on Linux without setting LD_PRELOAD.
This version incorporates ninia/jep#394, which we need for jep to work with conda-based environments on Linux without setting LD_PRELOAD.
This version incorporates ninia/jep#394, which we need for jep to work with conda-based environments on Linux without setting LD_PRELOAD.
This version incorporates ninia/jep#394, which we need for jep to work with conda-based environments on Linux without setting LD_PRELOAD.
This version incorporates ninia/jep#394, which we need for jep to work with conda-based environments on Linux without setting LD_PRELOAD.
This version incorporates ninia/jep#394, which we need for jep to work with conda-based environments on Linux without setting LD_PRELOAD.
This version incorporates ninia/jep#394, which we need for jep to work with conda-based environments on Linux without setting LD_PRELOAD.
This version incorporates ninia/jep#394, which we need for jep to work with conda-based environments on Linux without setting LD_PRELOAD.
As discussed in #392, conda environments on Linux using conda-forge Python have an unfortunate quirk where
LDLIBRARYmay point to a non-existent staticlibpython3.x.alibrary, rather than the actually presentlibpython3.x.soshared library. This patch improves theget_libpython()function ofcommands.pythonto handle this case, across bothMULTIARCHand non-MULTIARCHlocations.It also updates
setup.pyto use theget_libpythonfunction, rather than recapitulating similar logic.Closes #392.
Two questions:
I noticed that
setup.pywas usingimport sysconfigbutcommands/python.pyusesfrom distutils import sysconfig. Looking at the respective docstrings, these two modules do seem distinct, and a quick web search did not help me understand how they differ, or which one is more recommended to use. So a consequence of this patch is thatsetup.pynow transitively leans ondistutils.sysconfiginstead ofsysconfig, although their behavior appears identical regarding theget_config_varfunction. Does this matter at all?I could not figure out how to install jep from source to test this change. I triedEdit: I figured out thatpython setup.py build installfrom a clean working copy, as indicated in the README, but it does not copy over the JAR file:python setup.py install_libwas also necessary. Should this be added to the README?What goes wrong with a developer install
Although a subsequent
python setup.py testdoes pass (230 tests, 26 skipped).What am I doing wrong?