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 #12475
Comments
For Anaconda distributions of Python, os.add_dll_directory does not work properly (ContinuumIO/anaconda-issues#12475). A workaround is to set CONDA_DLL_SEARCH_MODIFICATION_ENABLE=1. Fix #14
Other issues:
Plus lots of incoming links to this issue. It looks like the behavior of |
Only that this would be better suited for a Conda ticket since it's a default to change in Conda, not in the Anaconda distro. |
Opened conda/conda#10897 to track this. |
Great, thanks @jezdez. I moved my comment to that issue. Maybe this issue should be closed then? |
Yeah, agreed, I wanted to wait till you or @geoffdavey acknowledge the move. Unfortunately we can't transfer the issue outright to the conda GitHub org. Thanks for your contributions, all! |
I am not experienced so this might have other reasons, but I get the same error with Python 3.9:
will throw an error that the
I posted a question: https://stackoverflow.com/questions/70937083/why-are-my-dlls-not-found-despite-me-importing-the-path-and-can-i-use-vlc-in-py |
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: