I'm trying to install lxml, on an Ubuntu server running Python 2.6 (in a virtualenv - the system Python is 2.5).
I've checked out via svn and as a result I've also install Cython, as per the instructions.
However, I get the following error when running python setup.py build:
Building lxml version 2.3.alpha1-76211.
Building with Cython 0.11.
Using build configuration of libxslt 1.1.22
Building against libxml2/libxslt in the following directory: /usr/lib
running build
running build_py
running build_ext
cythoning src/lxml/lxml.etree.pyx to src/lxml/lxml.etree.c
Error converting Pyrex file to C:
------------------------------------------------------------
...
c_child = _findChildForwards(c_node, 0)
while c_child is not NULL:
if c_child.type == tree.XML_ELEMENT_NODE:
for i in range(c_tag_count):
if _tagMatchesExactly(c_child, c_ns_tags[2*i], c_ns_tags[2*i+1]):
c_next = _findChildForwards(c_child, 0) or _nextElement(c_child)
^
------------------------------------------------------------
/home/admin/web/blink/lxml/src/lxml/cleanup.pxi:246:64: Cannot assign type 'int' to 'xmlNode *'
Error converting Pyrex file to C:
building 'lxml.etree' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/home/admin/python/2.6.5/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.6/src/lxml/lxml.etree.o -w
src/lxml/lxml.etree.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
error: command 'gcc' failed with exit status 1
And very similar errors if i try python setup.py bdist_egg, python setup.py build_ext -i or make
Trying to install via easy_install or pip produces the same error - although the former just hangs indefinitely.
As far as I am aware, all of the various dependencies, such as python-dev are installed.
What am I missing / doing wrong?
"I've checked out via svn" ...
"Building lxml version 2.3.alpha1-76211" ...
You appear to be on the bleeding edge. Suggestions: Use a released version of the lxml source. Consult with the lxml author/maintainer.
Related
I'm running a relatively clean build of Ubuntu 21.04 and have come across some sort of dependency problem while trying to install the evdev package. I can install it using the version of python I get from apt:
python3/hirsute,now 3.9.4-1 amd64 [installed,automatic]
python3-dev/hirsute,now 3.9.4-1 amd64 [installed]
This version of python is in /usr/bin/python3 and /usr/bin/pip3 install evdev runs without error.
However, I prefer to use pyenv to manage python versions:
> python --version
Python 3.9.5
> pip --version
pip 22.2 from /home/denehoffman/.pyenv/versions/3.9.5/lib/python3.9/site-packages/pip (python 3.9)
Now running pip3 install evdev gives me the following:
> pip3 install evdev
Collecting evdev
Using cached evdev-1.6.0.tar.gz (26 kB)
Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for evdev, since package 'wheel' is not installed.
Installing collected packages: evdev
Running setup.py install for evdev ... error
error: subprocess-exited-with-error
× Running setup.py install for evdev did not run successfully.
│ exit code: 1
╰─> [46 lines of output]
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/evdev
copying evdev/ff.py -> build/lib.linux-x86_64-3.9/evdev
copying evdev/device.py -> build/lib.linux-x86_64-3.9/evdev
copying evdev/events.py -> build/lib.linux-x86_64-3.9/evdev
copying evdev/uinput.py -> build/lib.linux-x86_64-3.9/evdev
copying evdev/eventio_async.py -> build/lib.linux-x86_64-3.9/evdev
copying evdev/genecodes.py -> build/lib.linux-x86_64-3.9/evdev
copying evdev/eventio.py -> build/lib.linux-x86_64-3.9/evdev
copying evdev/util.py -> build/lib.linux-x86_64-3.9/evdev
copying evdev/evtest.py -> build/lib.linux-x86_64-3.9/evdev
copying evdev/__init__.py -> build/lib.linux-x86_64-3.9/evdev
copying evdev/ecodes.py -> build/lib.linux-x86_64-3.9/evdev
running build_ext
running build_ecodes
writing ecodes.c (using /usr/include/linux/input.h /usr/include/linux/input-event-codes.h /usr/include/linux/uinput.h)
building 'evdev._input' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/evdev
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/denehoffman/.pyenv/versions/3.9.5/include/python3.9 -c evdev/input.c -o build/temp.linux-x86_64-3.9/evdev/input.o -std=c99 -Wno-error=declaration-after-statement
gcc -pthread -shared -L/home/denehoffman/.pyenv/versions/3.9.5/lib -L/home/denehoffman/.pyenv/versions/3.9.5/lib build/temp.linux-x86_64-3.9/evdev/input.o -o build/lib.linux-x86_64-3.9/evdev/_input.cpython-39-x86_64-linux-gnu.so
building 'evdev._uinput' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/denehoffman/.pyenv/versions/3.9.5/include/python3.9 -c evdev/uinput.c -o build/temp.linux-x86_64-3.9/evdev/uinput.o -std=c99 -Wno-error=declaration-after-statement
gcc -pthread -shared -L/home/denehoffman/.pyenv/versions/3.9.5/lib -L/home/denehoffman/.pyenv/versions/3.9.5/lib build/temp.linux-x86_64-3.9/evdev/uinput.o -o build/lib.linux-x86_64-3.9/evdev/_uinput.cpython-39-x86_64-linux-gnu.so
building 'evdev._ecodes' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/denehoffman/.pyenv/versions/3.9.5/include/python3.9 -c evdev/ecodes.c -o build/temp.linux-x86_64-3.9/evdev/ecodes.o -std=c99 -Wno-error=declaration-after-statement
In file included from /home/denehoffman/.pyenv/versions/3.9.5/include/python3.9/Python.h:141,
from evdev/ecodes.c:2:
evdev/ecodes.c: In function ‘moduleinit’:
evdev/ecodes.c:629:29: error: ‘KEY_EMOJI_PICKER’ undeclared (first use in this function)
629 | PyModule_AddIntMacro(m, KEY_EMOJI_PICKER);
| ^~~~~~~~~~~~~~~~
/home/denehoffman/.pyenv/versions/3.9.5/include/python3.9/modsupport.h:146:67: note: in definition of macro ‘PyModule_AddIntMacro’
146 | #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
| ^
evdev/ecodes.c:629:29: note: each undeclared identifier is reported only once for each function it appears in
629 | PyModule_AddIntMacro(m, KEY_EMOJI_PICKER);
| ^~~~~~~~~~~~~~~~
/home/denehoffman/.pyenv/versions/3.9.5/include/python3.9/modsupport.h:146:67: note: in definition of macro ‘PyModule_AddIntMacro’
146 | #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
| ^
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> evdev
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
I also run into the same error message with wheel installed, so that isn't it.
This also fails with the same error if I make a virtual environment with /usr/bin/python3 -m venv ... which I would think should mimic the system environment in some way.
The reason I'm asking this here rather than on something specific to evdev is that this seems to be some problem with how my environment is set up, as though the header files (particularly modsupport.h) are not the same as they are for the apt installed version. I've tried a clean install of that python as well as the entirety of pyenv to no avail, can anyone tell me what I'm missing here?
enter code hereI'm trying to install paramiko module in my linux server. The pip is blocked on the server, So i am manually copying the package zips and installing them from setup.py
when i try installing paramiko i get
error: Could not find suitable distribution for Requirement.parse('pynacl>=1.0.1')
so i download the PyNaCl package, but i get
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('cffi>=1.1.0')
pynacl needs cffi 1.1.0 above:
so while installing cffi1.11.5 i get the below error:
[root#homecffi-1.11.5]# python3.5 setup.py install
running install
---
---
installing library code to build/bdist.linux-x86_64/egg
--
--
building '_cffi_backend' extension
gcc -pthread -fno-strict-aliasing -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/local/lib/libffi-3.1/include -I/usr/local/include/python3.5m -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.5/c/_cffi_backend.o
c/_cffi_backend.c: In function ‘b_callback’:
c/_cffi_backend.c:5911: warning: ‘ffi_prep_closure’ is deprecated (declared at /usr/local/include/ffi.h:341)
gcc -pthread -shared build/temp.linux-x86_64-3.5/c/_cffi_backend.o -L$(libdir)/../lib64 -lffi -o build/lib.linux-x86_64-3.5/_cffi_backend.cpython-35m-x86_64-linux-gnu.so
/usr/bin/ld: cannot find -lffi
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
Can anyone help me with this?
If this is a Debian or Ubuntu machine,
sudo apt install libffi-dev
and then try again.
For other distributions, the installation method and package name may be different.
I built Python 3.6 from source and am trying to install lxml. Trying to install it from pip gives the following error:
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -Isrc -Isrc/lxml/includes -I/usr/local/include/python3.6m -c src/lxml/etree.c -o build/temp.linux-armv6l-3.6/src/lxml/etree.o -w
src/lxml/etree.c:91:20: fatal error: Python.h: No such file or directory
compilation terminated.
Compile failed: command 'gcc' failed with exit status 1
cc -I/usr/include/libxml2 -I/usr/include/libxml2 -c /tmp/xmlXPathInitln68cjsn.c -o tmp/xmlXPathInitln68cjsn.o
cc tmp/xmlXPathInitln68cjsn.o -L/usr/lib -lxml2 -o a.out
error: command 'gcc' failed with exit status 1
The same error is raised if I try to install Cython to compile lxml from source. I installed libxml2-dev and libxslt1-dev, but python3.6-dev, which is apparently also required, is not found in Raspbian repository. I added the following line to /etc/apt/sources.list:
deb http://ftp.de.debian.org/debian sid main
But when trying to install it afterwards, I receive the following error:
The following packages have unmet dependencies:
libdbus-1-3 : Breaks: dbus (< 1.9.16-1~) but 1.6.8-1+deb7u1 is to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
In fact, this error is raised on any package that is found in Debian repository that is not in Raspbian one. What can I do about this?
Since you installed Python from source, you should have the header files already. Should also use header files for the version that you built as opposed to the version in the package manager.
Either
Add the source code directory to includes used by GCC (gcc -I<dir>) or
Install the from source package in a system directory that is automatically included like /usr/include or /usr/local/include
The second option is probably easiest and should be possible from the standard configure/make scripts.
I'm trying to install bigfloat and I am getting this message that seems to indicate I need the mpfr library first. How do I do this?
The message:
running build_ext building 'mpfr' extension creating build/temp.linux-x86_64-2.7 x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c mpfr. c -o build/temp.linux-x86_64-2.7/mpfr.o mpfr.c:344:18: fatal error: mpfr.h: No such file or directory #include "mpfr.h" ^ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
I'm pretty new to python and pythonanywhere, so I don't know how to install libraries.
I tried to find how to install a library using google, and I tried to use:
pip install --user mpfr
but I get this error message:
Collecting mpfr Could not find a version that satisfies the requirement mpfr (from versions: ) No matching distribution found for mpfr
The gmpy2 is written in C and depends on three other C libraries: GMP, MPFR, and MPC. The easiest way to ensure all the dependencies are present is to "libmpc-dev" using the standard package management tools from your Linux distribution.
For example:
sudo apt-get install libmpc-dev
I am trying to install the python package biopython from source on my Macbook pro OSX 10.9.4,
I run python setup.py build in the terminal and receive this
running build
running build_py
running build_ext
building 'Bio.cpairwise2' extension
Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/MacOSX10.6.sdk
Please check your Xcode installation
gcc -DNDEBUG -g -O3 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -Qunused-arguments -Qunused-arguments -I/Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents/include/python2.7 -c Bio/cpairwise2module.c -o build/temp.macosx-10.6-x86_64-2.7/Bio/cpairwise2module.o
clang: warning: no such sysroot directory: '/Developer/SDKs/MacOSX10.6.sdk'
In file included from Bio/cpairwise2module.c:12:
/Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx- x86_64/Canopy.app/Contents/include/python2.7/Python.h:33:10: fatal error:
'stdio.h' file not found
#include <stdio.h>
^
1 error generated.
error: command 'gcc' failed with exit status 1
I checked that Xcode should be properly installed and working
You should be using pip. Try:
pip install biopython
Uninstalled Canopy and everything worked like a charm...
Try installing the Biopython version available from the Canopy "Package Manager" > "Available Packages" > "Canopy Packages".
This way, I seem to have solved a similar problem while installing Pyensembl, that also installs Biopython.