Y2P
Y2P

Reputation: 111

problems installing pycrypto on osx

I'm trying to install a Django project onto my OSX machine, which requires PyCrypto. I'm getting the following error:

running install
running build
running build_py
running build_ext
running build_configure
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/Users/home/Documents/tmp/dlitz-pycrypto-d2170a4':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
Traceback (most recent call last):
  File "setup.py", line 486, in <module>
    core.setup(**kw)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py", line 573, in run
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build.py", line 127, in run
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
  File "setup.py", line 292, in run
    self.run_command(cmd_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
  File "setup.py", line 319, in run
    raise RuntimeError("autoconf error")
RuntimeError: autoconf error

Upvotes: 11

Views: 15912

Answers (3)

jiv-e
jiv-e

Reputation: 513

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. :)

Upvotes: 0

sstringer
sstringer

Reputation: 506

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.

Upvotes: 5

Blender
Blender

Reputation: 298246

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

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

XCode should work.

Upvotes: 10

Related Questions