I am currently facing the problem that I would like to install the “lxml” library offline on a Windows computer. With an internet connection, it can be done using the command:
py -m pip install lxml
I have Python version 3.12.4 and pip version 24.0.
I have downloaded the library from “https://pypi.org” and then tried to manually install it using the command:
py -m pip install --no-index --find-links=C:UsersuserDownloads lxml
However, I receive the following error message:
**Processing c:usersuserDownloadslxml-5.2.2.tar.gz
Installing build dependencies … error
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [3 lines of output]
Looking in links: c:UsersuserDownloads
ERROR: Could not find a version that satisfies the requirement Cython>=3.0.10 (from versions: none)
ERROR: No matching distribution found for Cython>=3.0.10
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.**
Accordingly, I tried to manually install the Cython package as well:
py -m pip install --no-index --find-links=C:UsersuserDownloads --no-build-isolation Cython
However, I encountered another error message during the installation:
**Looking in links: c:UsersuserDownloads
Processing c:usersuserDownloadscython-3.0.10.tar.gz
Preparing metadata (pyproject.toml) … done
Building wheels for collected packages: Cython
Building wheel for Cython (pyproject.toml) … error
error: subprocess-exited-with-error
× Building wheel for Cython (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [328 lines of output]
:118: DeprecationWarning: Use shutil.which instead of find_executable
Unable to find pgen, not compiling formal grammar.
running bdist_wheel
running build
running build_py
creating build
.
.
.
.
copying CythonUtilityTypeConversion.c -> buildlib.win-amd64-cpython-312CythonUtility
copying CythonUtilityUFuncs_C.c -> buildlib.win-amd64-cpython-312CythonUtility
copying CythonUtilityarrayarray.h -> buildlib.win-amd64-cpython-312CythonUtility
copying CythonUtilityCppSupport.cpp -> buildlib.win-amd64-cpython-312CythonUtility
running build_ext
Compiling C:UsersuserAppDataLocalTemppip-install-_9vhdr3wcython_c01e00aa60fa4b1eab8e6aa8e223c69dCythonCompilerParsing.py because it changed.
[1/1] Cythonizing C:UsersuserAppDataLocalTemppip-install-_9vhdr3wcython_c01e00aa60fa4b1eab8e6aa8e223c69dCythonCompilerParsing.py
building ‘Cython.Compiler.Parsing’ extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build Tools”: https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for Cython
Failed to build Cython
ERROR: Could not build wheels for Cython, which is required to install pyproject.toml-based projects
**
Can someone help me with this? I have already installed Microsoft Visual C++ 14.0, but it still doesn’t work. Is there perhaps another way to install the lxml library? I found the following documentation (https://lxml.de/4.1/installation.html), but it looks more like a Linux guide to me, and it raises new questions.
HolidayLea is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.