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
Related
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
I want to migrate my database from SQLite to MariaDB. Running Ubuntu 14.04, Django 1.10 and Python 3.5. Digital Ocean has a guide, but it silently assumes one is using Python 2.x, not 3.x. They use the default mySQL connector, MySQLdb. This does not work for python 3.x. According to Django docs, the preferred alternative is mysqlsclient:
pip install mysqlclient
But this gives:
Collecting mysqlclient
Using cached mysqlclient-1.3.9.tar.gz
Building wheels for collected packages: mysqlclient
Running setup.py bdist_wheel for mysqlclient ... error
Complete output from command /django/env/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-3_5btd8o/mysqlclient/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmp39x31avopip-wheel- --python-tag cp35:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.5
copying _mysql_exceptions.py -> build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.5/MySQLdb
creating build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-3.5
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,3,9,'final',1) -D__version__=1.3.9 -I/usr/include/mysql -I/usr/include/python3.5m -I/django/env/include/python3.5m -c _mysql.c -o build/temp.linux-x86_64-3.5/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g -DNDEBUG
_mysql.c:40:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command /django/env/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-3_5btd8o/mysqlclient/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-qfim2s5n-record/install-record.txt --single-version-externally-managed --compile --install-headers /django/env/include/site/python3.5/mysqlclient:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.5
copying _mysql_exceptions.py -> build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.5/MySQLdb
creating build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-3.5
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,3,9,'final',1) -D__version__=1.3.9 -I/usr/include/mysql -I/usr/include/python3.5m -I/django/env/include/python3.5m -c _mysql.c -o build/temp.linux-x86_64-3.5/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g -DNDEBUG
_mysql.c:40:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/django/env/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-3_5btd8o/mysqlclient/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-qfim2s5n-record/install-record.txt --single-version-externally-managed --compile --install-headers /django/env/include/site/python3.5/mysqlclient" failed with error code 1 in /tmp/pip-build-3_5btd8o/mysqlclient/
Not sure why it's partially duplicated.
According to this question, the solution to such x86_64-linux-gnu-gcc errors is to install:
sudo apt install libpq-dev python-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libffi-dev
which I did, but this made no difference.
Then I tried a bunch of other stuff, including:
sudo apt-get install libmysqlclient-dev python-dev
Which gave:
libmysqlclient-dev : Depends: libmysqlclient18 (= 5.5.52-0ubuntu0.14.04.1) but 5.5.52+maria-1~trusty is to be installed
E: Unable to correct problems, you have held broken packages.
I found an answer where it was said that aptitude is more useful than apt-get and that one can see a list of held packages with:
dpkg --get-selections | grep hold
But nothing is returned when running this. Trying aptitude gives:
(env) user#computer:/$ sudo aptitude install libmysqlclient-dev
The following NEW packages will be installed:
libmysqlclient-dev{b}
0 packages upgraded, 1 newly installed, 0 to remove and 179 not upgraded.
Need to get 0 B/866 kB of archives. After unpacking 5,604 kB will be used.
The following packages have unmet dependencies:
libmariadbclient-dev : Conflicts: libmysqlclient-dev but 5.5.52-0ubuntu0.14.04.1 is to be installed.
Conflicts: libmysqlclient15-dev which is a virtual package.
libmysqlclient-dev : Depends: libmysqlclient18 (= 5.5.52-0ubuntu0.14.04.1) but 5.5.52+maria-1~trusty is installed.
The following actions will resolve these dependencies:
Keep the following packages at their current version:
1) libmysqlclient-dev [Not Installed]
It looks like a conflict between mysql and mariaDB based packages. So I found:
pip install libmariadbclient-dev
Which installs fine, but the error is still there when trying to install mysqlclient.
How do I get MariaDB to work with Django 1.10 and Python 3.5?
I ran into the same issue while i was executing
pip install mysqlclient
Then i found out i had to install python3-dev packages, but they were resolving into python3.6 and i was using python3.4 in my virtualenv.
All i had to do was:
sudo apt-get install python3.4-dev
I have tried to get this to work, but I have had no success. I'm trying to install mysql-python by running :
pip install mysql-python
but I always get this error
clang: error: invalid version number in '-mmacosx-version-min=10.11'
error: command 'clang' failed with exit status 1
I have used homebrew to update all libraries and I have already installed mysql. I also made sure to have the latest pip, xcode and xcode command line tools.
I have searched for hours but I have not found a way get this package to build.
Please, if anyone has run into a similar situation, I would greatly appreciate a little bit of guidance.
Collecting mysql-python
Using cached MySQL-python-1.2.5.zip
Building wheels for collected packages: mysql-python
Running setup.py bdist_wheel for mysql-python ... error
Complete output from command /usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/qh/38cj02sj1fb83lfnsd4x3jm40000gn/T/pip-build-lCuswO/mysql-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /var/folders/qh/38cj02sj1fb83lfnsd4x3jm40000gn/T/tmpFVHSn1pip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.11-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.11-x86_64-2.7
creating build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
creating build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.11-x86_64-2.7
clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/5.7.12/include/mysql -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.11-x86_64-2.7/_mysql.o -fno-omit-frame-pointer
clang: error: invalid version number in '-mmacosx-version-min=10.11'
error: command 'clang' failed with exit status 1
This might be because x-code is not installed
xcode-select --install
You should install MySQL through Homebrew first, to get python-mysql work properly on OS X.
pip uninstall MySQL-python
brew install mysql
brew install mysql-connector-c
pip install MySQL-python
Original answer : MySQL-python on mac
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"
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