After having the same problem at the instance of my Windows 2019 server, Python 3.8 and Anaconda, I downloaded the corresponding whl package, installed it with
pip install lxml - 4.6 .3 - cp38 - cp38 - win_amd64
The same working on python3.4, I have tried anycodings_python-3.x many things to troubleshoot as below but anycodings_python-3.x didn't success.,I am getting error while running "from lxml anycodings_python-3.x import tree" on python3.6,Just in case anybody has similar issue. anycodings_ubuntu-14.04 I also encountered this problem using anycodings_ubuntu-14.04 Python3.6. Just by uninstalling lxml and anycodings_ubuntu-14.04 installing it again with pip the issue anycodings_ubuntu-14.04 is resolved.,Turns out lxml wraps c libraries that anycodings_ubuntu-14.04 are compiled for a certain processor anycodings_ubuntu-14.04 architecture (I think)
I am getting error while running "from lxml anycodings_python-3.x import tree" on python3.6
>>> import lxml
>>> from lxml import etree
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'etree'
The same working on python3.4, I have tried anycodings_python-3.x many things to troubleshoot as below but anycodings_python-3.x didn't success.
python - m pip uninstall lxml python - m pip install lxml == 3.6 .0 pip install - t / usr / local / lib / python3 .6 / dist - packages lxml == 3.6 .0
After having the same problem at the anycodings_ubuntu-14.04 instance of my Windows 2019 server, anycodings_ubuntu-14.04 Python 3.8 and Anaconda, I downloaded anycodings_ubuntu-14.04 the corresponding whl package, installed anycodings_ubuntu-14.04 it with
pip install lxml - 4.6 .3 - cp38 - cp38 - win_amd64
If you have read these instructions and still cannot manage to install lxml, you can check the archives of the mailing list to see if your problem is known or otherwise send a mail to the list.,If you are not using pip in a virtualenv and want to install lxml globally instead, you have to run the above command as admin, e.g. on Linux:,If your system does not provide binary packages or you want to install a newer version, the best way is to get the pip package management tool (or use a virtualenv) and run the following:,On MacOS-X, use the following to build the source distribution, and make sure you have a working Internet connection, as this will download libxml2 and libxslt in order to build them:
Most Linux platforms come with some version of lxml readily packaged, usually named python-lxml for the Python 2.x version and python3-lxml for Python 3.x. If you can use that version, the quickest way to install lxml is to use the system package manager, e.g. apt-get on Debian/Ubuntu:
sudo apt - get install python3 - lxml
For MacOS-X, a macport of lxml is available. Try something like
sudo port install py27 - lxml
To install the required development packages of these dependencies on Linux systems, use your distribution specific installation tool, e.g. apt-get on Debian/Ubuntu:
sudo apt - get install libxml2 - dev libxslt - dev python - dev
For Debian based systems, it should be enough to install the known build dependencies of the provided lxml package, e.g.
sudo apt - get build - dep python3 - lxml
If your system does not provide binary packages or you want to install a newer version, the best way is to get the pip package management tool (or use a virtualenv) and run the following:
pip install lxml
If you are not using pip in a virtualenv and want to install lxml globally instead, you have to run the above command as admin, e.g. on Linux:
sudo pip install lxml
To install a specific version, either download the distribution manually and let pip install that, or pass the desired version to pip:
pip install lxml == 3.4 .2
On MacOS-X, use the following to build the source distribution, and make sure you have a working Internet connection, as this will download libxml2 and libxslt in order to build them:
STATIC_DEPS = true sudo pip install lxml
On MacOS-X, use the following to build the source distribution, and make sure you have a working Internet connection, as this will download libxml2 and libxslt in order to build them:
STATIC_DEPS = true sudo pip install lxml
To get a static build, either pass the --static-deps option to the setup.py script, or run pip with the STATIC_DEPS or STATICBUILD environment variable set to true, i.e.
STATIC_DEPS = true pip install lxml