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
New numpy hook for intel mkl libraries #1881
Comments
@maqifrnswa thanks, could you please create a pull request from those two?
|
Hi, Intel MKL FATAL ERROR: Cannot load libmkl_avx2.so or libmkl_def.so. Both libraries are inside the anaconda installation, in the lib folder, but they are not being included in the wrapped executable, and if the program is searching for them in the machine it is not having success. Looking for a solution I found this thread, I guess that what I will need to try is to use the hook provided by maqifrnswa? |
Hi, I did try that, using the hook described as runtime-hook, but got the following error: Traceback (most recent call last): I see in the log that it has included it (18880 INFO: Including custom run-time hook 'hook_numpy.py'), but the error happens each time and I see many missing modules from numpy in the warnings folder. I read the answer on http://stackoverflow.com/questions/35478526/pyinstaller-numpy-intel-mkl-fatal-error-cannot-load-mkl-intel-thread-dll and one of them suggest that problems when using the hook might come from using different Python package management schemes. In my case, some of the packages where installed directly by conda and have a built string of py27_*, some others with pip, and in particular, biopython, matplotlib and scipy have one called np110py27. Could that be a problem? |
I have also tried to include the libraries as binaries in the spec file and then compile from the spec, but it keeps happening. Someone in the scikit-learn repo told me that this could be related with the numpy version, as mentioned in scikit-learn/scikit-learn#6508 (comment). However, I do have the version 1.10.4, so apparently that should not be a problem. |
Just for the record, browsing through github scikit-learn project issues, I found the post at Anaconda blog where they describe how to inactivate the mkl versions of the libraries (https://www.continuum.io/blog/developer-blog/anaconda-25-release-now-mkl-optimizations) and now I can compile a working version. I don't think this is a problem at all with pyinstaller but with some of the libraries I call, so sorry for all the mess! At least I have learnt about other Pyinstaller options that I had never used, such as the binaries addition or the runtime or linktime hooks. I am pretty new to Pyinstaller so that was good :) Thanks anyway! |
@clacri Thanks for those links, that is very helpful! I didn't know about turning off mkl optimizations. @matysek Looking through the Anaconda EULA https://docs.continuum.io/anaconda/eula it says re-distribution is allowed, as long as it is redistributed "with anaconda." Since an app frozen with PyInstaller includes a subset of the anaconda distribution (and thus is a derivative of anaconda), redistribution of mkl should be acceptable as long as the terms of the anaconda license are also met. Is there some document in PyInstaller to let users of specific distributions know that there are licensing terms they need to follow? If so I can update it to include info on the mkl libraries. I hope to update and test hook within a couple of days. (edits for clarification are in bold) |
@maqifrnswa IMHO this EULA is not quite clear about the mkl-library licence Would you please be so kind clarifying this with continum.io and issue a pull request? Thanks BTW: This is plain wrong:
The frozen application does include "a subset of the anaconda distribution", but not PyInstaller. PyInstaller is only the tool or creating this subset. |
Thank you - that's what I meant, the pyinstaller application includes a distribution - not pyinstaller. I've edited my previous statement to be clear. I'll do the pull request and ask for clarification from continuum. Busy with day job, might not get to the pull request for a couple of days. |
I'm also having trouble bundling numpy from the anaconda distribution due to missing MKL runtime libraries. |
What platform? The development version of Pyinstaller should now bundle these on Windows. |
The current numpy.core hook in PyInstaller only looks for DLLs in the numpy folder, but it doesn't install the MKL DLLs from the python
Platform is Windows. Tested with current Anaconda distribution and the PyInstaller develop branch. |
On Windows, MKL is looking for |
Ah sorry, I just lazily copy pasted the error message from one of the first comments above. But the same problem occurs when bundling from Anaconda for windows, the library names are just different of course ( |
I'm hacking up a bit of code that might help. Would you be able to test when it's ready? |
I hacked up this numpy.core hook, which is based on your work for fixing the Pandas issue (#1969). Additionally to searching the numpy.core directory, I added a search for MKL libs in Library\bin. This works for Anaconda on Windows and shouldn't break anything this hook has achieved before. Edit: Proposing a PR with a modified numpy.core hook that should work on windows and linux alike |
Proposed fix: #2111 |
Sure, I'll be happy to test it. What should I do, download the latest development version of pyinstaller and try to compile, but this time with numpy using MKL in Anaconda? |
I think the following will do a pip install at the specific commit
|
Hi, I did install the version @stephenrauch provided, in a Linux system. I did uninstall the nomkl version of the packages affected (numpy, matplotlib, scipy, etc) and reinstall the mkl ones through Anaconda. However, the binary compiled keeps throwing an error when the program is running: Intel MKL FATAL ERROR: Cannot load libmkl_mc3.so or libmkl_def.so |
Ok, I see. Just downloaded the anaconda distribution for Linux and the folder layout is different. Instead of "Library/bin" we need "lib" here. I'm wondering if there is a way to detect the dynamic linker search path from within python.. |
Does this help? |
It does, thank you! So, in conclusion: Finding dynamic libraries automatically is "complicated". Here is one more try for @clacri. This time with a Is this pip command sufficient? I remember some
|
Hi, |
Great! Squashed the commits again in PR #2111. There are some automated test failures, but I assume this is unrelated to the numpy hook change? |
Fix #1881: Modify numpy.core hook for supporting numpy MKL builds.
Hello - anaconda and winpython build numpy against Intel's mkl libraries. Building someone that uses numpy will need to have those libraries.
Here is a winpython hook:
http://stackoverflow.com/a/35853001
and I adapted that for anaconda & python3:
https://github.com/maqifrnswa/scimpy/blob/master/pyinstaller-hooks/hook-numpy.py
The text was updated successfully, but these errors were encountered: