Pyinstaller troubles with Pillow - python

I'm trying to use pyinstaller, on OSX Mavericks, with one a Python script. Pyinstaller compiles and packs along until it finds an error with the Pillow library.
ImportError: dlopen(/Users/Rodolphe/.python-eggs/Pillow-2.2.1-py2.7-macosx-10.9-intel.egg tmp/PIL/_imaging.so, 2): Library not loaded: /usr/local/lib/libjpeg.8.dylib
Referenced from: /Users/Rodolphe/.python-eggs/Pillow-2.2.1-py2.7-macosx-10.9-intel.egg-tmp/PIL/_imaging.so
Reason: Incompatible library version: _imaging.so requires version 13.0.0 or later, but libjpeg.8.dylib provides version 9.0.0
It looks like Pyinstaller and Pillow are not getting along (it seems to be a known fact: http://www.pyinstaller.org/ticket/745 ). Is there a way around it? Should I try uninstalling Pillow and installing Pil instead (I chose Pillow out of discouragement from Pil's reluctancy to install on Mavericks, to begin with)? Or maybe update libjpeg.8.dylib to version 13.0.0 as it seems to be the problem?
[EDIT]
I have updated libjepeg thanks to the advice from #mimi.vx I now have another error at the very end of the process:
IOError: [Errno 20] Not a directory: '/Library/Python/2.7/site-packages/Pillow-2.2.1-py2.7-macosx-10.9-intel.egg/PIL/_imaging.so'
I tried reinstalling Pillow so Pyinstaller would maybe get the directory, but no luck yet...
[RE-EDIT]
Using py2app instead of pyinstaller worked for me!

Yes, first try update libjpeg
Good help for OS X can be found in this blog http://brantsteen.com/blog/python-27-libjpeg-pil-on-osx/
libjpg latest source is here www.ijg.org
And Pillow recommended install on OS X is described in pypi.python.org/pypi/Pillow/2.2.1
It is over homebrew $ brew install libtiff libjpeg webp littlecms

Pyinstaller was behaving strangely while importing PIL. I tried using py2app ( http://pythonhosted.org/py2app/ ) instead, and it worked like a charm. No lib ray import trouble or anything. I'd recommend it.

Related

ImportError : image not found when I use Python library--pymrmr

pymrmr version - 0.1.8
Python version -3.6
OS - Mac OS 10.14.5
I want to use a Python library ---pymrmr.
after installing, I get a ImportError when importing it:
import pymrmr
ImportError:
dlopen(/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pymrmr.cpython-36m-darwin.so,
2): Library not loaded: /usr/local/opt/libiomp/lib/libiomp5.dylib
Referenced from:
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pymrmr.cpython-36m-darwin.so
Reason: image not found
I tried some solutions:
brew install libomp
and
brew install llvm
but none works for me.
and I find that the category----/usr/local/opt/libiomp/ does not exists
Only this directory exists ----- /usr/local/opt/libomp/lib/libomp.dylib
Is there something wrong here?
Hope everyone can give me ideas.
Thanks in advance!

anaconda_build tutorial fails on MacOS High Sierra: Library not loaded: libcrypto.1.0.0.dylib

I am following this official guide for building a package for anaconda based on a skeleton. I just want to build the example package used in the tutorial, which is pyinstrument.
I am using anaconda2 version 4.5.11 under MacOS High Siera (10.13.6).
When running the command conda_build pyinstrument, I am getting the following error (full output here):
File
"/Users/me/anaconda2/envs/blbuild/lib/python2.7/site-packages/cffi/vengine_cpy.py",
line 159, in load_library
raise VerificationError(error) cffi.error.VerificationError: importing
'/Users/me/anaconda2/envs/blbuild/lib/python2.7/site-packages/cryptography/_Cryptography_cffi_4ed9e37dx4000d087.so':
dlopen(/Users/me/anaconda2/envs/blbuild/lib/python2.7/site-packages/cryptography/_Cryptography_cffi_4ed9e37dx4000d087.so,
2): Library not loaded: #loader_path/../../../libcrypto.1.0.0.dylib
Referenced from:
/Users/me/anaconda2/envs/blbuild/lib/python2.7/site-packages/cryptography/_Cryptography_cffi_4ed9e37dx4000d087.so Reason: image not found
I have already tried reinstalling openssl via brew, because I found this recommendation when searching SO for the error message, it had no effect on the error though. My openssl version from brew is 1.0.2p in case that matters.
What am I doing wrong?
I was able to finally resolve this issue. The solution was to manually install a package that seems to be required:
conda install cryptography

Libtiff not listed in library path on Win 7

After successfully installing libtiff on win7 I try to run:
tif = TIFF.open("sometiff.tiff")
I get the following error:
File "C:\Python27\ArcGIS10.2\lib\site-packages\libtiff\libtiff_ctypes.py",
line 41, in <module> raise
ImportError: Failed to find TIFF library.
Make sure that libtiff is installed and its location is listed in PATH|LD_LIBRARY_PATH|..
I'm not sure what I need to add to the windows path to make this work successfully.
The directory that contains the dll for libtiff needs to be in your PATH environment variable.
If you did pip install libtiff, then you would have installed it using libtiff from pypi. This seems to be a "wrapper" around libtiff, so you will also need to install the actual libtiff Setup program.
Depending on what you are doing, you may want to look into a more complete distribution of python on windows such as Anaconda, which seems to be quite popular, or Enthought, which the subscription version is well supported. (I believe there is a subscription version of Anaconda, but I have not used it.)

Incompatible Error in OpenCV 2.4.12

I have installed OpenCV and the detail is as follows:
brew info opencv homebrew/science/opencv: stable 2.4.12 (bottled),
HEAD Open source computer vision library http://opencv.org/
/usr/local/Cellar/opencv/2.4.12 (225 files, 36M)
Then, I run the Python to import the library of cv and get the ImportError
ImportError: dlopen(./cv2.so, 2): Library not loaded:
/usr/local/lib/libpng16.16.dylib Referenced from:
/usr/local/Cellar/opencv/2.4.12/lib/libopencv_highgui.2.4.dylib
Reason: Incompatible library version: libopencv_highgui.2.4.dylib
requires version 35.0.0 or later, but libpng16.16.dylib provides
version 34.0.0
I have found some related questions and follow the suggestion to reinstall the libpng to obtain the latest version. Unfortunately, it still does not work..
Here is the details of libnpg:
brew info libpng libpng: stable 1.6.19 (bottled), HEAD Library for
manipulating PNG images http://www.libpng.org/pub/png/libpng.html
/usr/local/Cellar/libpng/1.6.19 (17 files, 1.2M)
I finally tackle the problem!
The "libpng16.16.dylib" in the directory: /usr/local/lib/libpng16.16.dylib is loaded when importing the cv, cv2 modules.
Even I update the version of libpng to be the latest version, new version of "libpng16.16.dylib" is still stored at: /usr/local/Cellar/libpng/1.6.19 but not /usr/local/lib/libpng16.16.dylib.
Therefore, I copy the latest version of "libpng16.16.dylib" to the directory: /usr/local/lib/libpng16.16.dylib, and it is solved!
I am not sure that it is the most appropriate solution, but at least it works.

Pillow import error from _imaging.so / libjpeg.8.dylib on OSX

I've used Pillow in the past on OSX without problems, however I now get the following error.
File "/Library/Python/2.7/site-packages/PIL/Image.py", line 61, in <module>
from PIL import _imaging as core
ImportError: dlopen(/Library/Python/2.7/site-packages/PIL/_imaging.so, 2): Library not loaded: /usr/local/lib/libjpeg.8.dylib
Referenced from: /Library/Python/2.7/site-packages/PIL/_imaging.so
Reason: image not found
I've seen this question which appears to be a similar problem but I don't think I installed Pillow with brew.
I've also tried the solution from this question but the command
pip install PIL --allow-external PIL --allow-unverified PIL
dosent seem to work and I get an error (no such option: --allow-unverified)
Lastly, I've tried to recreate the symbolic link to libjpeg.8.dylib but that also did not make any difference.
Would anyone know how to fix this error? Do I need to do something to relink _image.so aswell as libjpeg?
Python PIL was deprecated eons ago and you should not attempt to use it anymore.
What you want is python[23] -m pip install Pillow
PS. Using pip command will be deprecated soon because of confusions regarding python interpreters, instead of calling pip ... everyone should use only python -m pip ... which assures that is calling the right interpreter.

Categories

Resources