(Still) Cannot Properly Install Lxml 2.3 for Python, But at Least 2.2.8 Works

(still) cannot properly install lxml 2.3 for python, but at least 2.2.8 works

Your libxslt do not have exsltMathXpathCtxtRegister remove it, and manually install a newer version (1.1.26 should work fine).

An older version of lxml may work too, try with easy_install lxml==2.2.8

Problems installing lxml on M1 mac

It turned out that installing lxml with a simple pip install was working fine.

The reason for my malloc error was the fact that I was trying to clear the element before the end tag had been seen. Turns out this isn't possible and you need to wait for the end tag even if you already know you aren't interested in the element.

Installing easy_install... to get to installing lxml

First off we don't use easy_install anymore. We use pip. Please use pip instead.

To get to your particular troubles, as the comments point out, you're missing GCC. On OS X, Xcode Command Line Tools provides GCC, as well as many other programs necessary for building software on OS X. For OS X 10.9 (Mavericks) and newer, either install Xcode through the App Store, or alternatively, install only the Xcode Command Line Tools with

xcode-select --install

For more details, please see the Apple Developer FAQ or search the web for "install Xcode Command Line Tools".

For older versions of OS X, you can get Xcode Command Line Tools from the downloads page of the Apple Developer website (free registration required).

Once you have GCC installed, you may still encounter errors during compilation if the C/C++ library dependencies are not installed on your system. On OS X, the Homebrew project is the easiest way to install and manage such dependencies. Follow the instructions on the Homebrew website to install Homebrew on your system, then issue

brew update
brew install libxml2 libxslt

Possibly causing further trouble in your case, you placed the downloaded setuptools in /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/. Please do not download any files to this location. Instead, I suggest you download the file to your home directory, or your usual Downloads directory. After downloading it, you're supposed to run sh setuptools-X.Y.Z.egg, which will then install it properly into the appropriate site-packages and put the executable easy_install on your path.

Installing easy_install... to get to installing lxml

First off we don't use easy_install anymore. We use pip. Please use pip instead.

To get to your particular troubles, as the comments point out, you're missing GCC. On OS X, Xcode Command Line Tools provides GCC, as well as many other programs necessary for building software on OS X. For OS X 10.9 (Mavericks) and newer, either install Xcode through the App Store, or alternatively, install only the Xcode Command Line Tools with

xcode-select --install

For more details, please see the Apple Developer FAQ or search the web for "install Xcode Command Line Tools".

For older versions of OS X, you can get Xcode Command Line Tools from the downloads page of the Apple Developer website (free registration required).

Once you have GCC installed, you may still encounter errors during compilation if the C/C++ library dependencies are not installed on your system. On OS X, the Homebrew project is the easiest way to install and manage such dependencies. Follow the instructions on the Homebrew website to install Homebrew on your system, then issue

brew update
brew install libxml2 libxslt

Possibly causing further trouble in your case, you placed the downloaded setuptools in /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/. Please do not download any files to this location. Instead, I suggest you download the file to your home directory, or your usual Downloads directory. After downloading it, you're supposed to run sh setuptools-X.Y.Z.egg, which will then install it properly into the appropriate site-packages and put the executable easy_install on your path.

import lxml fails on OSX after (seemingly) successful install

You've installed a newer version of Python (2.7.2) but you also need to install and use a copy of easy_install (from Distribute or setuptools) to use with it. You ended up using the default Apple-supplied version of easy_install associated with the Apple-supplied Python 2.6. Note the /Library/Python/2.6 in the easy_install output. (You can verify that by trying to import lxml when using /usr/bin/python2.6.) After you install easy_install using your Python 2.7, the new easy_install should be first on your shell path if you used the standard python.org installer defaults. If not, update your PATH:

export PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"

Then easy_install lxmlusing it. With the python.org 2.7.2, you shouldn't need to add the ARCHFLAGS environment variable but it doesn't hurt.

How to install lxml when something went wrong in gcc and libxml2

You need to install the development library, most likely called libxml2-dev or libxml2-devel in order to compile against the required header (.h) files.



Related Topics



Leave a reply



Submit