Question

I tried all of the procedure for installing django-cms, after that when i try to run a demo page i getting the below error.

(djvenv2)shan@shan:~/workspace/projects/djvenv$ pip freeze
Django==1.6.2
PIL==1.1.7
Pillow==2.4.0
South==0.8.4
argparse==1.2.1
dj-database-url==0.3.0
django-classy-tags==0.5.1
django-cms==3.0
django-mptt==0.6.0
django-sekizai==0.7
djangocms-admin-style==0.2.2
djangocms-installer==0.4.1
html5lib==0.999
six==1.6.1
wsgiref==0.1.2

(djvenv2)shan@shan:~/workspace/projects/djvenv$ djangocms -p . my_demo
Database configuration (in URL format) [default sqlite://localhost/project.db]:
django CMS version (choices: 2.4, 3.0, stable, develop) [default stable]:
Django version (choices: 1.4, 1.5, 1.6, stable) [default 1.5]:
Activate Django I18N / L10N setting (choices: yes, no) [default yes]:
Install and configure reversion support (choices: yes, no) [default yes]:
Languages to enable. Option can be provided multiple times, or as a comma separated list: en
Optional default time zone [default America/Chicago]:
Activate Django timezone support (choices: yes, no) [default yes]:
Activate CMS permission management (choices: yes, no) [default yes]:
Use Twitter Bootstrap Theme (choices: yes, no) [default no]: yes
Load a starting page with examples after installation (choices: yes, no) [default no]: yes
INFO: Starting new HTTPS connection (1): pypi.python.org
Traceback (most recent call last):
  File "/home/shan/workspace/venv/djvenv2/bin/djangocms", line 9, in <module>
    load_entry_point('djangocms-installer==0.4.1', 'console_scripts', 'djangocms')()
  File "/home/shan/workspace/venv/djvenv2/local/lib/python2.7/site-packages/djangocms_installer/main.py", line 24, in execute
    install.check_install(config_data)
  File "/home/shan/workspace/venv/djvenv2/local/lib/python2.7/site-packages/djangocms_installer/install/__init__.py", line 52, in check_install
    raise EnvironmentError("\n".join(errors))
EnvironmentError: Pillow is not compiled with JPEG support, see 'Libraries installation issues' documentation section.
Was it helpful?

Solution

Add JPEG support to Pillow, in Ubuntu you can do the following:

sudo apt-get install libjpeg-dev libfreetype6-dev zlib1g-dev

# Link the libraries for Pillow to find them:

sudo ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/
sudo ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/
sudo ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/

# reinstall Pillow (In case you have Pillow already installed)
pip install --upgrade --force-reinstall pillow

OTHER TIPS

Install the required libs:

http://pillow.readthedocs.org/en/latest/installation.html#linux-installation

Then uninstall and reinstall Pillow in your virtualenv

pip uninstall Pillow
pip install --no-cache-dir Pillow

I actually found the chosen solution here to be great help. I also found that the djangcms installer wants a specific version of Pillow, which results in it not picking up the JPEG module for whatever reason. At the time of this writing, it wanted Pillow==2.8.0 but the latest version that pip --upgrade was installing was 2.9.x. I ran pip install --no-cache-dir --upgrade --force-reinstall pillow==2.8.0 and that seemed to satisfy the djangocms installer's requirement such that it would retain JPEG compatibility.

You can verify that JPEG support is installed by opening a python shell in the virtualenv.

from PIL import Image

i = Image.open('/path/to/a.jpg')
i.load()

You'll either get a handle to the loaded image or an exception if there's no JPEG support.

So pip was succesfully installing a Pillow package with JPEG support, but as soon as I ran the djangocms installer, it was replacing it with a Pillow package without JPEG support. You need to match the version of Pillow that djangocms installer wants. I don't know where that config is, but you can figure it out with pip freeze or pip list after a failed install.

Hopefully this helps someone.

I faced the same issue under my BitNami LAMP Virtual Machine and can not solved it from linking the missing files for Pillow. Finally, I solved it:

first, find the lib

(venv)...$ find 2>/dev/null / -name libz.so
/opt/bitnami/common/lib/libz.so

now add the lib directory into pip

(venv)...$ pip install --global-option=build_ext --global-option="-L/opt/bitnami/common/lib" --global-option="-I/opt/bitnami/common/include" --upgrade --force-reinstall pillow

it works:

--------------------------------------------------------------------
PIL SETUP SUMMARY
--------------------------------------------------------------------
version      Pillow 2.7.0
platform     linux2 2.7.6 (default, Mar 22 2014, 22:59:56)
             [GCC 4.8.2]
--------------------------------------------------------------------
*** TKINTER support not available
--- JPEG support available
*** OPENJPEG (JPEG2000) support not available
--- ZLIB (PNG/ZIP) support available
--- LIBTIFF support available
--- FREETYPE2 support available
*** LITTLECMS2 support not available
*** WEBP support not available
*** WEBPMUX support not available
--------------------------------------------------------------------

also see python pip specify a library directory and an include directory

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top