I've new to python and have hit a wall with installing scrapy.
Environment Details:
MacBook pro
OSX 10.9.5
XCode and Command Line utilities are installed
Python 2.7.9 is installed in /usr/local/bin/python
Python 2.7.5 (distrib as part of OSX) is installed in /usr/bin/python
using pip install
Approach tried to date
Initial attempt to install (before adding the python 2.7.9) was impossible as pip was not present in the 2.7.5 default installation. Trying to add pip failed due to security violations, so I added the 2.7.9 installation.
I could then run pip, but hit problems with the fatal error (reported in other threads) due to libxml being missing, which was resolved by adding the command line tools.
The installation then ran further, but fails with the following error:
/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/cryptography/hazmat/bindings/__pycache__/_Cryptography_cffi_464d07d2xdb61d8fa.c -o build/temp.macosx-10.6-intel-2.7/src/cryptography/hazmat/bindings/__pycache__/_Cryptography_cffi_464d07d2xdb61d8fa.o
src/cryptography/hazmat/bindings/__pycache__/_Cryptography_cffi_464d07d2xdb61d8fa.c:218:10: fatal error: 'CommonCrypto/CommonKeyDerivation.h' file not found
#include <CommonCrypto/CommonKeyDerivation.h>
^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
Since hitting this error I have tried multiple approaches:
uninstall scrapy, and manually install cryptography - cryptography install fails with same error
uninstall scrapy and reinstall with pip command line option ==0.22 to install the prior version - install fails with same error
install using the pip command line option --user to install into local user directory - install fails with same error
As far as I can tell from searching, this issue has not been reported on Stackoverflow or Github. How can I get over this issue to successfully install scrapy?
Thanks
I managed to resolve this myself by a roundabout means, which I'm sharing as an answer to my own question.
I never got cryptography to install through pip. I got around this by installing anaconda. Cryptography installed fine through anaconda. I then successfully installed scrapy with pip install which recognized that cryptography was already present.
Related
I am attempting to install the Perl package Math::GMP on OS X El Capitan.
I had one computer where this worked without issue - but a second computer is running into the following problem:
The Perl module Math::GMP requires the C library for GMP, so I have done a brew install gmp
This installed GMP including the following file:
/usr/local/include/gmp.h
But the package install still fails claiming I don't have gmp installed:
$ sudo perl -MCPAN -e shell
cpan[1]> install Math::GMP
Reading '/Users/chaosadmin/.cpan/Metadata'
Database was generated on Sat, 14 Nov 2015 09:17:02 GMT
Running install for module 'Math::GMP'
Checksum for /Users/me/.cpan/sources/authors/id/S/SH/SHLOMIF/Math-GMP-2.11.tar.gz ok
Scanning cache /Users/me/.cpan/build for sizes
............................................................................DONE
'YAML' not installed, will not store persistent state
Configuring S/SH/SHLOMIF/Math-GMP-2.11.tar.gz with Makefile.PL
Can't link/include C library 'gmp.h', 'gmp', aborting.
No 'Makefile' created SHLOMIF/Math-GMP-2.11.tar.gz
/usr/bin/perl Makefile.PL -- NOT OK
Failed during this command:
SHLOMIF/Math-GMP-2.11.tar.gz : writemakefile NO -- No 'Makefile' created
The obvious line is:
Can't link/include C library 'gmp.h', 'gmp', aborting.
But I definitely have "gmp.h" installed in /usr/local/include/gmp.h
I'm unsure why it's failing to install on this OS X El Capitan machine (it worked fine on my other one).
In the CPAN shell I used:
look Math::GMP
And updated the Makefile.PL to debug:
check_lib_or_exit(
header => 'gmp.h',
lib => 'gmp',
debug => 'true'
);
Which displayed the following error when running perl Makefile.PL
# /usr/bin/cc -arch i386 -arch x86_64 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -arch i386 -arch x86_64 -fstack-protector assertlibD4RJzZEa.c -o assertlibwGFzIVsM
assertlibD4RJzZEa.c:1:10: fatal error: 'gmp.h' file not found
include
On Centos :
Just install this : yum install gmp* -y
Good Luck :)
Since upgrading to Yosemite I cannot compile with gfortran. Initially I was getting "segmentation fault 11", then I:
Updated to gcc v.5.0 from http://hpc.sourceforge.net/
Re-installed Xcode command line utilities v.6.1.1
After doing the above, I am able to compile very simple fortran programs but the more complex code that I run gives me the following error:
gfortran: error: libgfortran.spec: No such file or directory
But in fact, the libgfortran.spec file is located in /usr/local/lib
ls /usr/local/lib | grep gfortran
libgfortran.3.dylib
libgfortran.a
libgfortran.dylib
libgfortran.la
libgfortran.spec
All of the gcc binaries are located in /usr/local/bin
which gfortran
/usr/local/bin/gfortran
And my path seems to be OK
echo $PATH
/usr/local/lib:/usr/local/bin:/usr/local:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/lib:/usr/texbin:/Users/MattCooper/bin:/Applications/MRT/bin
I also tried re-installing gcc with homebrew:
brew install gcc
Error: gcc-4.9.2 already installed
To install this version, first 'brew unlink gcc'
However, I get v. 5.0 when I ask 'gcc --version':
gcc --version
gcc (GCC) 5.0.0 20141005 (experimental)
When I try to unlink or upgrade gcc with homebrew I get a permission denied error:
brew unlink gcc
Unlinking /usr/local/Cellar/gcc/4.9.2... Error: Permission denied - /usr/local/bin/c++-4.9
similarly
brew upgrade gcc
Permission denied - /usr/local/bin/c++-4.9
Finally
which gcc
/usr/local/bin/gcc
Please help. Many thanks ahead of time. Please let me know what I've forgotten to include.
I ended up solving the problem via homebrew. I can't pinpoint the exact source of the problem but it was related to the fact that I installed gcc v4.9 from http://hpc.sourceforge.net/, then somewhere along the way I re-installed and/or updated gcc with homebrew. Then, after upgrading to Yosemite, I installed gcc v5 from http://hpc.sourceforge.net/. Somewhere within that process, the binaries within /usr/local/bin and usr/local/lib were not linked properly.
The main clue was the Permission Denied error when trying to run 'brew upgrade gcc'. I found a solution here: Brew doctor says: "Warning: /usr/local/include isn't writable."
To fix, I used:
brew doctor
which returned a bunch of directories that were not writeable, for example usr/local/lib, thus brew was unable to ugrade gcc to the v5.0 and link everything.
I went through and issued:
sudo chown -R $USER /usr/local
and did this for all of the other non-writeable directories returned by 'brew doctor'. Then, I was able to use brew to ugrade gcc:
brew upgrade gcc
During the ugrade, homebrew returned an error that stated it could not finish the upgrade because there was already an existing gfortran file located in:
/usr/local/bin/gfortran
To fix, homebrew suggested I run:
brew -link gcc
at which point everything worked. Interesting (to me, because I don't fully understand all of this) when I ask brew to clean things up, I get:
brew cleanup
Warning: Skipping (old) /usr/local/Cellar/gcc/4.9.2 due to it being linked
There's some similar information located here: How to link to a new gcc version with brew?
Similar to that user, when I look in my cellar, I find two versions of gcc, but I'm not sure if I need both
ls /usr/local/Cellar/gcc
4.9.2 4.9.2_1
I had a similar issue with similar solution. It could not find this file:
gfortran: error: libgfortran.spec: No such file or directory
So my problem was that I had installed gcc through hpc.sourceforge.net and through homebrew. I had to uninstall the homebrew version
brew uninstall gcc
Then I had to reinstall the gcc from hpc.sourceforge.net
sudo tar -xvf gcc-4.9-bin.tar.gz -C /
This worked for me when I wanted to revert to gcc 4.9 from hpc.sourceforge.net, using Yosemite.
I'm having trouble building MySQLdb on Mac OSX Mountain Lion. After upgrading to OSX Mountain Lion from OSX Lion, I have downloaded and installed Xcode 4.4 also. Then, I went to Preference > Downloads of the Xcode and installed Command Line Tools.
I've downloaded MySQL-python ver. 1.2.3 from http://sourceforge.net/projects/mysql-python/
When I run
python setup.py build
I get below message:
running build
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
running build_ext
building '_mysql' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -O3 -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/mysql/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.6-intel-2.7/_mysql.o -Os -g -fno-common -fno-strict-aliasing -arch x86_64
unable to execute gcc-4.2: No such file or directory
error: command 'gcc-4.2' failed with exit status 1
However, the gcc exists. When I run
gcc
I get
i686-apple-darwin11-llvm-gcc-4.2: no input files
Below is a similar question that I have found but its solution, which is exactly what I have done already, doesn't work for me.
How to install MySQLdb on Mountain Lion
I've had a similar problem while working with Ruby On Rails 3.2.7.
I too had upgraded the system to Mountain Lion, installed Xcode 4.4.1 and downloaded the Command Line Tools.
On the command line I got an error message saying it was impossible to find the file: /usr/bin/gcc-4.2 (I can't paste the precise output right now, I'm sorry).
I did have a /usr/bin/gcc and its version was i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1
I solved the problem by symlinking the file in the same directory and giving it the name the Ruby script was looking for:
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
After that, everything worked fine.
Use the following command to make make (or similiar) use the correct gcc:
export CC=/usr/bin/gcc
I ran into this. For me it was because I installed python from a DMG installer at http://python.org . Those are built against the wrong gcc. I fixed it by compiling python from source using Homebrew: Link
brew install python
That links against the correct gcc
(In my specific case I was using an older Python which is why I had used a DMG installer. I discovered that homebrew also has formulas for older versions)
I detoured this problem by using ActivePython.
There's specific installation instruction for MySQLdb here.
Since this is the first time I've used ActivePython I'm not sure if this' a robust solution for this problem. Therefore, I will leave this question open until I make sure this works.
I just upgraded from Snow Leopard to Lion, and an old python c-extension that I had to update didn't want to compile properly. I don't really know what to do here. Anyone who could help me out so it compiles ok? It compiled just fine back in Snow Leopard.
Home:folder Me$ python setup.py build
running build
running build_ext
building 'ccookies' extension
gcc -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c ccookies.c -o build/temp.macosx-10.3-fat-2.7/ccookies.o
llvm-gcc-4.2: error trying to exec '/Developer/usr/bin//../llvm-gcc-4.2/bin/powerpc-apple-darwin11-llvm-gcc-4.2': execvp: No such file or directory
In file included from /usr/include/architecture/i386/math.h:630,
from /usr/include/math.h:28,
from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pyport.h:312,
from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:58,
from ccookies.c:5:
/usr/include/AvailabilityMacros.h:109:14: warning: #warning Building for Intel with Mac OS X Deployment Target < 10.4 is invalid.
lipo: can't figure out the architecture type of: /var/folders/_t/yg4wppss5fv6dkmh89_6ykm40000gn/T//cc3Cgr3v.out
error: command 'gcc' failed with exit status 255
You appear to be using a 32-bit Python 2.7, possibly installed from python.org. Because of changes in Xcode 4 (dropping of support for the 10.4u SDK and gcc-4.0) it is not practical to build C extension modules with that Python on 10.7 Lion. Either use the Apple-supplied Python 2.7 (/usr/bin/python2.7) or install the python.org 64-bit/32-bit installer for 2.7.2 instead of the 32-bit-only one.
I was trying to install pynauty on my Mac OS X 10.7 and I got this problem. For some reasons, Ned Deily's answer didn't help me. I just want to provide one more way to solve this problem in case someone come to this page and is in the same situation as I am. The way I solved this prolem is:
Before running "python setup.py build", run:
export ARCHFLAGS="-arch x86_64"
On travis, I was getting this error. I've been using osx_image: osx10.11 since forever, but it suddenly stopped working, with this error, in last ~few weeks. Changing to osx_image: xcode7.3 fixed the error for me.
I am trying to install pygraphviz on mac os 10.6.7. I am using python 2.6.
So far here is what I have done :
downloaded Graphviz 2.28 at : http://www.graphviz.org/Download_macos.php
downloaded pygraphviz with the command: svn co https://networkx.lanl.gov/svn/pygraphviz/trunk pygraphviz
Changed directory to "pygraphviz"
uncommented the path into the setup.py script (checking that it was the right one ;) ) :
so the script become :
setup.py:
# OSX, Linux, alternate location
library_path='/usr/local/lib/graphviz'
include_path='/usr/local/include/graphviz'
Ran "python setup.py install"
but the process fails (see the code below) with the message :
error: command 'gcc-4.2' failed with exit status 1
client126-234:pygraphviz francois$ python setup.py install
library_path=/usr/local/lib/graphviz
include_path=/usr/local/include/graphviz
running install
running build
running build_py
copying pygraphviz/version.py -> build/lib.macosx-10.6-universal-2.6/pygraphviz
running build_ext
building 'pygraphviz._graphviz' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-
prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -I/usr/local/include/graphviz
-I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c
pygraphviz/graphviz_wrap.c -o build/temp.macosx-10.6-universal-2.6/pygraphviz/graphviz_wrap.o
unable to execute gcc-4.2: No such file or directory
error: command 'gcc-4.2' failed with exit status 1
I have tried :
to unstall an reinstall Graphviz
install the development version of Graphviz
download pygraphviz from python package index (http://pypi.python.org/pypi/pygraphviz) and install again
other installation ways : easy_install pygraphviz (give me the same error) . macport (impossible to install on my computer)
Am I doing something wrong? How can I solved this kind of error?
Any ideas would be a great help,
Thanks a lot
Francois
gcc-4.2 is part of Apple's developers tools package, Xcode. You need to install it first. There should be an Xcode 3 installer with either the software restore DVD that came with your Mac or possibly on the hard disk itself or with the Mac OS X 10.6 DVD or you can download a version from the Apple Developer Connection website (registration required) or you can buy a version of the newer Xcode 4 from the Mac Application Store. If you do install Xcode 4, you will likely need to add an export ARCHFLAGS='-arch i386 -arch x86_64' to your install; see here for more info.