If I pip install cffi, I get this:
building '_cffi_backend' extension
c:\mingw\bin\gcc.exe -mdll -O -Wall -Ic/libffi_msvc -IC:\python27\include -IC:\python27\PC -c c/_cffi_backend.c -o build\temp.win32-2.7\Release\c\_cffi_backend.o
...
(lots of warnings)
...
c/libffi_msvc\win32.c: In function 'ffi_call_x86':
c/libffi_msvc\win32.c:48:2: error: '_asm' undeclared (first use in this function)
c/libffi_msvc\win32.c:48:2: note: each undeclared identifier is reported only once for each function it appears in
c/libffi_msvc\win32.c:48:7: error: expected ';' before '{' token
c/libffi_msvc\win32.c:162:1: warning: control reaches end of non-void function [-Wreturn-type]
error: command 'gcc' failed with exit status 1
This is using MinGW obviously.
I also tried installing from the wheel here:
pip install https://pypi.python.org/packages/cp27/c/cffi/cffi-0.8.6-cp27-none-win32.whl#md5=aedc78351af65c4f514df0f2812473eb
I get the following strange error:
Downloading/unpacking https://pypi.python.org/packages/cp27/c/cffi/cffi-0.8.6-cp27-none-win32.whl
Downloading cffi-0.8.6-cp27-none-win32.whl (77kB): 77kB downloaded
Running setup.py egg_info for package from https://pypi.python.org/packages/cp27/c/cffi/cffi-0.8.6-cp27-none-win32.whl
Traceback (most recent call last):
File "<string>", line 16, in <module>
IOError: [Errno 2] No such file or directory: 'c:\\users\\me\\appdata\\local\\temp\\pip-nkx4aq-build\\setup.py'
And in fact when I look in that (temp) pip-nkx4aq-build directory, I see that there is no setup.py there.
So, my question simply is, why would this fail, and what do I need to do to install cffi on Windows?
It is known not to work, contributions welcome:
https://bitbucket.org/cffi/cffi/issue/159/python-setuppy-install-fails-with-mingw
You can download the cffi binary package and install, link address below:
http://www.lfd.uci.edu/~gohlke/pythonlibs/
Two steps -
run this command - sudo apt-get install libffi-dev (on Ubuntu and Debian)
pip install cffi
Related
I was trying to pip install stanza and got this message:
ERROR: No matching distribution found for torch>=1.3.0 (from stanza)
I then ran pip install torch and got the following (the website won't let me include too much code, so here's the full error)
ERROR: Command errored out with exit status 1:
command: 'c:\python\python37\python.exe' ... ...
... ...
Traceback (most recent call last):
... ...
File "C:\Users\borka\AppData\Local\Temp\pip-install-10i7vgad\torch\setup.py", line 51, in run
from tools.nnwrap import generate_wrappers as generate_nn_wrappers
ModuleNotFoundError: No module named 'tools.nnwrap'
----------------------------------------
ERROR: Failed building wheel for torch
ERROR: Command errored out with exit status 1:
command: 'c:\python\python37\python.exe' ... ...
cwd: C:\Users\borka\AppData\Local\Temp\pip-install-10i7vgad\torch
Complete output (2 lines):
running clean
error: [Errno 2] No such file or directory: '.gitignore'
----------------------------------------
ERROR: Failed cleaning build dir for torch
DEPRECATION: Could not build wheels for torch which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.
ERROR: Command errored out with exit status 1:
command: 'c:\python\python37\python.exe' ... ...
Traceback (most recent call last):
... ...
File "C:\Users\borka\AppData\Local\Temp\pip-install-10i7vgad\torch\setup.py", line 51, in run
from tools.nnwrap import generate_wrappers as generate_nn_wrappers
ModuleNotFoundError: No module named 'tools.nnwrap'
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python\python37\python.exe' ... ... Check the logs for full command output.
I can see that you have a Windows machine, so from this official pytorch website, you can build the command that the best for your requirements and system, try this
pip install torch===1.6.0 torchvision===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
And here, all of the torch packages are located, both Windows, MacOS, and Linux
I came across the same error and realized that Python 3.9 is not supported by Pytorch yet. I created another virtual environment with Python 3.7 and the installation worked.
OpenSUSE Leap 42.1, python 2.7.9, pip 8.1.2
I wanna install Tushare, but the terminal told me there was no lxml. Then I use sudo zypper in libxml2 first,but when I want to install "lxml" with lxml-3.6.1.tar.gz downloaded from the official website. It returns:
compilation terminated.
Compile failed: command 'gcc' failed with exit status 1
cc -I/usr/include/libxml2 -c /tmp/xmlXPathInitVXdVTQ.c -o tmp/xmlXPathInitVXdVTQ.o
/tmp/xmlXPathInitVXdVTQ.c:1:26: fatal error: libxml/xpath.h: no such files or directory
#include "libxml/xpath.h"
^
compilation terminated.
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
error: command 'gcc' failed with exit status 1
I've installed 'gcc' before. Then How can I deal with this problem?
And How should I find the keys to such problems in the future?
Thanks a lot
You need to install the development library, most likely called libxml2-dev or libxml2-devel in order to compile against the required header (.h) files.
I'm having the following error when trying to run "pip install lxml" into a virtualenv in Ubuntu 12.10 x64. I have Python 2.7.
I have seen other related questions here about the same problem and tried installing python-dev, libxml2-dev and libxslt1-dev.
Please take a look of the traceback from the moment I tip the command to the moment when the error occurs.
Downloading/unpacking lxml
Running 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.1.2.
Building without Cython.
Using build configuration of libxslt 1.1.26
Building against libxml2/libxslt in the following directory: /usr/lib
warning: no files found matching '*.txt' under directory 'src/lxml/tests'
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.1.2.
Building without Cython.
Using build configuration of libxslt 1.1.26
Building against libxml2/libxslt in the following directory: /usr/lib
building 'lxml.etree' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/home/admin/.virtualenvs/dev.actualito.com/build/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
src/lxml/lxml.etree.c: In function '__pyx_f_4lxml_5etree__getFilenameForFile':
src/lxml/lxml.etree.c:26851:7: warning: variable '__pyx_clineno' set but not used [-Wunused-but-set-variable]
src/lxml/lxml.etree.c:26850:15: warning: variable '__pyx_filename' set but not used [-Wunused-but-set-variable]
src/lxml/lxml.etree.c:26849:7: warning: variable '__pyx_lineno' set but not used [-Wunused-but-set-variable]
src/lxml/lxml.etree.c: In function '__pyx_pf_4lxml_5etree_4XSLT_18__call__':
src/lxml/lxml.etree.c:138273:81: warning: passing argument 1 of '__pyx_f_4lxml_5etree_12_XSLTContext__copy' from incompatible pointer type [enabled by default]
src/lxml/lxml.etree.c:136229:52: note: expected 'struct __pyx_obj_4lxml_5etree__XSLTContext *' but argument is of type 'struct __pyx_obj_4lxml_5etree__BaseContext *'
src/lxml/lxml.etree.c: In function '__pyx_f_4lxml_5etree__copyXSLT':
src/lxml/lxml.etree.c:139667:79: warning: passing argument 1 of '__pyx_f_4lxml_5etree_12_XSLTContext__copy' from incompatible pointer type [enabled by default]
src/lxml/lxml.etree.c:136229:52: note: expected 'struct __pyx_obj_4lxml_5etree__XSLTContext *' but argument is of type 'struct __pyx_obj_4lxml_5etree__BaseContext *'
src/lxml/lxml.etree.c: At top level:
src/lxml/lxml.etree.c:12384:13: warning: '__pyx_f_4lxml_5etree_displayNode' defined but not used [-Wunused-function]
gcc: internal compiler error: Killed (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See for instructions.
error: command 'gcc' failed with exit status 4
Complete output from command /home/admin/.virtualenvs/dev.actualito.com/bin/python -c "import setuptools;__file__='/home/admin/.virtualenvs/dev.actualito.com/build/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-asDtN5-record/install-record.txt --single-version-externally-managed --install-headers /home/admin/.virtualenvs/dev.actualito.com/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.1.2.
Building without Cython.
Using build configuration of libxslt 1.1.26
Building against libxml2/libxslt in the following directory: /usr/lib
running install
running build
running build_py
copying src/lxml/includes/lxml-version.h -> build/lib.linux-x86_64-2.7/lxml/includes
running build_ext
building 'lxml.etree' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/home/admin/.virtualenvs/dev.actualito.com/build/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
src/lxml/lxml.etree.c: In function '__pyx_f_4lxml_5etree__getFilenameForFile':
src/lxml/lxml.etree.c:26851:7: warning: variable '__pyx_clineno' set but not used [-Wunused-but-set-variable]
src/lxml/lxml.etree.c:26850:15: warning: variable '__pyx_filename' set but not used [-Wunused-but-set-variable]
src/lxml/lxml.etree.c:26849:7: warning: variable '__pyx_lineno' set but not used [-Wunused-but-set-variable]
src/lxml/lxml.etree.c: In function '__pyx_pf_4lxml_5etree_4XSLT_18__call__':
src/lxml/lxml.etree.c:138273:81: warning: passing argument 1 of '__pyx_f_4lxml_5etree_12_XSLTContext__copy' from incompatible pointer type [enabled by default]
src/lxml/lxml.etree.c:136229:52: note: expected 'struct __pyx_obj_4lxml_5etree__XSLTContext *' but argument is of type 'struct __pyx_obj_4lxml_5etree__BaseContext *'
src/lxml/lxml.etree.c: In function '__pyx_f_4lxml_5etree__copyXSLT':
src/lxml/lxml.etree.c:139667:79: warning: passing argument 1 of '__pyx_f_4lxml_5etree_12_XSLTContext__copy' from incompatible pointer type [enabled by default]
src/lxml/lxml.etree.c:136229:52: note: expected 'struct __pyx_obj_4lxml_5etree__XSLTContext *' but argument is of type 'struct __pyx_obj_4lxml_5etree__BaseContext *'
src/lxml/lxml.etree.c: At top level:
src/lxml/lxml.etree.c:12384:13: warning: '__pyx_f_4lxml_5etree_displayNode' defined but not used [-Wunused-function]
gcc: internal compiler error: Killed (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See for instructions.
error: command 'gcc' failed with exit status 4
----------------------------------------
Command /home/admin/.virtualenvs/dev.actualito.com/bin/python -c "import setuptools;__file__='/home/admin/.virtualenvs/dev.actualito.com/build/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-asDtN5-record/install-record.txt --single-version-externally-managed --install-headers /home/admin/.virtualenvs/dev.actualito.com/include/site/python2.7 failed with error code 1 in /home/admin/.virtualenvs/dev.actualito.com/build/lxml
Storing complete log in /home/admin/.pip/pip.log
Make sure you have enough memory. Try dmesg | tail to see if it outputs something like:
...
[3778136.277570] Out of memory: Kill process 21267 (cc1) score 557 or sacrifice child
[3778136.277587] Killed process 21267 (cc1) total-vm:365836kB, anon-rss:336228kB, file-rss:0kB
Here is the my saved note.
sudo apt-get install libxml2
sudo apt-get install libxslt1.1
sudo apt-get install libxml2-dev
sudo apt-get install libxslt1-dev
sudo apt-get install python-libxml2
sudo apt-get install python-libxslt1
sudo apt-get install python-dev
sudo apt-get install python-setuptools
easy_install lxml
It has worked for my ubuntu 12.10
According to lxml site you could use such construction:
CFLAGS="-O0" pip install lxml
installation guide
Note for those installing globally: The proper way to pass environment variables with sudo is after sudo:
sudo CFLAGS="-O0" pip install lxml
I met the similar question(error: command 'gcc' failed with exit status 4) this morning. It seems you need check your machine's memory. If the memory is lower than 512M,that may be the cause.Try to close some services temporarily,like apache server,and try "pip install lxml" again.It maybe work!
I've stumbled with this trouble a couple of times.
Short answer
Python2: $ python2.7 setup.py clean build --with-cython install
Python3: $ pip-3.3 install lxml
Long answer
The hypothesis is that pip install lxml should work in every environment, regardless if you are using Python2 or Python3.
There's also Cython to be considered: You will certainly enjoy lxml compiled with Cython due to relevant performance gains.
For reasons unknown to me, the compilation on Python2 does not find Cython.
To be more precise and absolutely explicit about this matter, both commands below DO NOT employ Cython:
# DO NOT use these commands. I repeat: DO NOT use these commands.
$ pip-2.7 install lxml
$ easy_install-2.7 install lxml
So, when using Python2 you have only one alternative, as far as I know, which is: compile from sources, Luke!
# install build environment and dependencies
$ kernel_release=$( uname -r )
$ sudo apt-get install linux-headers-${kernel_release} build-essential -y
$ sudo apt-get install libxml2-dev libxslt1-dev -y
# Download from github and compile from sources
$ git clone --branch lxml-3.2.4 https://github.com/lxml/lxml
$ python2.7 setup.py clean build --with-cython install
For ubuntu 12.04 and virtual env:
sudo apt-get install libxml2-dev libxslt-dev
workon some-virt-env
pip install lxml
Try to disable the C compiler optimizations by setting the FLAGS environment variable
CFLAGS="-O0" pip install lxml
That solves for me without the need of more RAM
I'm trying to install a python wrapper over constraint programming library Gecode called python-gecode
https://pypi.python.org/pypi/gecode-python/
No matter how I install it I get same error "No such file or directory". Here is setup script output:
running install
running build
running build_py
running build_ext
building 'gecode._gecode' extension
C:\MinGW32-xy\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DDISJUNCTOR "-IC:\Program Files\Gecode\include" -IC:\Python27\include -IC:\Python27\PC -c _gecode.cc -o build\temp.win32-2.7\Release\_gecode.o
_gecode.cc:5:24: fatal error: 4.2.1: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1"
But the _gecode.cc is there in the folder. I don't really understand what's the problem. I tried installing with pip, easy_install, manual install and everytime I get this error.
Any ideas what's causing it?
Thanks!
Gecode-Python supports only up to version 4.0.0 of Gecode, so use that version instead of 4.2.1.
I'm trying to install the M2Crypto on Python26 in Windows, but I am getting the below error.
error: command 'swig.exe' failed: No such file or directory
This error occurs both using the "Easy Install" or "PIP Install" command. Follows the Log:
running build
running build_py
running build_ext
building 'M2Crypto.__m2crypto' extension
swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
swig.exe -python -IC:\Python26\include -IC:\Python26\PC
-Ic:\pkg\include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
error: command 'swig.exe' failed: No such file or directory
Any Help?
This worked for me: (using winpython2.7)
pip install M2CryptoWin32
reference:
https://github.com/dsoprea/M2CryptoWin32
Putting this in answer format:
You could try to install a binary build from http://chandlerproject.org/Projects/MeTooCrypto
from mata's comment that resolved OP's issue