Search code examples
pythonlxmlpypy

how to install lxml with pypy in virtualenv


I am trying to use pypy in a virtualenv for better performance in running my python program. I was able to install all the required modules, except for lxml

So far, I tried

pip install lxml

Also tried

pip install --upgrade lxml

It shows the following message at the end:

Successfully installed lxml-3.4.4

However, when I start pypy prompt and try to import lxml, I get the error:

(venv)➜  pypy  pypy
Python 2.7.3 (2.2.1+dfsg-1ubuntu0.2, Dec 02 2014, 23:00:55)
[PyPy 2.2.1 with GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``denial is rarely a good debugging
technique''
>>>> import lxml
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named lxml
>>>> from lxml import html
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named lxml

Update:

I am using ubuntu 14.04

Also, I have tried

sudo apt-get install pypy-dev

Solution

  • I had a similar problem. I got it working by running sudo apt-get install python-dev libxml2 libxml2-dev libxslt-dev and then pip install --upgrade lxml