简体   繁体   中英

Cannot install lxml 3.3.3 on OSX 10.9 with buildout

Have seen numerous related posts but not had any luck getting this to work. Log shows:

We have no distributions for lxml that satisfies 'lxml'.
Getting distribution for 'lxml'.
Running easy_install:
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python" "-c" "from setuptools.command.easy_install import main; main()" "-mZUNxd" "/Users/brad/Development/python/eggs/tmpLpoVC3" "-q" "/var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/tmpZx0t7aget_dist/lxml-3.3.3.tar.gz"
path=/Users/brad/Development/python/eggs/setuptools-0.7.2-py2.7.egg

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
  warnings.warn(msg)
In file included from src/lxml/lxml.etree.c:346:
/var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/easy_install-XSC3pm/lxml-3.3.3/src/lxml/includes/etree_defs.h:9:10: fatal error: 'libxml/xmlversion.h' file not found
#include "libxml/xmlversion.h"
         ^
1 error generated.
error: Setup script exited with error: command '/usr/bin/clang' failed with exit status 1Building lxml version 3.3.3.
Building without Cython.
ERROR: /bin/sh: xslt-config: command not found

** make sure the development packages of libxml2 and libxslt are installed **

Using build configuration of libxslt 

An error occurred when trying to install lxml 3.3.3. Look above this message for any errors that were output by easy_install.
While:
  Installing pydev.
  Getting distribution for 'lxml'.
Error: Couldn't install: lxml 3.3.3

Tried answers from Cannot install Lxml on Mac os x 10.9 .

xcode-select --install worked initially until an XCode upgrade to 10.5. Then hasn't worked since (even after retrying this line). Now I always get Can't install the software because it is not currently available from the Software Update server

Tried this STATIC_DEPS=true pip install lxml . It installed with error:

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]

clang: note: this will be a hard error (cannot be downgraded to a warning) in the future

error: command 'cc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/pip_build_brad/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/pip-4lSNM3-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/pip_build_brad/lxml
Storing debug log for failure in /Users/brad/Library/Logs/pip.log

That log file ends with:

Cleaning up...
  Removing temporary dir /private/var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/pip_build_brad...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/pip_build_brad/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/pip-4lSNM3-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/pip_build_brad/lxml
Exception information:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg/pip/commands/install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg/pip/req.py", line 1435, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg/pip/req.py", line 706, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "/Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg/pip/util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/pip_build_brad/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/pip-4lSNM3-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/pip_build_brad/lxml

Creating the symlink ( https://stackoverflow.com/a/19549645/1399659 ) didn't help either.

Ideas appreciated, thanks

Ok, so coming back to this with fresh eyes, again, managed to resolve it.

The error clang: error: unknown argument: '-mno-fused-madd' during the pip install lxml above was the clincher. I'd spotted it and https://stackoverflow.com/a/22578811/1399659 , but couldn't get another python version to work. Had tried MacPorts and Homebrew.

Finally a tip from https://stackoverflow.com/a/17439319/1399659 led me to removing macport's lxml and the system-installed pip. Then installing HomeBrew's python over fresh (with occasional forced linking), let me use it's installed pip to run bog-standard pip install lxml

Now running Homebrew's python 2.7.6 and pip, which was used to install lxml 3.3.3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM