Before someone says "sudo apt-get install libjpeg-dev"
or something along those lines, I do not have sudo access. I am on a slice of a server that does NOT allow me to have sudo access. So I've gotta do this entire thing in my local directory. That's the only way I can do it.
I need a python script to resize an image. It works perfectly fine for png files, but it falls apart on jpeg files with the error listed in the title.
Here are the steps I've taken so far:
libjpeg-dev
and installed it to $HOME/jpegtest
, so inside the jpegtest/ folder is lib/, include/, and so onPillow
manually and extracted it out to $HOME/Pillow
setup.py
fild so the JPEG_ROOT
to a libinclude(<absolute path to jpegtest>)
I built and compiled Pillow
, where it installed to $HOME//.pythonbrew/pythons/Python-2.7.5/lib/python2.7/site-packages/Pillow-2.4.0-py2.7-linux-x86_64.egg
The important part of the output is as follows:
*** TKINTER support not available
--- JPEG support available
*** OPENJPEG (JPEG2000) support not available
--- ZLIB (PNG/ZIP) support available
*** LIBTIFF support not available
*** FREETYPE2 support not available
*** LITTLECMS2 support not available
*** WEBP support not available
*** WEBPMUX support not available
So I would assume that this means JPEG support will function, but when I run my program it says:
IOError: decoder jpeg not available
While typing this I also noticed the question at Pillow recognizes JPEG encoder on install, but not use, which sounded very close to mine, so I tried the solution there:
ln -s /media/sdl1/home/midnight/jpegtest/lib/libjpeg.so /media/sdl1/home/midnight/.pythonbrew/pythons/Python-2.7.5/lib
But I still have the same error.
I've been working on this problem for about two days now, and I'm not entirely sure what to do. If anyone could offer some assistance, that would be very helpful.
Instead of just downloading the libraries you need, try creating an entire Python environment in locally in your home folder:
$ wget http://www.python.org/ftp/python/[desired version of Python].tgz
$ tar xzf Python[version].tgz
$ cd python-[version]
$ ./configure
$ make altinstall prefix=~ exec-prefix=~
Update your PATH variable so that your local Python is executed first:
$ PATH = /home/user/[pathtopython]:$PATH
Obtain pip, from which other packages can be installed:
$ curl https://bootstrap.pypa.io/get-pip.py > get-pip.py
$ ./get-pip.py
$ pip install pillow
URLs may vary. You might still have to modify setup.py - I haven't used this technique with C-like libraries so I'm not sure.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With