Reputation: 66
I'm on Ubuntu Server 14.04.
I'm trying to use pypy 3.2 to run a django application.
But whenever I try pypy3 manage.py runserver 0:8000, it says: (fields.E210) Cannot use ImageField because Pillow is not installed. HINT: Get Pillow at https://pypi.python.org/pypi/Pillow or run command "pip install Pillow".
But if I try to install Pillow: pypy3 -m pip install Pillow
It says: Requirement already up-to-date: Pillow in /usr/local/lib/python3.4/dist-packages/Pillow-2.9.0-py3.4-linux-x86_64.egg
Then I downloaded the source and tried: pypy3 setup.py install
And it says: Attribute error install_layout
I don't know what to do!!
_<
Upvotes: 3
Views: 971
Reputation: 110301
You should create a proper virtualenv with pypy3 as your interpreter t run your django install - inside the virtualenv, pip should just work for both django and Pillow - without strange maneuvers like pypy3 -m pip
which are subject to breakrage like teh one you've got.
To create a virtualenv inside which the default Python interpreter is pypy3 just do virtualenv -p pypy3 myprojectdir
- and activate it with source myprojectdir/bin/activate
- for the lazy types there is virtualenv wrapper
which creates even more shortcuts. From there on, pip install
anything will install thins in this directory, without messing (or checking) your system packages from any other Python.
That is the way to have a sane environment- however it seens you are just trying to be beyond the edge for what is available now - there are mentions on the internet of Pillow being compatible with Pypy (and, of course, with python3) - but I could not find a single mention about running Pillow with pypy3.
I can get it to build without errors, by installing the pypy3-devel
on my Linux system, and manually setting the CFLAGS variable - (I am using fedora here - on Ubunut you should have a pypy3-dev
package). But even though it does build, it does fail to run on pypy, raising ImportError: unable to load extension module 'PIL/_imaging.pypy3-24.so': PIL/_imaging.pypy3-24.so: undefined symbol: PyExc_SystemError
; (On fedora 22I set CFLAGS=-I/usr/lib64/pypy3-2.4.0/include/
check your pypy3-dev
package to see where do these include files are on Ubuntu).
TL;DR Either use pypy2.x or regular cPython3.4 (of course this is preferred) for your project - one of these days the dependencies will catch up. Either way Django should not benefit that much from Pypy's JIT - a heavily loaded webserver will have to deal with database connection scalability (not Python) and good caching (which can be properly configured on layers above Python as well - take a look at "varnish"). If you have that much processing on requests that your site is taking a hit for not using Pypy, consider run the bottleneck algorithms in another process using celery/RPCs - and write that part of the program to run with Pypy/Cython/pure C.
Upvotes: 3