[Solved]-Problems installing pycrypto on osx

10👍

configure: error: no acceptable C compiler found in $PATH

This error is self-explanatory. Get a C compiler.

XCode should work.

5👍

If you’re using Xcode 4.x on Lion, you’ll need to jump through some extra hoops to get this to compile and install:

1) In Xcode, go Preferences > Downloads, and click on the “Install” button next to “Command Line Tools” to install the compiler needed by Python.

2) In my case, I had to create a temporary symbolic link from gcc to gcc-4.2 to get the pycrypto compiler to shut up. In a terminal window, su to get root access:

a) Ensure gcc is installed:

# which gcc
/usr/bin/gcc

b) Create the symbolic link:

# ln -s /usr/bin/gcc /usr/bin/gcc-4.2

3) cd into your pycrypto directory and build and install pycrpto:

# cd ~/Downloads/pycrypto-2.5 (or your version)
# python setup.py build

# python setup.py install

4) Delete the symbolic link you made earlier:

# rm /usr/bin/gcc-4.2

If your process works like mine, you should have a functioning pycrypto installed on Lion.

0👍

With Mountain Lion I logged in here: developer.apple.com/downloads/index.action# – thanks bdargan!

I downloaded ‘Command Line Tools (OS X Mountain Lion) for Xcode’. Didn’t solve it completely. My Xcode was outdated (3.2.6) so I had to get the 4.4 version from the page mentioned above. This was the reason I couldn’t follow the 1) step in sstinger’s answer. There were no Preferences > Downloads option in the older version of Xcode.

I read that you can also download Xcode from App Store.
(http://www.chrisk.de/blog/2011/03/how-to-upgrade-to-xcode-4-or-uninstall-xcode-3/)

The Xcode 4 from developer.apple.com did not replace the Xcode 3 and didn’t move it to /Developer-old so I decided to install it again from App Store to make sure everything would work ok. Also there’s no need to download Command Line Tools separately because it can be done from Xcode 4 preferences as sstinger told.

I uninstalled previous Xcode installs before installing from App Store with following command.

sudo /Developer/Library/uninstall-devtools --mode=all

I tried to run:

# python setup.py build

I got the following warning.

warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.

So I tried to install GMP with Homebrew.

sudo brew install gmp

But for that I had to do…

# sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2

# sudo ln -s /usr/bin/g++ /usr/bin/g++-4.2

But Homebrew freezed on ´make check´ and I had to abort. It also freezed I did ´brew doctor´ and it had some weird issues. See the discussion here https://github.com/mxcl/homebrew/issues/7252. I had some problems with other installed stuff also.

I updated Homebrew and fixed all issues in ‘brew doctor’. After this I did # brew install gmp again. This time in went through. Still no success with setup.py.

Finally I tried # sudo pip install pycrypto. I thought I did it before, but now it seemed to install pycrypto correctly. I think there really was no need to install GMP or MPIR really. Not sure anymore. 🙂

👤jiv-e

Leave a comment