-
Notifications
You must be signed in to change notification settings - Fork 226
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
MKL library load error (libmkl_avx2.so or libmkl_def.so) #9228
Comments
Clearly related to #720 |
I can fix the issue by setting this environment variable:
|
I think it's related to AnacondaRecipes/numpy-feedstock#5 even though numpy isn't involved here, the load order of openmp and mkl matters a lot. If the system loads GNU openmp, then MKL needs to respect that (but does not default to it). Intel's patch to numpy tries to do a runtime detection for this. It will be added to future MKL versions too, but that doesn't help you much here. What exactly is pulling in mkl here? Is it just scipy, or are other things also using it? |
Interestingly, |
Ah, |
Confirmed that this works with the latest cvxopt 1.2.0 packages I've built. Closing this out. There are mkl and openblas variants there - you should be able to pick between them by adding the nomkl package (or not). |
Wait so is
The accepted solution? That seems... suboptimal. Why is the problem happening? I'm no ldconfig whiz... I wonder if anybody could explain to me in layman's term why some packages are having a tough time loading shared libraries from /opt/conda/lib? |
Very interesting and confusing: (with Windows 10) Installed Anaconda 5.3 today after uninstalling Anaconda 5.2, and now I keep getting this error when importing numpy. Nothing can fix this and no idea why this is happening. |
My guess would be that LD_PRELOAD is proposed as the answer because other MKL libraries get found otherwise. We compile all of our binaries so that they look for MKL in our stuff, but if you load MKL into your process before our stuff goes looking for it, the other one will already be loaded. New packages are built with newer MKL. The lower bound of their compatibility is the version that they were built with. Newer MKL works with stuff built with older MKL, but not vice versa. @shldngzh you probably have MKL somewhere else on your system. It used to be a compatible version, but now it is too old. You must find any MKL DLL's that would be getting found first and remove them. See #8561 for more discussion on this issue. |
Thanks @msarahan, that is very clear. It feels deeply tragic that the dynamic linking architecture wasn't designed to deal better with loading multiple versions of the "same" library. |
Tell me about it! That's the vast majority of the issues that our users have. |
Run with LD_DEBUG=libs to see what's going on here. |
@msarahan Thanks for your advice! I do not have any mkl*.dll in my system32 folder and whether I add Python to my system PATH, importing numpy would always throw an error. However, the errors are different: if Python is added to PATH (chosen when installing with Anaconda), error message is "cannot load mkl_intel_thread.dll". if Python is NOT added to PATH, error message is
I'm still trying to locate (if any) an older version of mkl lib, probably it's my Matlab 2011b. |
You need to activate your env rather than manually editing |
@msarahan @mingwandroid So the issue may be viewed as - somewhere you have an old version of mkl lib gets loaded before the mkl libs in Anaconda. This may not cause any trouble if you run something from Anaconda prompt; however, if you use IDE like PyCharm or run a script in PowerShell, it might do. Thanks to everyone. |
We do not support running outside of activate. You can activate from the Anaconda Prompt then launch PyCharm from that if you want things to work properly. Otherwise use VSCode, that does activate conda envs properly (a fairly recent addition I think). Maybe the PyCharm people would consider fixing this? It may be worth asking them to. |
@shidnzgh to build on Ray's point, environment activation requires doing more than just setting the PATH properly. For instance, many packages require certain environment variables to be set. In fact. In theory, a conda package can require arbitrary code to execute on activation, though that's strongly discouraged. Still, the only way to ensure that a conda environment is properly ready to use is to activate. |
This is good to know. I didn't think about launching PyCharm from Anaconda Prompt. Thanks. My problem is solved by removing an old version of mkl lib, but now I do get your point that "it needs to be activated" and it should be the most guaranteed way to make sure a correct and consistent environment is in use. |
Actual Behavior
Python crashes with the following error:
Expected Behavior
No crashy
Steps to Reproduce
On Linux 64:
Then start a python prompt and:
Anaconda or Miniconda version:
Here's the exact environment:
Operating System:
Linux 64. This is on AE5.
The text was updated successfully, but these errors were encountered: