Pypy 3.2 Pillow problem

I am on Ubuntu 14.04 server.

I am trying to use pypy 3.2 to run a django app.

But whenever I try pypy3 manage.py runningerver 0: 8000 it says: (fields.E210) ImageField cannot be used because Pillow is not installed. TIP: Get a pillow at https://pypi.python.org/pypi/Pillow or run the "pip install Pillow" command.

But if I try to install Pillow: pypy3 -m pip install Pillow

It says: Requirement has already been updated: Pillow at / usr / local / lib / python 3.4 / dist-packages / Pillow-2.9.0-py3.4-linux-x86_64.egg

Then I downloaded the source and tried: Installing pypy3 setup.py

And it says: Install_layout attribute error

I do not know what to do!!

_ <

+3


source to share


1 answer


You have to create the correct virtualenv with pypy3, since your interpreter will run your django installation - inside the virtualenv, pip should just work for both django and Pillow - without weird maneuvers like those pypy3 -m pip

that are prone to breakout like you there is.

To create a virtualenv inside which the default Python interpreter is pypy3, just execute virtualenv -p pypy3 myprojectdir

- and activate it with source myprojectdir/bin/activate

- for lazy types there is virtualenv wrapper

, which creates even more shortcuts. From there, pip install

everything will install thins in this directory without inserting (or checking) system packages from any other Python.

It's a way to have a sane environment - however, it seems like you're just trying to go beyond what's available now - there are references on the internet that Pillow is compatible with Pypy (and of course python3) - but I couldn't find not a single mention of Pillow working with pypy3.



I can get it to build without error by installing it pypy3-devel

on my Linux system and manually setting the CFLAGS variable - (I'm using Fedora here - on Ubunut you should have the package pypy3-dev

). But even though it works, it doesn't work in 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, install CFLAGS=-I/usr/lib64/pypy3-2.4.0/include/

check your package pypy3-dev

to see where those files include Ubuntu).

TL; DR . Or use pypy2.x or regular cPython3.4 (of course this is preferable) for your project - one of these days the dependencies will be catching up. Django shouldn't benefit much from the Pypy JIT anyway - for a heavily loaded web server, you'll have to deal with the scalability of the database connection (not Python) and good caching (which can also be configured properly on layers above Python) - take a look to "varnish" "). If you have this kind of query processing that your site uses to use Pypy, consider running the bottleneck algorithms in another process using celery / RPC, and write that piece of code to work with Pypy / Cython / pure C.

+2


source







All Articles