pycrypto on Ubuntu giving compiler error

18,753

Solution 1

I had a similar problem, but in my case it turns out I didn't have gcc installed at all.

So a simple sudo apt-get install gcc did the trick.

If you have it installed, but which gcc doesn't return any path, then go to /usr/bin/ and look for gcc. Then create a symbolic link, like so:

ln -s /usr/bin/gcc-<version-number> /usr/bin/gcc

where you replaced <version-number> with the appropriate version number, of course.

Solution 2

I ran into a similar error message when installing pycrypto on a shared host (Webfaction). The solution was to change the temporary directory while installing:

TMPDIR=~/tmp pip install pycrypto

Solution 3

I was having the same problem, and trying the above step of installing gcc did not help.

Once I installed the python-dev package, everything compiled perfectly.

sudo apt-get install python-dev

Share:
18,753

Related videos on Youtube

Pratibha
Author by

Pratibha

Sr. Python Developer with Django development experience

Updated on June 04, 2022

Comments

  • Pratibha
    Pratibha almost 2 years

    I am trying to install pycrypto2.6 on Ubuntu 10.04 (Lucid Lynx) with Python 2.7.3.

    I am encountering the following error:

    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 `/home/pratibha/Desktop/pycrypto-2.6':
    configure: error: no acceptable C compiler found in $PATH
    See `config.log' for more details
    Traceback (most recent call last):
    File "setup.py", line 456, in <module>
    core.setup(**kw)
    File "/usr/local/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
    File "/usr/local/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
    File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
    File "/usr/local/lib/python2.7/distutils/command/build.py", line 127, in run
    self.run_command(cmd_name)
    File "/usr/local/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
    File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
    File "setup.py", line 251, in run
    self.run_command(cmd_name)
    File "/usr/local/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
    File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
    File "setup.py", line 278, in run
    raise RuntimeError("autoconf error")
    RuntimeError: autoconf error
    

    I checked Software Centre, and I have GCC installed on my system, but the "which gcc" command is not returning any path.

    I got it by creating the symbolic link:

    ln -s /usr/bin/gcc-4.4 /usr/bin/gcc
    
    • Mat
      Mat almost 12 years
      Hello pratibha, please don't add "[solved]" to your question title, this isn't how this site works. Post your answer as an answer (you'll be able to do that in a while). If you already know the answer when posting, there's a button for that in the question editor.
  • joshbaptiste
    joshbaptiste over 8 years
    Thanks, this answer helped me with with a box I was trying to pip install paramiko that had noexec for /tmp
  • zgoda
    zgoda over 8 years
    $ which gcc /usr/bin/gcc And still not working.
  • zgoda
    zgoda over 8 years
    Unfortunately this did not help, still getting the above error.
  • loop
    loop about 8 years
    This is a wrong solution for the original problem. Helps in another situation.
  • JVercout
    JVercout about 8 years
    This works for me, ensure gcc AND python-dev are installed
  • Armando Alvarado
    Armando Alvarado over 7 years
    I had this same problem on a shared Webfaction server, Centos 7. This solution worked perfectly, thanks.
  • jward01
    jward01 over 6 years
    > So a simple sudo apt-get install gcc did the trick. That worked for me
  • Bob Stein
    Bob Stein over 6 years
    mkdir ~/tmp and then it worked for me (duh), on CentOS.