I am using visual studio code to run a program in python. I wrote my program in python 3.7 and everything was fine. I tried to install jupyterlab but it needed a new version. So I switched to Python 3.11 (3.11.0 64-bit to be more precise).
When I run my code in the newer Python version it says:
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?
For line: soup = BeautifulSoup(page,features="lxml")
According to a 2018 topic here, where the user has the same problem, the most upvoted and accepted answer suggests to do two things. To add "html5lib"
and pip install html5lib
. I do the hypothesis that I need to do the same about lxml
.
That's why I run pip install lxml
. Now it returns:
error: subprocess-exited-with-error
× Running setup.py install for lxml did not run successfully.
│ exit code: 1
╰─> [96 lines of output]
Building lxml version 4.9.1.
Building without Cython.
Building against pre-built libxml2 andl libxslt libraries
running install
And a screenshot. And at the end again:
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> lxml
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
And a screenshot. In this Stackoverflow question they suggest to go back a version which sounds like a bad idea. And I do not know if the libraries I want to install will be available there. (In addition, there is no accepted answer and some answers even say to reinstall the entire OS?!)
Then I checked this question and I tried to install pip install C:\Users\@@@@@\Downloads\lxml-4.9.1-cp311-cp311-win_amd64.whl
. While everything is there as I downloaded them (screenshot of the folder), it returns an error:
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'C:\\Users\\@@@@@\\Downloads\\lxml-4.9.1-cp311-cp311-win_amd64.whl'
Information that may be needed:
- Windows 10
- Visual Studio Code Version 1.74.0
- Chosen Interpreter 3.11.0 https://prnt.sc/5N4w8srPSZ25