Error command 'gcc' failed with exit status 1 - python

I installed Scrapy on windows 7 64bit. When I enter scrapy startproject tutorial in CMD, I get an error:
ImportError: No module named `cryptography.hazmat.bindings.openssl.binding`
To solve this, I want to install pycrypto. When I run pip install pycrypto, the next error was: _Unable to findvcvarsall.bat_, because I have installed Visual Studio 2010, to solve this, I installed mingw32 and set environment variable and disabled my antivirus and removed -mno-cygwin from cygwinccompiler.py:
if self.gcc_version < '4' or is_cygwingcc():
no_cygwin = ''
else:
no_cygwin = ' -mno-cygwin'
Became:
if self.gcc_version < '4' or is_cygwingcc():
no_cygwin = ''
else:
no_cygwin = ''
And now I get the error:
error command 'gcc' failed with exit status 1
(Installed python 2.7 64)
Please guide me.

The easy thing is just to install the binary builds from http://www.voidspace.org.uk/python/modules.shtml#pycrypto
Then you can attempt building the PyCrypto C extensions again at leisure:
Visual Studio ships with a CMD shortcut that vcvarsall.bat. Use that shortcut to start cmd.exe and run pip install from there.
(alternatively) Install cygwin instead of mingw to avoid having to change PyCrypto's build scripts
Pycrypto have dependencies on either GMP or MPIR for bignums. Cygwin ships precompiled binaries of those. I'm sure there are Mingw based projects that have GMP precompiled as well.
You'd need to either get prebuild binaries and headers for Pycrypto's dependencies or build them manually yourself

Related

Issues installing python package on windows

I'm trying to install python-rocksdb on a windows 10 machine and I'm coming across some issues with the install.
I have successfully installed rocksdb first using the vcpkg method.
When running pip install python-rocksdb I get the following error:
cl : Command line error D8021 : invalid numeric argument '/Wextra'
error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
Looking around suggested attempting to install with GCC or G++, so I downloaded cygwin and then attempted to install the python package using
pip install --global-option build_ext --global-option --compiler=cygwin python-rocksdb which yielded the following error:
gcc: error: unrecognized command-line option ‘-mcygwin’
error: command 'C:\\cygwin64\\bin\\gcc.exe' failed with exit code 1
This post seems to suggest that you need to use g++ specifically, but it looks like the cygwin command is defaulting to gcc.
Just note that I'm not using the virtual env with python.
Any assistance is greatly appreciated.

cvxpy stlibc++ Installation error on MacOS Mojave

While trying to install cvxpy package using pip install on Mac, I get the following error message:
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
In file included from cvxpy/cvxcore/src/cvxcore.cpp:15:
cvxpy/cvxcore/src/cvxcore.hpp:18:10: fatal error: 'vector' file not found
#include <vector>
^~~~~~~~
1 warning and 1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
Mac is running OS Mojave.
I solved the issue using the following steps,
First I tried changing the flags to instruct the installation to use libc++,
CFLAGS=-stdlib=libc++ pip install cvxpy
Then it complained about having an invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later).
Then I ran the following command to set the deployment target,
export MACOSX_DEPLOYMENT_TARGET=10.10
Then running the first command(CFLAGS=-stdlib=libc++ pip install cvxpy) again installed cvxpy successfully.
I have been struggling with this all weekend and the most success I have found so far is installing cvxpy in an anaconda environment with these two lines:
conda install -c conda-forge lapack
conda install -c cvxgrp cvxpy
I had a similar error on Mojave. The problem is that the location of the headers installed by XCode command-line tools (which includes clang) have changed. I was able to get it working by adding this to my ~/.bash_profile and opening a new shell:
export CFLAGS="-I/usr/local/include -L/usr/local/lib -I$(brew --prefix openssl)/include -I$(xcrun --show-sdk-path)/usr/include"
This adds flags to CLANG that tell it to run the xcrun command to find the headers. It also adds the homebrew openssl headers to the clang path, which may not be necessary for this case (and assumes you have them installed).
See: https://stackoverflow.com/a/52871908/8344813

Can't Install Jekyll

I get the error (Ubuntu 14.04):
sudo gem install
jekyllBuilding native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.1.0/gems/ffi-1.9.14 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/ffi-1.9.14/gem_make.out
Common solutions like installing ruby-dev are not working.
Please help.Thanks.

Can't install pycrypto on windows virtualenv

I am trying to install pycrypto on my Windows machine. I have mingw installed and distutils is using it. The error here is what I am getting:
In file included from C:\Python27\include/pyconfig.h:68:0,
from C:\Python27\include/Python.h:8,
from src/winrand.c:33:
c:\mingw\bin../lib/gcc/mingw32/4.7.2/../../../../include/io.h:301:1: error: unknown type name 'off64_t'
c:\mingw\bin../lib/gcc/mingw32/4.7.2/../../../../include/io.h:301:36: error: unknown type name 'off64_t'
c:\mingw\bin../lib/gcc/mingw32/4.7.2/../../../../include/io.h:302:1: error: unknown type name 'off64_t'
c:\mingw\bin../lib/gcc/mingw32/4.7.2/../../../../include/io.h:302:39: error: unknown type name 'off64_t'
src/winrand.c:38:0: warning: "_WIN32_WINNT" redefined [enabled by default]
In file included from c:\mingw\bin../lib/gcc/mingw32/4.7.2/../../../../include/_mingw.h:35:0,
from c:\mingw\bin../lib/gcc/mingw32/4.7.2/../../../../include/io.h:27,
from C:\Python27\include/pyconfig.h:68,
from C:\Python27\include/Python.h:8,
from src/winrand.c:33:
c:\mingw\bin../lib/gcc/mingw32/4.7.2/../../../../include/sdkddkver.h:154:0: note: this is the location of the previous definition
error: command 'gcc' failed with exit status 1
Edit: I found this, but I am not sure how to fix pip install with it.
http://ac-archive.sourceforge.net/largefile/largefiles_win32.print.html
I met the same problem when building Fabric in windows.
The reason was mingw32's gcc config when building pycrypto.
In configure, gcc's setting -std is set to c99.
But, when -std is c99, __STRICT_ANSI__ is defined and typedef _off_t off_t and _off64_t off64_t in "sys/types.h" are skipped.
I succeeded to build pycrypto by modifying sys/types.h in mingw32 but it was brutal.
Create a virtualenv (I usually put all mine on the desktop)
Download the binary of pycrypto (matching your installed python version and architecture - no support for python3 as of now)
- http://www.voidspace.org.uk/python/modules.shtml
navigate to the easy_install executable (under Lib\site-packages) within the virtualenv folder you created and run the pycrypto install: easy_install C:\path\to\the\download\pycrypto-2.6.win-amd64-py2.7.exe

Installing Ephem package in Python 3

I would like to install the ephem package in my Python 3.3.0 version under Windows XP.
I tried first the pip install ephem route from the system command prompt. The process aborted with the error message of Unable to find vcvarsall.bat.
I read prior advice on the net for such a difficulty. Following it I installed mingw32 in my computer, added C:\MinGW\bin to the PATH variable and provided Lib / distutils with a new file called distutils.cfg and the content:
[build]
compiler=mingw32
On running now any of the install commands (pip, *easy_install* and setup.py all work the same) the following error results:
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Ilibastro-3.7.5 -IC:\Python33\
include -IC:\Python33\include -c extensions/_libastro.c -o build\temp.win32-3.3\
Release\extensions\_libastro.o
cc1.exe: error: unrecognised command line option '-mno-cygwin'
error: command 'gcc' failed with exit status 1
I have tried to understand and solve the problem, but have been unsuccesful. I have not been able even to find the place in the code where such values are established.
¿Could somebody provide any help? ¿Would ephem be one of the cases alluded by Installing Python modules in the 3.3.0 Documentation with "Not all extensions can be built with MinGW or Cygwin, but many can."?
Thanks in advance
Paco
Here is an extremely useful page of Windows binaries of python packages: http://www.lfd.uci.edu/~gohlke/pythonlibs/.
It includes binaries for pyephem.

Categories

Resources