Fail to install requests-html in python virtual environment

Everything related to Installing and maintaining software.
Post Reply
mapsware
Posts: 46
Joined: Tue May 07, 2019 11:22 pm
Location: Hermosillo, Son. Mexico

Fail to install requests-html in python virtual environment

Post by mapsware »

Why pip is trying to build lxml and websockets?

In a fresh install of GhostBSD 24.04.2 I create the venv and try to install requests-html

Code: Select all

python -m venv vp3
source vp3/bin/activate.csh
pip install requests-html
This is the output

Code: Select all

Collecting requests-html
  Downloading requests_html-0.10.0-py3-none-any.whl.metadata (15 kB)
Collecting requests (from requests-html)
  Downloading requests-2.32.3-py3-none-any.whl.metadata (4.6 kB)
Collecting pyquery (from requests-html)
  Downloading pyquery-2.0.0-py3-none-any.whl.metadata (9.0 kB)
Collecting fake-useragent (from requests-html)
  Downloading fake_useragent-1.5.1-py3-none-any.whl.metadata (15 kB)
Collecting parse (from requests-html)
  Downloading parse-1.20.2-py2.py3-none-any.whl.metadata (22 kB)
Collecting bs4 (from requests-html)
  Downloading bs4-0.0.2-py2.py3-none-any.whl.metadata (411 bytes)
Collecting w3lib (from requests-html)
  Downloading w3lib-2.2.1-py3-none-any.whl.metadata (2.1 kB)
Collecting pyppeteer>=0.0.14 (from requests-html)
  Downloading pyppeteer-2.0.0-py3-none-any.whl.metadata (7.1 kB)
Collecting appdirs<2.0.0,>=1.4.3 (from pyppeteer>=0.0.14->requests-html)
  Downloading appdirs-1.4.4-py2.py3-none-any.whl.metadata (9.0 kB)
Collecting certifi>=2023 (from pyppeteer>=0.0.14->requests-html)
  Downloading certifi-2024.7.4-py3-none-any.whl.metadata (2.2 kB)
Collecting importlib-metadata>=1.4 (from pyppeteer>=0.0.14->requests-html)
  Downloading importlib_metadata-8.4.0-py3-none-any.whl.metadata (4.7 kB)
Collecting pyee<12.0.0,>=11.0.0 (from pyppeteer>=0.0.14->requests-html)
  Downloading pyee-11.1.0-py3-none-any.whl.metadata (2.8 kB)
Collecting tqdm<5.0.0,>=4.42.1 (from pyppeteer>=0.0.14->requests-html)
  Downloading tqdm-4.66.5-py3-none-any.whl.metadata (57 kB)
Collecting urllib3<2.0.0,>=1.25.8 (from pyppeteer>=0.0.14->requests-html)
  Downloading urllib3-1.26.19-py2.py3-none-any.whl.metadata (49 kB)
Collecting websockets<11.0,>=10.0 (from pyppeteer>=0.0.14->requests-html)
  Downloading websockets-10.4.tar.gz (84 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting beautifulsoup4 (from bs4->requests-html)
  Downloading beautifulsoup4-4.12.3-py3-none-any.whl.metadata (3.8 kB)
Collecting lxml>=2.1 (from pyquery->requests-html)
  Downloading lxml-5.3.0.tar.gz (3.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.7/3.7 MB 2.4 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting cssselect>=1.2.0 (from pyquery->requests-html)
  Downloading cssselect-1.2.0-py2.py3-none-any.whl.metadata (2.2 kB)
Collecting charset-normalizer<4,>=2 (from requests->requests-html)
  Downloading charset_normalizer-3.3.2-py3-none-any.whl.metadata (33 kB)
Collecting idna<4,>=2.5 (from requests->requests-html)
  Downloading idna-3.8-py3-none-any.whl.metadata (9.9 kB)
Collecting zipp>=0.5 (from importlib-metadata>=1.4->pyppeteer>=0.0.14->requests-html)
  Downloading zipp-3.20.1-py3-none-any.whl.metadata (3.7 kB)
Collecting typing-extensions (from pyee<12.0.0,>=11.0.0->pyppeteer>=0.0.14->requests-html)
  Downloading typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB)
Collecting soupsieve>1.2 (from beautifulsoup4->bs4->requests-html)
  Downloading soupsieve-2.6-py3-none-any.whl.metadata (4.6 kB)
Downloading requests_html-0.10.0-py3-none-any.whl (13 kB)
Downloading pyppeteer-2.0.0-py3-none-any.whl (82 kB)
Downloading bs4-0.0.2-py2.py3-none-any.whl (1.2 kB)
Downloading fake_useragent-1.5.1-py3-none-any.whl (17 kB)
Downloading parse-1.20.2-py2.py3-none-any.whl (20 kB)
Downloading pyquery-2.0.0-py3-none-any.whl (22 kB)
Downloading requests-2.32.3-py3-none-any.whl (64 kB)
Downloading w3lib-2.2.1-py3-none-any.whl (21 kB)
Downloading appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Downloading certifi-2024.7.4-py3-none-any.whl (162 kB)
Downloading charset_normalizer-3.3.2-py3-none-any.whl (48 kB)
Downloading cssselect-1.2.0-py2.py3-none-any.whl (18 kB)
Downloading idna-3.8-py3-none-any.whl (66 kB)
Downloading importlib_metadata-8.4.0-py3-none-any.whl (26 kB)
Downloading pyee-11.1.0-py3-none-any.whl (15 kB)
Downloading tqdm-4.66.5-py3-none-any.whl (78 kB)
Downloading urllib3-1.26.19-py2.py3-none-any.whl (143 kB)
Downloading beautifulsoup4-4.12.3-py3-none-any.whl (147 kB)
Downloading soupsieve-2.6-py3-none-any.whl (36 kB)
Downloading zipp-3.20.1-py3-none-any.whl (9.0 kB)
Downloading typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Building wheels for collected packages: lxml, websockets
  Building wheel for lxml (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for lxml (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [130 lines of output]
      <string>:67: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
      Building lxml version 5.3.0.
      Building without Cython.
      Building against libxml2 2.11.8 and libxslt 1.1.37
      Building against libxml2/libxslt in one of the following directories:
        /usr/local/lib
        /usr/lib
        /usr/lib
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.freebsd-14.0-STABLE-amd64-cpython-311
      creating build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/sax.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/pyclasslookup.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/__init__.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/usedoctest.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/ElementInclude.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/builder.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/doctestcompare.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/cssselect.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/_elementpath.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      creating build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/includes
      copying src/lxml/includes/__init__.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/includes
      creating build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/html
      copying src/lxml/html/_html5builder.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/html
      copying src/lxml/html/ElementSoup.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/html
      copying src/lxml/html/soupparser.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/html
      copying src/lxml/html/__init__.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/html
      copying src/lxml/html/builder.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/html
      copying src/lxml/html/clean.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/html
      copying src/lxml/html/_diffcommand.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/html
      copying src/lxml/html/_setmixin.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/html
      copying src/lxml/html/html5parser.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/html
      copying src/lxml/html/usedoctest.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/html
      copying src/lxml/html/defs.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/html
      copying src/lxml/html/formfill.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/html
      copying src/lxml/html/diff.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/html
      creating build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/isoschematron
      copying src/lxml/isoschematron/__init__.py -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/isoschematron
      copying src/lxml/etree.h -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/etree_api.h -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/lxml.etree.h -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/lxml.etree_api.h -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/objectify.pyx -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/etree.pyx -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/objectpath.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/xinclude.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/parser.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/readonlytree.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/xmlschema.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/debug.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/schematron.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/iterparse.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/xpath.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/nsclasses.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/xmlid.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/apihelpers.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/cleanup.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/docloader.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/classlookup.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/serializer.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/extensions.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/dtd.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/relaxng.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/xslt.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/saxparser.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/parsertarget.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/xsltext.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/proxy.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/xmlerror.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/public-api.pxi -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml
      copying src/lxml/includes/config.pxd -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/includes
      copying src/lxml/includes/dtdvalid.pxd -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/includes
      copying src/lxml/includes/uri.pxd -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/includes
      copying src/lxml/includes/c14n.pxd -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/includes
      copying src/lxml/includes/xpath.pxd -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/includes
      copying src/lxml/includes/relaxng.pxd -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/includes
      copying src/lxml/includes/htmlparser.pxd -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/includes
      copying src/lxml/includes/xmlerror.pxd -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/includes
      copying src/lxml/includes/tree.pxd -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/includes
      copying src/lxml/includes/xinclude.pxd -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/includes
      copying src/lxml/includes/__init__.pxd -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/includes
      copying src/lxml/includes/xmlschema.pxd -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/includes
      copying src/lxml/includes/xmlparser.pxd -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/includes
      copying src/lxml/includes/schematron.pxd -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/includes
      copying src/lxml/includes/xslt.pxd -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/includes
      copying src/lxml/includes/etreepublic.pxd -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/includes
      copying src/lxml/includes/lxml-version.h -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/includes
      copying src/lxml/includes/etree_defs.h -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/includes
      creating build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/isoschematron/resources
      creating build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/isoschematron/resources/rng
      copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/isoschematron/resources/rng
      creating build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/isoschematron/resources/xsl
      copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/isoschematron/resources/xsl
      copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/isoschematron/resources/xsl
      creating build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.freebsd-14.0-STABLE-amd64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      running build_ext
      building 'lxml.etree' extension
      creating build/temp.freebsd-14.0-STABLE-amd64-cpython-311
      creating build/temp.freebsd-14.0-STABLE-amd64-cpython-311/src
      creating build/temp.freebsd-14.0-STABLE-amd64-cpython-311/src/lxml
      cc -pthread -Wsign-compare -Wunreachable-code -DNDEBUG -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -I/usr/local/include/libxml2 -I/usr/local/include -Isrc -Isrc/lxml/includes -I/home/martin/vp3/include -I/usr/local/include/python3.11 -c src/lxml/etree.c -o build/temp.freebsd-14.0-STABLE-amd64-cpython-311/src/lxml/etree.o -w
      In file included from src/lxml/etree.c:105:
      /usr/local/include/python3.11/Python.h:23:12: fatal error: 'stdlib.h' file not found
         23 | #  include <stdlib.h>
            |            ^~~~~~~~~~
      1 error generated.
      Compile failed: command '/usr/bin/cc' failed with exit code 1
      creating tmp
      cc -I/usr/local/include/libxml2 -I/usr/local/include -I/usr/include/libxml2 -c /tmp/xmlXPathInitxmix59my.c -o tmp/xmlXPathInitxmix59my.o
      In file included from /tmp/xmlXPathInitxmix59my.c:1:
      In file included from /usr/local/include/libxml2/libxml/xpath.h:26:
      In file included from /usr/local/include/libxml2/libxml/xmlerror.h:10:
      In file included from /usr/local/include/libxml2/libxml/parser.h:14:
      /usr/local/include/libxml2/libxml/tree.h:15:10: fatal error: 'stdio.h' file not found
         15 | #include <stdio.h>
            |          ^~~~~~~~~
      1 error generated.
      *********************************************************************************
      Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
      *********************************************************************************
      error: command '/usr/bin/cc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for lxml
  Building wheel for websockets (pyproject.toml) ... done
  Created wheel for websockets: filename=websockets-10.4-cp311-cp311-freebsd_14_0_stable_amd64.whl size=95023 sha256=4c1c1bf2a1b8820d58f712c11a1cfcf366b8a1b6117df3e24af0e2dbb00400c8
  Stored in directory: /home/martin/.cache/pip/wheels/5a/08/c8/d1f79ad0357befb1a3eda801e722c607ffafc35ede9ac4903c
Successfully built websockets
Failed to build lxml
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (lxml)
User avatar
ericbsd
Developer
Posts: 2123
Joined: Mon Nov 19, 2012 7:54 pm

Re: Fail to install requests-html in python virtual environment

Post by ericbsd »

You might have to install all dev tools for this to work.

From https://ghostbsd-documentation-portal.r ... n-ghostbsd, you have to do sudo pkg install -g 'GhostBSD*-dev'
Post Reply