Error installing LXML in Virtual Environment on Pi

Trying to setup laml in my HA virtual environment. I get these errors:
I tried stopping HA service but still see the virtual memory exhausted error.
If I then try running HA and have the FritzBox Net Monitor settings, HA won’t start.
Errors:

(homeassistant_venv) homeassistant@raspberrypi:/home/pi$ pip install lxml
Collecting lxml
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by ‘ReadTimeoutError(“HTTPSConnectionPool(host=‘www.piwheels.hostedpi.com’, port=443): Read timed out. (read timeout=15)”,)’: /simple/lxml/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by ‘ReadTimeoutError(“HTTPSConnectionPool(host=‘www.piwheels.hostedpi.com’, port=443): Read timed out. (read timeout=15)”,)’: /simple/lxml/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by ‘ReadTimeoutError(“HTTPSConnectionPool(host=‘www.piwheels.hostedpi.com’, port=443): Read timed out. (read timeout=15)”,)’: /simple/lxml/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by ‘ReadTimeoutError(“HTTPSConnectionPool(host=‘www.piwheels.hostedpi.com’, port=443): Read timed out. (read timeout=15)”,)’: /simple/lxml/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by ‘ReadTimeoutError(“HTTPSConnectionPool(host=‘www.piwheels.hostedpi.com’, port=443): Read timed out. (read timeout=15)”,)’: /simple/lxml/
Using cached lxml-4.1.1.tar.gz
Building wheels for collected packages: lxml
Running setup.py bdist_wheel for lxml … error
Complete output from command /srv/homeassistant/homeassistant_venv/bin/python3 -u -c “import setuptools, tokenize;file=’/tmp/pip-build-ycuoz5cf/lxml/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” bdist_wheel -d /tmp/tmp_wla53sypip-wheel- --python-tag cp35:
Building lxml version 4.1.1.
Building without Cython.
Using build configuration of libxslt 1.1.29
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-armv6l-3.5
creating build/lib.linux-armv6l-3.5/lxml
copying src/lxml/doctestcompare.py -> build/lib.linux-armv6l-3.5/lxml
copying src/lxml/_elementpath.py -> build/lib.linux-armv6l-3.5/lxml
copying src/lxml/cssselect.py -> build/lib.linux-armv6l-3.5/lxml
copying src/lxml/init.py -> build/lib.linux-armv6l-3.5/lxml
copying src/lxml/builder.py -> build/lib.linux-armv6l-3.5/lxml
copying src/lxml/usedoctest.py -> build/lib.linux-armv6l-3.5/lxml
copying src/lxml/pyclasslookup.py -> build/lib.linux-armv6l-3.5/lxml
copying src/lxml/sax.py -> build/lib.linux-armv6l-3.5/lxml
copying src/lxml/ElementInclude.py -> build/lib.linux-armv6l-3.5/lxml
creating build/lib.linux-armv6l-3.5/lxml/includes
copying src/lxml/includes/init.py -> build/lib.linux-armv6l-3.5/lxml/includes
creating build/lib.linux-armv6l-3.5/lxml/html
copying src/lxml/html/diff.py -> build/lib.linux-armv6l-3.5/lxml/html
copying src/lxml/html/init.py -> build/lib.linux-armv6l-3.5/lxml/html
copying src/lxml/html/soupparser.py -> build/lib.linux-armv6l-3.5/lxml/html
copying src/lxml/html/formfill.py -> build/lib.linux-armv6l-3.5/lxml/html
copying src/lxml/html/_html5builder.py -> build/lib.linux-armv6l-3.5/lxml/html
copying src/lxml/html/_setmixin.py -> build/lib.linux-armv6l-3.5/lxml/html
copying src/lxml/html/_diffcommand.py -> build/lib.linux-armv6l-3.5/lxml/html
copying src/lxml/html/builder.py -> build/lib.linux-armv6l-3.5/lxml/html
copying src/lxml/html/usedoctest.py -> build/lib.linux-armv6l-3.5/lxml/html
copying src/lxml/html/html5parser.py -> build/lib.linux-armv6l-3.5/lxml/html
copying src/lxml/html/clean.py -> build/lib.linux-armv6l-3.5/lxml/html
copying src/lxml/html/defs.py -> build/lib.linux-armv6l-3.5/lxml/html
copying src/lxml/html/ElementSoup.py -> build/lib.linux-armv6l-3.5/lxml/html
creating build/lib.linux-armv6l-3.5/lxml/isoschematron
copying src/lxml/isoschematron/init.py -> build/lib.linux-armv6l-3.5/lxml/isoschematron
copying src/lxml/etree.h -> build/lib.linux-armv6l-3.5/lxml
copying src/lxml/etree_api.h -> build/lib.linux-armv6l-3.5/lxml
copying src/lxml/lxml.etree.h -> build/lib.linux-armv6l-3.5/lxml
copying src/lxml/lxml.etree_api.h -> build/lib.linux-armv6l-3.5/lxml
copying src/lxml/includes/relaxng.pxd -> build/lib.linux-armv6l-3.5/lxml/includes
copying src/lxml/includes/xslt.pxd -> build/lib.linux-armv6l-3.5/lxml/includes
copying src/lxml/includes/init.pxd -> build/lib.linux-armv6l-3.5/lxml/includes
copying src/lxml/includes/dtdvalid.pxd -> build/lib.linux-armv6l-3.5/lxml/includes
copying src/lxml/includes/config.pxd -> build/lib.linux-armv6l-3.5/lxml/includes
copying src/lxml/includes/tree.pxd -> build/lib.linux-armv6l-3.5/lxml/includes
copying src/lxml/includes/xmlparser.pxd -> build/lib.linux-armv6l-3.5/lxml/includes
copying src/lxml/includes/xmlschema.pxd -> build/lib.linux-armv6l-3.5/lxml/includes
copying src/lxml/includes/c14n.pxd -> build/lib.linux-armv6l-3.5/lxml/includes
copying src/lxml/includes/xinclude.pxd -> build/lib.linux-armv6l-3.5/lxml/includes
copying src/lxml/includes/etreepublic.pxd -> build/lib.linux-armv6l-3.5/lxml/includes
copying src/lxml/includes/xpath.pxd -> build/lib.linux-armv6l-3.5/lxml/includes
copying src/lxml/includes/htmlparser.pxd -> build/lib.linux-armv6l-3.5/lxml/includes
copying src/lxml/includes/uri.pxd -> build/lib.linux-armv6l-3.5/lxml/includes
copying src/lxml/includes/schematron.pxd -> build/lib.linux-armv6l-3.5/lxml/includes
copying src/lxml/includes/xmlerror.pxd -> build/lib.linux-armv6l-3.5/lxml/includes
copying src/lxml/includes/etree_defs.h -> build/lib.linux-armv6l-3.5/lxml/includes
copying src/lxml/includes/lxml-version.h -> build/lib.linux-armv6l-3.5/lxml/includes
creating build/lib.linux-armv6l-3.5/lxml/isoschematron/resources
creating build/lib.linux-armv6l-3.5/lxml/isoschematron/resources/rng
copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.linux-armv6l-3.5/lxml/isoschematron/resources/rng
creating build/lib.linux-armv6l-3.5/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.linux-armv6l-3.5/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.linux-armv6l-3.5/lxml/isoschematron/resources/xsl
creating build/lib.linux-armv6l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.linux-armv6l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.linux-armv6l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.linux-armv6l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.linux-armv6l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.linux-armv6l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.linux-armv6l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
running build_ext
building ‘lxml.etree’ extension
creating build/temp.linux-armv6l-3.5
creating build/temp.linux-armv6l-3.5/src
creating build/temp.linux-armv6l-3.5/src/lxml
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-RUbMX3/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DCYTHON_CLINE_IN_TRACEBACK=1 -I/usr/include/libxml2 -Isrc -Isrc/lxml/includes -I/usr/include/python3.5m -I/srv/homeassistant/homeassistant_venv/include/python3.5m -c src/lxml/etree.c -o build/temp.linux-armv6l-3.5/src/lxml/etree.o -w
virtual memory exhausted: Cannot allocate memory
Compile failed: command ‘arm-linux-gnueabihf-gcc’ failed with exit status 1
creating tmp
cc -I/usr/include/libxml2 -I/usr/include/libxml2 -c /tmp/xmlXPathInitdutagvz0.c -o tmp/xmlXPathInitdutagvz0.o
/tmp/xmlXPathInitdutagvz0.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
main (int argc, char **argv) {
^~~~
cc tmp/xmlXPathInitdutagvz0.o -lxml2 -o a.out
error: command ‘arm-linux-gnueabihf-gcc’ failed with exit status 1


Failed building wheel for lxml
Running setup.py clean for lxml
Failed to build lxml
Installing collected packages: lxml
Running setup.py install for lxml … /

Getting the same errors here when updating to 0.57
Looks like www.piwheels.hostedpi.com is offline.
Just ran a check and indeed te site is offline…

ah! yeah I saw that. I guess just wait till it’s up and try again…

Wheels is back online again… now I’m getting

  running build_ext
  building 'lxml.etree' extension
  creating build/temp.linux-armv6l-3.5
  creating build/temp.linux-armv6l-3.5/src
  creating build/temp.linux-armv6l-3.5/src/lxml
  arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-RUbMX3/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DCYTHON_CLINE_IN_TRACEBACK=1 -I/usr/include/libxml2 -Isrc -Isrc/lxml/includes -I/usr/include/python3.5m -I/srv/homeassistant/homeassistant_venv/include/python3.5m -c src/lxml/etree.c -o build/temp.linux-armv6l-3.5/src/lxml/etree.o -w
  virtual memory exhausted: Cannot allocate memory
  Compile failed: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
  creating tmp
  cc -I/usr/include/libxml2 -I/usr/include/libxml2 -c /tmp/xmlXPathInituckeye8n.c -o tmp/xmlXPathInituckeye8n.o
  /tmp/xmlXPathInituckeye8n.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
   main (int argc, char **argv) {
   ^~~~
  cc tmp/xmlXPathInituckeye8n.o -lxml2 -o a.out
  error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

 Command "/srv/homeassistant/homeassistant_venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-t_6q2jwr/lxml/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-4dtmu8a2-record/install-record.txt --single-version-externally-managed --compile --install-headers /srv/homeassistant/homeassistant_venv/include/site/python3.5/lxml" failed with error code 1 in /tmp/pip-build-t_6q2jwr/lxml/