Problems installing lxml in Ubuntu - python

Getting the following errors when I do: pip install lxml
You are using pip version 6.0.8, however version 7.1.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting lxml
Using cached lxml-3.4.4.tar.gz
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.4.4.
Building without Cython.
ERROR: /bin/sh: 1: xslt-config: not found
** make sure the development packages of libxml2 and libxslt are installed **
Using build configuration of libxslt
Installing collected packages: lxml
Running setup.py install for lxml
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.4.4.
Building without Cython.
ERROR: /bin/sh: 1: xslt-config: not found
** make sure the development packages of libxml2 and libxslt are installed **
Using build configuration of libxslt
building 'lxml.etree' extension
i686-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-build-RLyvkw/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-i686-2.7/src/lxml/lxml.etree.o -w
In file included from src/lxml/lxml.etree.c:239:0:
/tmp/pip-build-RLyvkw/lxml/src/lxml/includes/etree_defs.h:14:31: fatal error: libxml/xmlversion.h: No such file or directory
#include "libxml/xmlversion.h"
^
compilation terminated.
error: command 'i686-linux-gnu-gcc' failed with exit status 1
Complete output from command /home/apurva/.virtualenvs/universallogin/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-RLyvkw/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-9WRQzF-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/apurva/.virtualenvs/universallogin/include/site/python2.7:
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.4.4.
Building without Cython.
ERROR: /bin/sh: 1: xslt-config: not found
** make sure the development packages of libxml2 and libxslt are installed **
Using build configuration of libxslt
running install
running build
running build_py
creating build
creating build/lib.linux-i686-2.7
creating build/lib.linux-i686-2.7/lxml
copying src/lxml/pyclasslookup.py -> build/lib.linux-i686-2.7/lxml
copying src/lxml/doctestcompare.py -> build/lib.linux-i686-2.7/lxml
copying src/lxml/sax.py -> build/lib.linux-i686-2.7/lxml
copying src/lxml/_elementpath.py -> build/lib.linux-i686-2.7/lxml
copying src/lxml/__init__.py -> build/lib.linux-i686-2.7/lxml
copying src/lxml/builder.py -> build/lib.linux-i686-2.7/lxml
copying src/lxml/ElementInclude.py -> build/lib.linux-i686-2.7/lxml
copying src/lxml/cssselect.py -> build/lib.linux-i686-2.7/lxml
copying src/lxml/usedoctest.py -> build/lib.linux-i686-2.7/lxml
creating build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/__init__.py -> build/lib.linux-i686-2.7/lxml/includes
creating build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/soupparser.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/html5parser.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/_setmixin.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/diff.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/formfill.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/_diffcommand.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/ElementSoup.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/__init__.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/builder.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/defs.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/_html5builder.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/usedoctest.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/clean.py -> build/lib.linux-i686-2.7/lxml/html
creating build/lib.linux-i686-2.7/lxml/isoschematron
copying src/lxml/isoschematron/__init__.py -> build/lib.linux-i686-2.7/lxml/isoschematron
copying src/lxml/lxml.etree.h -> build/lib.linux-i686-2.7/lxml
copying src/lxml/lxml.etree_api.h -> build/lib.linux-i686-2.7/lxml
copying src/lxml/includes/htmlparser.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/xinclude.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/c14n.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/xpath.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/etreepublic.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/schematron.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/xslt.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/tree.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/config.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/xmlschema.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/xmlerror.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/xmlparser.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/dtdvalid.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/uri.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/relaxng.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/etree_defs.h -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/lxml-version.h -> build/lib.linux-i686-2.7/lxml/includes
creating build/lib.linux-i686-2.7/lxml/isoschematron/resources
creating build/lib.linux-i686-2.7/lxml/isoschematron/resources/rng
copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.linux-i686-2.7/lxml/isoschematron/resources/rng
creating build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl
creating build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
running build_ext
building 'lxml.etree' extension
creating build/temp.linux-i686-2.7
creating build/temp.linux-i686-2.7/src
creating build/temp.linux-i686-2.7/src/lxml
i686-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-build-RLyvkw/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-i686-2.7/src/lxml/lxml.etree.o -w
In file included from src/lxml/lxml.etree.c:239:0:
/tmp/pip-build-RLyvkw/lxml/src/lxml/includes/etree_defs.h:14:31: fatal error: libxml/xmlversion.h: No such file or directory
#include "libxml/xmlversion.h"
^
compilation terminated.
error: command 'i686-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/home/apurva/.virtualenvs/universallogin/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-RLyvkw/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-9WRQzF-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/apurva/.virtualenvs/universallogin/include/site/python2.7" failed with error code 1 in /tmp/pip-build-RLyvkw/lxml
I've already tried this: sudo apt-get install zlib1g-dev
before "pip install" reading this answer: Not able to install lxml verison 3.3.5 in ubuntu
but did not help.
Also, tried installing python-dev, python3-dev, lib-eventdev did not help either.
Also, tried doing this: STATIC_DEPS=true pip install lxml
reading this: http://lxml.de/installation.html
Did not help either!
Will be very grateful if you could suggest something
Thanks in advance.

The output states ** make sure the development packages of libxml2 and libxslt are installed **. Have you done that?
sudo apt-get install libxml2-dev libxslt-dev
Also, is there a particular reason you're install using pip instead of installing the python-lxml package that comes with Ubuntu? Installing your distribution's package should be preferred unless you have a reason to do otherwise.

if you don't need a specific version from PyPI, you can always use the version packaged for Ubuntu.
$ sudo apt-get install python-lxml
... and then allow system site packages in your virtualenv.
update:
for clarification...
pip installs python packages from PyPI by default. However, many python packages are also packaged for Ubuntu and stored in the Ubuntu archives, You can install them via your system package manager (apt-get) instead of using pip. This can be helpful as the Ubuntu packages are compiled already, and will pull in any dependencies they need.
By default, virtualenv creates an isolated python enviornment, so you don't have access to system packages (that you installed using apt-get). However, you can allow system site packages in your virtualenv.
for example, let's install lxml from it's system package, create a virtualenv named "ENV" that allows access to system packages, and then import lxml to verify it works:
$ sudo apt-get install python-lxml
$ virtualenv --system-site-packages ENV
$ source ENV/bin/activate
(ENV)$ python -c "import xml"

Related

unable to install awscli using pip on dind 18.09.6-dind due to cython dependency

I saw a strange issue just most of yesterday where while running a simple jenkins build that uses pod template with container docker:18.09.6-dind (alpine linux) the build would fail while trying to install awscli using pip. Here is the sample code:-
apk add curl
apk add py-pip
pip install --user awscli
The error was :-
apk add py-pip
(1/11) Installing libbz2 (1.0.6-r7)
(2/11) Installing expat (2.2.8-r0)
(3/11) Installing libffi (3.2.1-r6)
(4/11) Installing gdbm (1.13-r1)
(5/11) Installing ncurses-terminfo-base (6.1_p20190518-r2)
(6/11) Installing ncurses-libs (6.1_p20190518-r2)
(7/11) Installing readline (8.0.0-r0)
(8/11) Installing sqlite-libs (3.28.0-r3)
(9/11) Installing python2 (2.7.18-r0)
(10/11) Installing py-setuptools (40.8.0-r1)
(11/11) Installing py2-pip (18.1-r0)
Executing busybox-1.30.1-r2.trigger
OK: 74 MiB in 54 packages
[Pipeline] withAwsCli
Executing sh script inside container dind of pod pod-custom-w741q
Executing command: "pip" "--version"
exit
pip 18.1 from /usr/lib/python2.7/site-packages/pip (python 2.7)
Executing sh script inside container dind of pod pod-custom-w741q
Executing command: "pip" "show" "awscli"
exit
ERROR: [withAwsCli] Command 'pip show awscli' returned the code 1
Executing sh script inside container dind of pod pod-custom-w741q
Executing command: "pip" "install" "--user" "awscli"
exit
Collecting awscli
Downloading https://files.pythonhosted.org/packages/d9/d3/1b76aa71fea8438f82a991ad94443d343836848f8b8c0dc413ed987745f8/awscli-1.19.51-py2.py3-none-any.whl (3.6MB)
Collecting botocore==1.20.51 (from awscli)
Downloading https://files.pythonhosted.org/packages/3c/1d/7a3741f17a10cc599bb3728351992b10094328ee07b8a129250ba2039642/botocore-1.20.51-py2.py3-none-any.whl (7.4MB)
Collecting colorama<0.4.4,>=0.2.5 (from awscli)
Downloading https://files.pythonhosted.org/packages/c9/dc/45cdef1b4d119eb96316b3117e6d5708a08029992b2fee2c143c7a0a5cc5/colorama-0.4.3-py2.py3-none-any.whl
Collecting PyYAML<5.5,>=3.10 (from awscli)
Downloading https://files.pythonhosted.org/packages/a0/a4/d63f2d7597e1a4b55aa3b4d6c5b029991d3b824b5bd331af8d4ab1ed687d/PyYAML-5.4.1.tar.gz (175kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'error'
Complete output from command /usr/bin/python2 -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-mT9r0n --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel Cython:
Collecting setuptools
Downloading https://files.pythonhosted.org/packages/e1/b7/182161210a13158cd3ccc41ee19aadef54496b74f2817cc147006ec932b4/setuptools-44.1.1-py2.py3-none-any.whl (583kB)
Collecting wheel
Downloading https://files.pythonhosted.org/packages/65/63/39d04c74222770ed1589c0eaba06c05891801219272420b40311cd60c880/wheel-0.36.2-py2.py3-none-any.whl
Collecting Cython
Downloading https://files.pythonhosted.org/packages/d9/cd/0d2d90b27219c07f68f1c25bcc7b02dd27639d2180add9d4b73e70945869/Cython-0.29.23.tar.gz (2.1MB)
Installing collected packages: setuptools, wheel, Cython
Running setup.py install for Cython: started
Running setup.py install for Cython: finished with status 'error'
Complete output from command /usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-72Od1r/Cython/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-Qfbz7l/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-mT9r0n --compile:
Unable to find pgen, not compiling formal grammar.
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying cython.py -> build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/Cython
copying Cython/TestUtils.py -> build/lib.linux-x86_64-2.7/Cython
copying Cython/Utils.py -> build/lib.linux-x86_64-2.7/Cython
copying Cython/CodeWriter.py -> build/lib.linux-x86_64-2.7/Cython
copying Cython/Debugging.py -> build/lib.linux-x86_64-2.7/Cython
copying Cython/StringIOTree.py -> build/lib.linux-x86_64-2.7/Cython
copying Cython/__init__.py -> build/lib.linux-x86_64-2.7/Cython
copying Cython/Coverage.py -> build/lib.linux-x86_64-2.7/Cython
copying Cython/Shadow.py -> build/lib.linux-x86_64-2.7/Cython
creating build/lib.linux-x86_64-2.7/Cython/Build
copying Cython/Build/Dependencies.py -> build/lib.linux-x86_64-2.7/Cython/Build
copying Cython/Build/__init__.py -> build/lib.linux-x86_64-2.7/Cython/Build
copying Cython/Build/Distutils.py -> build/lib.linux-x86_64-2.7/Cython/Build
copying Cython/Build/Inline.py -> build/lib.linux-x86_64-2.7/Cython/Build
copying Cython/Build/BuildExecutable.py -> build/lib.linux-x86_64-2.7/Cython/Build
copying Cython/Build/Cythonize.py -> build/lib.linux-x86_64-2.7/Cython/Build
copying Cython/Build/IpythonMagic.py -> build/lib.linux-x86_64-2.7/Cython/Build
creating build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/FlowControl.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/Code.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/MemoryView.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/Pipeline.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/AnalysedTreeTransforms.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/CythonScope.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/TypeSlots.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/Errors.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/FusedNode.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/PyrexTypes.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/AutoDocTransforms.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/UtilityCode.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/StringEncoding.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/Version.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/CmdLine.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/UtilNodes.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/ParseTreeTransforms.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/Visitor.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/TypeInference.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/__init__.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/Options.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/DebugFlags.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/Scanning.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/ExprNodes.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/Interpreter.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/Builtin.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/Annotate.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/Symtab.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/Optimize.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/Parsing.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/Naming.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/ModuleNode.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/TreeFragment.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/Nodes.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/Future.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/TreePath.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/Main.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/CodeGeneration.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/Buffer.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/Pythran.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
copying Cython/Compiler/Lexicon.py -> build/lib.linux-x86_64-2.7/Cython/Compiler
creating build/lib.linux-x86_64-2.7/Cython/Runtime
copying Cython/Runtime/__init__.py -> build/lib.linux-x86_64-2.7/Cython/Runtime
creating build/lib.linux-x86_64-2.7/Cython/Distutils
copying Cython/Distutils/old_build_ext.py -> build/lib.linux-x86_64-2.7/Cython/Distutils
copying Cython/Distutils/__init__.py -> build/lib.linux-x86_64-2.7/Cython/Distutils
copying Cython/Distutils/build_ext.py -> build/lib.linux-x86_64-2.7/Cython/Distutils
copying Cython/Distutils/extension.py -> build/lib.linux-x86_64-2.7/Cython/Distutils
creating build/lib.linux-x86_64-2.7/Cython/Debugger
copying Cython/Debugger/DebugWriter.py -> build/lib.linux-x86_64-2.7/Cython/Debugger
copying Cython/Debugger/libpython.py -> build/lib.linux-x86_64-2.7/Cython/Debugger
copying Cython/Debugger/__init__.py -> build/lib.linux-x86_64-2.7/Cython/Debugger
copying Cython/Debugger/Cygdb.py -> build/lib.linux-x86_64-2.7/Cython/Debugger
copying Cython/Debugger/libcython.py -> build/lib.linux-x86_64-2.7/Cython/Debugger
creating build/lib.linux-x86_64-2.7/Cython/Debugger/Tests
......................................
......................................
running build_ext
building 'Cython.Plex.Scanners' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/tmp
creating build/temp.linux-x86_64-2.7/tmp/pip-install-72Od1r
creating build/temp.linux-x86_64-2.7/tmp/pip-install-72Od1r/Cython
creating build/temp.linux-x86_64-2.7/tmp/pip-install-72Od1r/Cython/Cython
creating build/temp.linux-x86_64-2.7/tmp/pip-install-72Od1r/Cython/Cython/Plex
gcc -fno-strict-aliasing -Os -fomit-frame-pointer -g -DNDEBUG -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python2.7 -c /tmp/pip-install-72Od1r/Cython/Cython/Plex/Scanners.c -o build/temp.linux-x86_64-2.7/tmp/pip-install-72Od1r/Cython/Cython/Plex/Scanners.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-72Od1r/Cython/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-Qfbz7l/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-mT9r0n --compile" failed with error code 1 in /tmp/pip-install-72Od1r/Cython/
----------------------------------------
Command "/usr/bin/python2 -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-mT9r0n --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel Cython" failed with error code 1 in None
It always worked fine until yesterday and also works fine now on same dind OS. I have no clue why was it trying to set up dependency cython just yesterday. I see a new version of cython was released yesterday
https://pypi.org/search/?q=cython
Not sure if that played any role
I am not that familiar with how pip works when it tries to install something so would like to understand why it was looking for cython all of a sudden while its the same pip version 18.1 on that dind OS and trying to fetch latest awscli which happened to be released just yesterday 1.19.51 as per
https://github.com/aws/aws-cli/releases
Also yesterday same thing worked just fine all throughout on docker:18.06.1-ce-dind or other dind versions. So something specific to docker:18.09.6-dind and combination of pip 18.1 and awscli 1.19.51.
kindly help me figure out what could have been the issue here.
Found out the root cause which is
https://github.com/aws/aws-cli/issues/6096

python - can't install psycopg2 on centos 7

I'm trying to config Django on centos 7
According to this article Here
I installed
sudo yum install python-pip python-devel postgresql-server postgresql-devel postgresql-contrib gcc nginx
After setup PostgreSQL for Django like creating a database, ...
I try installing psycopg2 on virtualenv
pip install django gunicorn psycopg2
but I got this error,
Anyone can help me?
Collecting psycopg2
Using cached psycopg2-2.6.2.tar.gz
Installing collected packages: psycopg2
Running setup.py install for psycopg2 ... error
Complete output from command /usr/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-n0buiow5/psycopg2/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-jk1w8dv1-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.4
creating build/lib.linux-x86_64-3.4/psycopg2
copying lib/tz.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/pool.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/extras.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/extensions.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/_range.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/__init__.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/psycopg1.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/_json.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/errorcodes.py -> build/lib.linux-x86_64-3.4/psycopg2
creating build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_errcodes.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/dbapi20.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_bug_gc.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_async.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/testconfig.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_quote.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_extras_dictcursor.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_types_basic.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_transaction.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_cancel.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_dates.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_lobject.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/dbapi20_tpc.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_copy.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_types_extras.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_psycopg2_dbapi20.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_module.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/__init__.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_green.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/testutils.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_with.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_cursor.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_connection.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_notify.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_bugX000.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
Skipping optional fixer: buffer
Skipping optional fixer: idioms
Skipping optional fixer: set_literal
Skipping optional fixer: ws_comma
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.linux-x86_64-3.4
creating build/temp.linux-x86_64-3.4/psycopg
gcc -pthread -Wno-unused-result -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090212 -I/usr/include/python3.4m -I. -I/usr/include -I/usr/include/pgsql/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.4/psycopg/psycopgmodule.o -Wdeclaration-after-statement
In file included from psycopg/psycopgmodule.c:27:0:
./psycopg/psycopg.h:30:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-n0buiow5/psycopg2/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-jk1w8dv1-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-n0buiow5/psycopg2/
Tested with Python 3:
sudo yum groupinstall "Development Tools"
sudo yum install python3-devel
sudo yum install postgresql-libs
sudo yum install postgresql-devel
[sudo] pip install psycopg2
http://mirror.centos.org/centos/7/os/x86_64/Packages/
Test this
yum install python-psycopg2
You seem to be missing a
sudo yum install postgresql-libs
The installation of postgresql-libs does not help, it actually needs a valid postgresql client. Therefore installing the devel package for CentOS 7 solves it (if it's not an overkill for you).
yum install postgresql-devel
This started happening due to the fact that the pip package stopped shipping with postgresql client binaries, which makes sense since you might want to use a different version in certain scenarios.

lxml will never finish building on ubuntu

I am running ubuntu 14.04 LTS and python 2.7.5 on a vwmare.
When I run:
sudo pip install lxml
I get:
Collecting lxml
Using cached lxml-3.4.4.tar.gz
Building wheels for collected packages: lxml
Running setup.py bdist_wheel for lxml
which runs eternally.
I can't find any resources related to this, nor do I have any experience with similar errors.
Note, the solution below does not work:
sudo apt-get build-dep -y lxml;
pip install lxml
I have also tried:
sudo apt-get install -y build-essential python-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version.
python-dev is already the newest version.
The following packages were automatically installed and are no longer required:
linux-headers-3.13.0-32 linux-headers-3.13.0-32-generic
linux-headers-3.13.0-57 linux-headers-3.13.0-57-generic
linux-image-3.13.0-32-generic linux-image-3.13.0-57-generic
linux-image-extra-3.13.0-32-generic linux-image-extra-3.13.0-57-generic
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 75 not upgraded.
EDIT:
I just ran it again and got:
sudo pip install lxml
Collecting lxml
/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Using cached lxml-3.4.4.tar.gz
Building wheels for collected packages: lxml
Running setup.py bdist_wheel for lxml
EDIT 2:
pip install lxml
The directory '/home/myusername/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/myusername/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting lxml
/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading lxml-3.4.4.tar.gz (3.5MB)
100% |████████████████████████████████| 3.5MB 7.0kB/s
Installing collected packages: lxml
Running setup.py install for lxml
EDIT 3:
After waiting a long time the command gave:
pip install lxml
The directory '/home/mstaffel/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/mstaffel/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting lxml
/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading lxml-3.4.4.tar.gz (3.5MB)
100% |████████████████████████████████| 3.5MB 7.0kB/s
Installing collected packages: lxml
Running setup.py install for lxml
Complete output from command /usr/local/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-u3iJ67/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-0tAWPp-record/install-record.txt --single-version-externally-managed --compile:
/usr/local/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.4.4.
Building without Cython.
Using build configuration of libxslt 1.1.28
running install
running build
running build_py
creating build
creating build/lib.linux-i686-2.7
creating build/lib.linux-i686-2.7/lxml
copying src/lxml/pyclasslookup.py -> build/lib.linux-i686-2.7/lxml
copying src/lxml/cssselect.py -> build/lib.linux-i686-2.7/lxml
copying src/lxml/__init__.py -> build/lib.linux-i686-2.7/lxml
copying src/lxml/_elementpath.py -> build/lib.linux-i686-2.7/lxml
copying src/lxml/doctestcompare.py -> build/lib.linux-i686-2.7/lxml
copying src/lxml/builder.py -> build/lib.linux-i686-2.7/lxml
copying src/lxml/ElementInclude.py -> build/lib.linux-i686-2.7/lxml
copying src/lxml/usedoctest.py -> build/lib.linux-i686-2.7/lxml
copying src/lxml/sax.py -> build/lib.linux-i686-2.7/lxml
creating build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/__init__.py -> build/lib.linux-i686-2.7/lxml/includes
creating build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/__init__.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/_diffcommand.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/soupparser.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/builder.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/usedoctest.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/html5parser.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/_setmixin.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/_html5builder.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/defs.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/clean.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/ElementSoup.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/diff.py -> build/lib.linux-i686-2.7/lxml/html
copying src/lxml/html/formfill.py -> build/lib.linux-i686-2.7/lxml/html
creating build/lib.linux-i686-2.7/lxml/isoschematron
copying src/lxml/isoschematron/__init__.py -> build/lib.linux-i686-2.7/lxml/isoschematron
copying src/lxml/lxml.etree.h -> build/lib.linux-i686-2.7/lxml
copying src/lxml/lxml.etree_api.h -> build/lib.linux-i686-2.7/lxml
copying src/lxml/includes/htmlparser.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/tree.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/schematron.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/xmlparser.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/xinclude.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/c14n.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/xpath.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/xslt.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/xmlschema.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/xmlerror.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/uri.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/relaxng.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/etreepublic.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/config.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/dtdvalid.pxd -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/etree_defs.h -> build/lib.linux-i686-2.7/lxml/includes
copying src/lxml/includes/lxml-version.h -> build/lib.linux-i686-2.7/lxml/includes
creating build/lib.linux-i686-2.7/lxml/isoschematron/resources
creating build/lib.linux-i686-2.7/lxml/isoschematron/resources/rng
copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.linux-i686-2.7/lxml/isoschematron/resources/rng
creating build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl
creating build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
running build_ext
building 'lxml.etree' extension
creating build/temp.linux-i686-2.7
creating build/temp.linux-i686-2.7/src
creating build/temp.linux-i686-2.7/src/lxml
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/tmp/pip-build-u3iJ67/lxml/src/lxml/includes -I/usr/local/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-i686-2.7/src/lxml/lxml.etree.o -w
gcc -pthread -shared build/temp.linux-i686-2.7/src/lxml/lxml.etree.o -lxslt -lexslt -lxml2 -lz -lm -o build/lib.linux-i686-2.7/lxml/etree.so
building 'lxml.objectify' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/tmp/pip-build-u3iJ67/lxml/src/lxml/includes -I/usr/local/include/python2.7 -c src/lxml/lxml.objectify.c -o build/temp.linux-i686-2.7/src/lxml/lxml.objectify.o -w
gcc -pthread -shared build/temp.linux-i686-2.7/src/lxml/lxml.objectify.o -lxslt -lexslt -lxml2 -lz -lm -o build/lib.linux-i686-2.7/lxml/objectify.so
running install_lib
creating /usr/local/lib/python2.7/site-packages/lxml
error: could not create '/usr/local/lib/python2.7/site-packages/lxml': Permission denied
----------------------------------------
Command "/usr/local/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-u3iJ67/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-0tAWPp-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-u3iJ67/lxml
Note that if you run top in a separate terminal you'll notice that your system is busy building the lxml package:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1645 root 20 0 322224 305740 5384 R 100.0 29.8 3:27.47 /usr/lib/gcc/arm-linux-gnueabihf/5/cc1 -quiet -I /usr/include/libxml2 -I src/lxml/includes -I /usr/include/python2.7 -imultiarch arm-linux-gnueabihf -D_REENTRANT -D ...
If you're building on a VM or SBC with limited resources this can take a while...
I ran into the same problem when trying to "pip install" a package that depends on lxml on a Raspberry Pi 1 B+. After several hours (and several attempts), the SSH connection dropped without finishing the wheel build. It seems like an out-of-memory situation.
I opted on installing the pre-built binary packages using apt install python-lxml or apt install python3-lxml respectively.
I ran this on VM with 768MB ram (which i didn't notice was the value i set) and it took several hours and didn't finish.
Changing ram to 3GB made it finish in few minutes after restarting and trying again.
The newest version of pip, unnecessarily spends excessive amount of time to build wheels and resolve dependency issues while building a package with requirements.txt or a setuptools/distutils setup.py
A quick fix is to revert to a version of pip prior to 21.0 (ideally in a virtual environment), where the legacy resolver is still supported, according to this discussion: sunsetting legacy resolver
As of July 28th, 2021 pip v21.2.1 still seems to have the legacy resolver support.
pip install pip==20.2.4
Command below uses an earlier version of dependency resolver to install lxml.
pip install --use-deprecated=legacy-resolver lxml
Saved me a lot of time and hassle.
I think you should to install cython. As I can see in your code it is said that: Building without Cython. and if we go to pypi and look up for lxml it is said that Note that this requires Cython to build the sources, see the build instructions on the project home page. Here is the link: lxml

UnicodeDecodeError when installing python-igraph

I'm using python 2.7 on 64-bit Linux Mint 16 and I'm trying to install python-igraph. But when I run sudo pip install python-igraph I get the following log:
Downloading/unpacking python-igraph
Downloading python-igraph-0.7.1-1.tar.gz (375kB): 375kB downloaded
Running setup.py egg_info for package python-igraph
Installing collected packages: python-igraph
Running setup.py install for python-igraph
Build type: dynamic extension
Include path: /usr/include/igraph
Library path:
Linked dynamic libraries: igraph
Linked static libraries:
Extra compiler options:
Extra linker options:
building 'igraph._igraph' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/igraph -I../../build/include -I../../include -I/usr/local/include/igraph -I/usr/include/igraph -I/usr/include/python2.7 -c src/igraphmodule.c -o build/temp.linux-x86_64-2.7/src/igraphmodule.o
In file included from src/igraphmodule.c:30:0:
src/convert.h:65:59: error: unknown type name ‘igraph_pagerank_algo_t’
int igraphmodule_PyObject_to_pagerank_algo_t(PyObject *o, igraph_pagerank_algo_t *result);
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Complete output from command /usr/bin/python -c "import setuptools;__file__='/tmp/pip_build_root/python-igraph/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-akm3_O-record/install-record.txt --single-version-externally-managed:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/igraph
copying igraph/formula.py -> build/lib.linux-x86_64-2.7/igraph
copying igraph/__init__.py -> build/lib.linux-x86_64-2.7/igraph
copying igraph/configuration.py -> build/lib.linux-x86_64-2.7/igraph
copying igraph/summary.py -> build/lib.linux-x86_64-2.7/igraph
copying igraph/layout.py -> build/lib.linux-x86_64-2.7/igraph
copying igraph/cut.py -> build/lib.linux-x86_64-2.7/igraph
copying igraph/datatypes.py -> build/lib.linux-x86_64-2.7/igraph
copying igraph/utils.py -> build/lib.linux-x86_64-2.7/igraph
copying igraph/clustering.py -> build/lib.linux-x86_64-2.7/igraph
copying igraph/statistics.py -> build/lib.linux-x86_64-2.7/igraph
copying igraph/matching.py -> build/lib.linux-x86_64-2.7/igraph
copying igraph/compat.py -> build/lib.linux-x86_64-2.7/igraph
creating build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/operators.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/isomorphism.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/__init__.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/colortests.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/conversion.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/homepage.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/attributes.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/vertexseq.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/structural.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/separators.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/atlas.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/layouts.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/rng.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/games.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/utils.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/iterators.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/edgeseq.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/indexing.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/spectral.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/cliques.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/flow.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/basic.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/generators.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/matching.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/foreign.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/bipartite.py -> build/lib.linux-x86_64-2.7/igraph/test
copying igraph/test/decomposition.py -> build/lib.linux-x86_64-2.7/igraph/test
creating build/lib.linux-x86_64-2.7/igraph/app
copying igraph/app/__init__.py -> build/lib.linux-x86_64-2.7/igraph/app
copying igraph/app/shell.py -> build/lib.linux-x86_64-2.7/igraph/app
creating build/lib.linux-x86_64-2.7/igraph/drawing
copying igraph/drawing/__init__.py -> build/lib.linux-x86_64-2.7/igraph/drawing
copying igraph/drawing/edge.py -> build/lib.linux-x86_64-2.7/igraph/drawing
copying igraph/drawing/shapes.py -> build/lib.linux-x86_64-2.7/igraph/drawing
copying igraph/drawing/coord.py -> build/lib.linux-x86_64-2.7/igraph/drawing
copying igraph/drawing/metamagic.py -> build/lib.linux-x86_64-2.7/igraph/drawing
copying igraph/drawing/utils.py -> build/lib.linux-x86_64-2.7/igraph/drawing
copying igraph/drawing/text.py -> build/lib.linux-x86_64-2.7/igraph/drawing
copying igraph/drawing/graph.py -> build/lib.linux-x86_64-2.7/igraph/drawing
copying igraph/drawing/colors.py -> build/lib.linux-x86_64-2.7/igraph/drawing
copying igraph/drawing/vertex.py -> build/lib.linux-x86_64-2.7/igraph/drawing
copying igraph/drawing/baseclasses.py -> build/lib.linux-x86_64-2.7/igraph/drawing
creating build/lib.linux-x86_64-2.7/igraph/remote
copying igraph/remote/__init__.py -> build/lib.linux-x86_64-2.7/igraph/remote
copying igraph/remote/nexus.py -> build/lib.linux-x86_64-2.7/igraph/remote
copying igraph/remote/gephi.py -> build/lib.linux-x86_64-2.7/igraph/remote
creating build/lib.linux-x86_64-2.7/igraph/vendor
copying igraph/vendor/__init__.py -> build/lib.linux-x86_64-2.7/igraph/vendor
copying igraph/vendor/texttable.py -> build/lib.linux-x86_64-2.7/igraph/vendor
running build_ext
Build type: dynamic extension
Include path: /usr/include/igraph
Library path:
Linked dynamic libraries: igraph
Linked static libraries:
Extra compiler options:
Extra linker options:
building 'igraph._igraph' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/igraph -I../../build/include -I../../include -I/usr/local/include/igraph -I/usr/include/igraph -I/usr/include/python2.7 -c src/igraphmodule.c -o build/temp.linux-x86_64-2.7/src/igraphmodule.o
In file included from src/igraphmodule.c:30:0:
src/convert.h:65:59: error: unknown type name ‘igraph_pagerank_algo_t’
int igraphmodule_PyObject_to_pagerank_algo_t(PyObject *o, igraph_pagerank_algo_t *result);
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip_build_root/python-igraph/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-akm3_O-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip_build_root/python-igraph
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 148, in main
return command.main(args[1:], options)
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 169, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 50: ordinal not in range(128)
I previously installed libigraph0-dev. How can I install python-igraph in this case?
Does the version of libigraph0-dev match the version number of the Python interface? If the version of libigraph0-dev is not equal to 0.7.1, it will not be suitable for the version of python-igraph that you are trying to compile. In that case, it is better to remove libigraph0 and libigraph0-dev and run pip install python-igraph again; the setup script will then attempt to download and compile an appropriate version of the C core of igraph first.
I know that you have posted another question today in which you stated that pip install python-igraph (without having libigraph0-dev) does not work for you; try again anyway because the previous version of python-igraph had a bug that prevented it from downloading the right version of the C core, and I have fixed the bug just an hour ago.
download source code of igraph in C and install it using below code
./configure && make && sudo make install
then install python igraph using pip or from source

lxml installation error ubuntu 14.04 (internal compiler error)

I am having problems with installing lxml. I have tried the solutions of the relative questions in this site and other sites but could not fix the problem. Need some suggestions/solution on this.
I am providing the full log after executing pip install lxml,
Downloading/unpacking lxml
Downloading lxml-3.3.5.tar.gz (3.5MB): 3.5MB downloaded
Running setup.py (path:/tmp/pip_build_root/lxml/setup.py) egg_info for package lxml
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.3.5.
Building without Cython.
Using build configuration of libxslt 1.1.28
warning: no previously-included files found matching '*.py'
Installing collected packages: lxml
Running setup.py install for lxml
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.3.5.
Building without Cython.
Using build configuration of libxslt 1.1.28
building 'lxml.etree' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/tmp/pip_build_root/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w
x86_64-linux-gnu-gcc: internal compiler error: Killed (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 4
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/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-KUq9VD-record/install-record.txt --single-version-externally-managed --compile:
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.3.5.
Building without Cython.
Using build configuration of libxslt 1.1.28
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/lxml
copying src/lxml/pyclasslookup.py -> build/lib.linux-x86_64-2.7/lxml
copying src/lxml/doctestcompare.py -> build/lib.linux-x86_64-2.7/lxml
copying src/lxml/builder.py -> build/lib.linux-x86_64-2.7/lxml
copying src/lxml/cssselect.py -> build/lib.linux-x86_64-2.7/lxml
copying src/lxml/sax.py -> build/lib.linux-x86_64-2.7/lxml
copying src/lxml/_elementpath.py -> build/lib.linux-x86_64-2.7/lxml
copying src/lxml/ElementInclude.py -> build/lib.linux-x86_64-2.7/lxml
copying src/lxml/__init__.py -> build/lib.linux-x86_64-2.7/lxml
copying src/lxml/usedoctest.py -> build/lib.linux-x86_64-2.7/lxml
creating build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/__init__.py -> build/lib.linux-x86_64-2.7/lxml/includes
creating build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/html5parser.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/ElementSoup.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/builder.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/clean.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/_diffcommand.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/diff.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/_html5builder.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/_setmixin.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/defs.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/formfill.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/soupparser.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/__init__.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/usedoctest.py -> build/lib.linux-x86_64-2.7/lxml/html
creating build/lib.linux-x86_64-2.7/lxml/isoschematron
copying src/lxml/isoschematron/__init__.py -> build/lib.linux-x86_64-2.7/lxml/isoschematron
copying src/lxml/lxml.etree.h -> build/lib.linux-x86_64-2.7/lxml
copying src/lxml/lxml.etree_api.h -> build/lib.linux-x86_64-2.7/lxml
copying src/lxml/includes/config.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/xpath.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/tree.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/dtdvalid.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/xmlparser.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/etreepublic.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/xslt.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/schematron.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/uri.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/c14n.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/xinclude.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/xmlschema.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/xmlerror.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/relaxng.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/htmlparser.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/etree_defs.h -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/lxml-version.h -> build/lib.linux-x86_64-2.7/lxml/includes
creating build/lib.linux-x86_64-2.7/lxml/isoschematron/resources
creating build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/rng
copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/rng
creating build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl
creating build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
running build_ext
building 'lxml.etree' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
creating build/temp.linux-x86_64-2.7/src/lxml
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/tmp/pip_build_root/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w
x86_64-linux-gnu-gcc: internal compiler error: Killed (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 4
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/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-KUq9VD-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/lxml
Storing debug log for failure in /root/.pip/pip.log
Also, the pip.log file looks like this,
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1435, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 706, in install
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
File "/usr/lib/python2.7/dist-packages/pip/util.py", line 697, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command /usr/bin/python -c "import setuptools, tokenize;__file__='/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-KUq9VD-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/lxml
dmesg | tail command shows output like this,
[1744367.676147] Out of memory: Kill process 25518 (cc1) score 388 or sacrifice child
[1744367.676665] Killed process 25518 (cc1) total-vm:242352kB, anon-rss:200608kB, file-rss:0kB
It's seems like a memory issue. I am taking reference form this question
Possible solution (if you have no ability to increase memory on that machine) is to add swap file.
sudo dd if=/dev/zero of=/swapfile bs=1024 count=524288
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
from https://github.com/pydata/pandas/issues/1880#issuecomment-9920484
This worked for me on smallest digital ocean machine
In this particular case, it has nothing to do with dependencies, it's a memory problem.
I had this problem within a virtualbox VM. My solution was to increase memory allocated to the VM from the default 512Mb to 1024Mb.
Refer to https://stackoverflow.com/a/6504860/261718
Go install some dev packages before pip install lxml
apt-get install libxml2-dev libxslt1-dev python-dev
Using digitalocean smallest machine you can just turn off mysql and apache while compiling using
sudo service apache2 stop
sudo service mysql stop
and after installing lxml turn them on again using this commands with 'start' instead of 'stop'. Works pretty well for me without using swap file
If #Drake answer does not work for you try adding lib1g-dev.
$ sudo apt-get install -y libxml2-dev libxslt1-dev zlib1g-dev

Categories

Resources