llvmlite icon indicating copy to clipboard operation
llvmlite copied to clipboard

libllvmlite.dylib error with py2app

Open nsalomonis opened this issue 7 years ago • 6 comments

Greetings,

A component of a py2app binary I am producing is the algorithm UMAP (dimensionality reduction method). This works fine with my local versions of python but when creating a frozen binary with py2app, UMAP fails due to a llvmlite error which I posted here:

https://stackoverflow.com/questions/53699054/umap-fails-upon-py2app-build-due-to-libllvmlite-dylib-error

I wasn't sure the best place to ask this question, but here seems appropriate. I have replicated this error on two different Mac's, both with py2app version 0.10 (other versions of py2app produced compilation errors). Everything else seems to be bundling properly.

Thanks, Nathan

nsalomonis avatar Dec 10 '18 22:12 nsalomonis

OK, thanks for letting us know. @sklam will take a look.

seibert avatar Dec 11 '18 14:12 seibert

It looks like the issue can be resolved by simply adding llvmlite to the "packages" in py2app; i.e. python setup.py py2app --packages llvmlite. I think the reason is that py2app is zipping up the site-packages, causing the libllvmlite.dylib to be inside an archive when llvmlite tries to ctypes.CDLL load it. By adding "llvmlite" to "packages", the bundled app will have the llvmlite package available outside of the archive. Note, numpy is automatically placed outside of the archive. I think py2app may have special knowledge about numpy and other libraries that have DLL.

Final note, regular python C-extensions are fine because python can load them from zip. I don't know if we can load regular DLL from zip archive as easily.

sklam avatar Dec 28 '18 22:12 sklam

Thank you Siu for the response. Your solution for Py2app works as I noted in the stackoverflow post.

Related to question related to loading regular DLL files from the zip, when I move to a PC with py2exe, I am also getting a llvmlite error:

File "numba_init_.pyc", line 11 in File "numba\config.pyc", line 19 in File "llvmlite\binding_init_.pyc", line 6 in File "llvmlite\binding\dylib.pyc", line 4 in File "llvmlite\binding\ffi.pyc", line 128 in WindowsError: [Error 126] The specified module could not be found

This error indicates that a dependent DLL cannot be found. What dll's are called here by llvmlite on Windows?

nsalomonis avatar Dec 30 '18 03:12 nsalomonis

A follow-up... I found the llvmlite.dll and copied that to the py2exe frozen directory and bypassed that error, so the question is how to get py2exe to recognize that dll and copy it over.

nsalomonis avatar Dec 30 '18 14:12 nsalomonis

@nsalomonis, can you test if https://github.com/numba/llvmlite/pull/447 would help avoid manual specification of the DLLs?

sklam avatar Jan 02 '19 18:01 sklam

What would be the specific edit to the py2exe script related to pkg_resources?

nsalomonis avatar Jan 02 '19 21:01 nsalomonis