I'm trying to install the pyquery module, which requires lxml. Whenever I try to install the lxml module, though, it gets exactly this far:

$ sudo python3.7 -m pip install lxml
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting lxml
  Downloading https://files.pythonhosted.org/packages/16/4a/b085a04d6dad79aa5c00c65c9b2bbcb2c6c22e5ac341e7968e0ad2c57e2f/lxml-4.3.0.tar.gz (2.5MB)
    100% |████████████████████████████████| 2.5MB 1.2MB/s 
Installing collected packages: lxml
  Running setup.py install for lxml ... /

...and then the / stops spinning. If I leave it running for more than about a minute, the Pi freezes.

Since I'm using a different version of Python 3 than comes installed on the pi, sudo apt-get install python3-lxml doesn't work either (unless there's a way to get this working that I don't know about). Is there any way to get around this?

  • For Arm there is no binary package for your version Python, so pip will (should) try to compile the package. You may have to wait a bit longer than a couple of minutes before giving up. Alternatively you could try python3-lxml from the Raspbian Buster repo. Search the web on how to install single packages from a different repo.
    – Dirk
    Jan 12 '19 at 18:27
  • I've been getting the same problem - @Dirk - it's not just a matter of waiting, it seems to be killing my pi altogether.
    – askvictor
    May 26 '19 at 5:43

The problem is that the swap file gets filled to 100% and then the Pi is frozen. If using a HDD you can increase the swap size to e.g. 1024. This works for me. Compilation occupies up to 170MB of swap on a Pi3.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.