Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

problems installing pycrypto on osx

Tags:

python

django

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
like image 565
Y2P Avatar asked Nov 12 '11 03:11

Y2P


People also ask

Is Pycrypto maintained?

I'd like to confirm that Pycrypto is in fact unmaintained.

What is Pycrypto module in Python?

Python Cryptography Toolkit (pycrypto) This is a collection of both secure hash functions (such as SHA256 and RIPEMD160), and various encryption algorithms (AES, DES, RSA, ElGamal, etc.). The package is structured to make adding new modules easy.

Why does pycrypto have to compile some code?

pycrypto has to compile some code due to legal restrictions on cryptography, so this is why the VC++ Build Tools had to be installed and the VS Developer Command Prompt had to be started. There's a small issue with the pycrypto source, so as a workaround we have to include the correct header by setting the environment variable CL.

Why can’t I build and install paramiko and pycrypto on Xcode?

Trying to build and install paramiko and pycrypto will fail with a variety of errors ranging from “autoconf error” to “ImportError: No module named Crypto” – if you encounter either of those errors it’s because Xcode’s command line tools are not installed yet. sudo easy_install ./ That’s it.

How to include the correct header in pycrypto?

There's a small issue with the pycrypto source, so as a workaround we have to include the correct header by setting the environment variable CL. here try to change the file name crypto to Crypto with upper case C because they import it as Crypto in every package. Checked with Python 3.7 x64 on Windows 10 x64 Version 1803.

Why can't I run pycrypto in Visual Studio 2017?

Checked with Visual Studio 2017. Start an elevated (!!!) VS Developer Command Prompt (Run As Admin via Right Click) pycrypto has to compile some code due to legal restrictions on cryptography, so this is why the VC++ Build Tools had to be installed and the VS Developer Command Prompt had to be started.


2 Answers

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

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

XCode should work.

like image 129
Blender Avatar answered Oct 02 '22 14:10

Blender


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.

like image 34
sstringer Avatar answered Oct 02 '22 15:10

sstringer