-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
os.add_dll_directory does not work as expected #10897
Comments
Other issues:
Plus lots of incoming links to ContinuumIO/anaconda-issues#12475. It looks like the behavior of |
Thanks for picking this one up @rgommers @jezdez ! Not being familiar with how Anaconda is built, I was unsure where to put this issue. I figured out that CONDA_DLL_SEARCH_MODIFICATION_ENABLE might be a successful workaround by reading this patch: Specifically:
Looking back, I concluded that "LoadLibraryExW will only respect paths added with os.add_dll_directory if SetDefaultDllDirectories is called appropriately". Not being familiar with the project, I wasn't even sure if this patch is being applied. In any case, reading the comments from the patch, I believe the original authors had good intentions, and suspect that simply making CONDA_DLL_SEARCH_MODIFICATION_ENABLE=1 the default might be contrary to what they were trying to achieve i.e. it might be better to reconsider the patch. |
That's what it reads like, but I have to admit that patch is too complex to grok without spending a lot of time on it first. The current behavior is pretty badly broken though - it's not just |
I can't reproduce this. Can you get me access to a windows machine where this is reproduced? |
See https://github.com/conda-forge/python-feedstock/pull/481/files#r716153174 for a discussion on this at conda-forge. |
Eventually, we hoped that this patch would become unnecessary, but it depends on all the libraries updating to use For CPython, we took the decision to force users into it as they updated to 3.8. Conda decided to retain the old behaviour. Unfortunately, this meant that there was no good feature discovery for libraries (they can't just It may well be time to retire this patch, if the libraries have caught up with necessary fixes. Unfortunately, I don't have the context on what specific issues arose without it, though I know there were some people impacted for reasons other than libraries needing updates. |
For python 3.10, we removed most parts of the patch and except for the part where the python interpreter would run |
FYI, reports continue to come in for SciPy that Python 3.8 + SciPy 1.6.2 to 1.7.3 from
I don't have a Windows machine, sorry. I think that (possible) in-place build issue is much less relevant than the We're dropping Python 3.8 support in mid-2023 only (in SciPy 1.11.0 probably). If this is not going to be changed anymore for Python 3.8, it would be great if SciPy in |
Hi there, thank you for your contribution! This issue has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs. If you would like this issue to remain open please:
NOTE: If this issue was closed prematurely, please leave a comment. Thanks! |
Closed? This is still a frustrating issue to navigate around, without needing to use extra steps like setting |
Original posted at: ContinuumIO/anaconda-issues#12475 by @geoffdavey
Actual Behavior
An import of a Python extension that depends on a DLL that is located in an arbitrary directory will fail, even if the directory containing the DLL has been added to the search path with os.add_dll_directory. The user gets an ImportError e.g.
ImportError: DLL load failed while importing my_module: The specified module could not be found.
Setting the environment variable CONDA_DLL_SEARCH_MODIFICATION_ENABLE=1 causes os.add_dll_directory to work as expected and importing the package succeeds.
Expected Behavior
If os.add_dll_directory has been called appropriately the import should succeed, even if CONDA_DLL_SEARCH_MODIFICATION_ENABLE has not been set.
Steps to Reproduce
The easiest way is to try using a package that depends on os.add_dll_directory e.g. Confluent Kafka Python:
pip install confluent-kafka
and then
I've also reproduced this behaviour with a test Python extension and a test DLL, so the problem is not specific to Confluent Kafka.
Anaconda or Miniconda version:
Anaconda 2021.05
Operating System:
Windows 10
conda info
conda list --show-channel-urls
The text was updated successfully, but these errors were encountered: