Failed to install lxml using pip

This is the command I used to install lxml:

sudo pip install lxml 

And I got the following message during the cleanup phase:

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

After that I got:

 ImportError: No module named lxml 

Please, help. Thanks!

The following output is derived from pip.log:

 ---------------------------------------- Cleaning up... Removing temporary dir /private/tmp/pip_build_root... Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-rUFjFN-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/tmp/pip_build_root/lxml Exception information: Traceback (most recent call last): File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 122, in main status = self.run(options, args) File "/Library/Python/2.7/site-packages/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/req.py", line 1435, in install requirement.install(install_options, global_options, *args, **kwargs) File "/Library/Python/2.7/site-packages/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/util.py", line 697, in call_subprocess % (command_desc, proc.returncode, cwd)) InstallationError: Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-rUFjFN-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/tmp/pip_build_root/lxml 
+6
source share
3 answers

Just install these things:

 sudo apt-get install libxml2-dev libxslt-dev python-dev python-setuptools 

Then try again:

 pip install lxml 
+11
source

Here is a similar question.

Error installing Pillow (and PIL)

Do you use MacOS? Perhaps you can try updating the command line tools and try "brew". If not, you can try installing pip and easy_intall tools again and updating it.

https://pip.pypa.io/en/latest/installing.html

0
source

lxml has C depenedencies, often I run into problems when I miss libxslt or libxml2 . Are you sure that all dependencies on non-python are installed?

0
source

Source: https://habr.com/ru/post/976542/


All Articles