[PYTHON] What to do when you get angry that libxml / xmlversion.h does not exist when you put lxml with pip

There is there

I need lxml to use scrapy, but I can't install lxml. .. ..

Common solutions on the net

brew install libxml2 libxslt

It is OK if you install the necessary programs in. For Mac

xcode-select --install

Most of the time it's OK. However, I get a message that the program is no longer provided and the above command cannot be executed. So we need another solution.

In my case, the version of libxml2 that I put in * brew was different from the version of libxml that was specified in / usr / local / bin / xslt-config. * (Maybe this was the direct cause, or it was messed up by messing around) You can find out where you are referring to during pip install by looking at ~ / .pip / pip.log.


The following two measures can be considered.

  1. Modify the version specification of libxml2 installed by brew referenced in / usr / local / bin / xslt-config

  2. Uninstall once with brew remove libxml2, and install libxml2 according to the version in / usr / local / bin / xslt-config.

Regarding 1, the installation of lxml itself was successful, but is it due to the dependency with other programs? I couldn't execute the startproject command with scrapy, and I got the following error.

ImportError: dlopen(/Users/username/.virtualenvs/testenv/lib/python2.7/site-packages/lxml/etree.so, 2): Library not loaded: /usr/local/opt/libxml2/lib/libxml2.2.dylib
  Referenced from: /usr/local/opt/libxslt/lib/libxslt.1.dylib
  Reason: Incompatible library version: libxslt.1.dylib requires version 12.0.0 or later, but libxml2.2.dylib provides version 11.0.0

The second solution worked! !!

Recommended Posts

What to do when you get angry that libxml / xmlversion.h does not exist when you put lxml with pip
What to do if you get angry if you don't have libxml / xmlversion.h when installing lxml on CentOS
What to do if you get Could not fetch URL 443 with pip
What to do if you get angry with swapon failed: Operation not permitted
[AWS] What to do when you want to pip with Lambda
What to do if you get an Undefined error when trying to use pip with pyenv
What to do if you get an error when installing python with pyenv
What to do if sys / cdefs.h does not exist
What to do if you get an OpenSSL error when installing Python 2 with pyenv
What to do if you can't install pyaudio with pip #Python
What to do when you get "I can't see the site !!!!"
[Beginner] What to do when "[Errno 2] File b'test.csv' does not exist: b'test.csv" is displayed when reading pandas csv
What to do if you get lost in file reference with FileNotFoundError
What to do if you get angry in TensorFlow v2 without attribute'app'
What to do if pyenv install does not proceed with an error
What to do if you get a TypeError with numpy min, max
What to do if you get an error when trying to load mnist
What to do if you can't install with pip in babun environment
Notes on what to do when matplotlib scatter () / scatter3d () does not work
What to do if you get an error when installing Dlib (Ubuntu)
What to do if you get "The session could not be opened" when installing CentOS on VirtualBox
What to do if you get a "Wrong Python Platform" warning when using Python with the NetBeans IDE
What to do if you get angry with "Value Error: unknown local: UTF-8" in python manage.py syncdb
Example of what to do when the sample script does not work (OpenCV-Python)
[python] [vscode] When you get angry with space-tab-mixed
What to do if you get "Python not configured." Using PyDev in Eclipse
What to do when the graph does not appear in jupyter (ipython) notebook
[EC2] What to do when selenium is stuck and processing does not proceed
What to do when python3 type venv does not work well on Raspberry Pi
What to do if you get an error when importing matplotlib in Python (Mac)
What I did when I was angry to put it in with the enable-shared option
What to do when Python starts up in Anaconda does not come out unexpectedly
What to do if you get the error ʻERR_FEATURE_UNAVAILABLE_ON_PLATFORM` when using ts-node-dev on Linux
How to deal with Django's Template Does Not Exist
Links to do what you want with Sublime Text
Things to do when you start developing with Django
What to do when you can't bind CaboCha to Python
What to do when a Missing artifact occurs in a jar that is not defined in pom.xml
What to do if you get an error when running "certbot renew" in CakePHP environment
What to do when Japanese is not displayed on matplotlib
Move what you installed with pip to the conda environment
What to do if you get "coverage unknown" in Coveralls
What to do if you can't sort files with subscripts
What to do when an error occurs with import _ssl
EC2 / Amazon Linux2: What to do if you get an "unable to execute'gcc': No such file or directory" error with pip install
What to do if you get angry with "Gtk * backend requires pygtke to be installed" even though pygtk is included in matplotlib
What to do if you get angry with'vertices' must be a 2D list ... in matplotlib arrow
When I tried to use pip with python, I was told that XML_SetHashSalt could not be found.
What to do if you get a must override `get_config` error when trying to model.save in Keras
When incrementing the value of a key that does not exist
What to do if you get a minus zero in Python
When it is troublesome to copy what you built with vue
[Beanstalk] What to do when an error occurs with import uuid
I get an error when trying to install maec 4.0.1.0 with pip
What to do when the jupyterlab extension settings are not reflected
What to do if you can't build your project with Maven
What to do if you get a Permission denied (public key) error when trying to pull on Github
[Python] What to do if you get a ModuleNotFoundError when importing pandas using Jupyter Notebook in Anaconda
What to do if you get the error RuntimeError: Python is not installed as a framework when trying to use matplitlib and pylab in Python 3.3
What to do when Ubuntu crashes
What to do with PYTHON release?