Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pycrypto installation: configure error: cannot run C compiled programs

Please be gentle on me. I have searched the site, and I know there is another answer to this exact question, but the answers posted there aren't working for me.

I am trying to install pycrypto, so that I can get paramiko to work. Paramiko is failing because of a missing pycrypto module. I have tried using pip install pycrypto which succeeds, but does not cure the problem.

I have tried installing a binary version of pycrypto and that doesn't solve the problem.

Now I am trying to build pycrypto. I have cygwin64 and mingw installed on my machine. The approach that gets the farthest is

python setup.py build --compiler=mingw32

This gets to an error,

checking whether we are cross compiling... configure: error: in `/cygdrive/c/Python27/pycrypto-2.6.1':
configure: error: cannot run C compiled programs.

The other answer suggests removing spaces in the path. I have tried reducing the path to simply

c:\mingw;c:\python2.7;c:\cygwin64\bin

with no change to the result?

Does anyone have a fix they can point me to? Thank you. The overall goal is to get paramiko to work. The paramiko error is

ImportError: No module named Crypto.PublicKey
like image 928
user1858261 Avatar asked Jun 10 '14 23:06

user1858261


2 Answers

In my case, the /tmp mount point was mounted with the noexec flag.

For windows with cygwin, I would check the mount point too, as well as dependencies such as the vcredist packages required for python2 and python3, see also Errors while building/installing C module for Python 2.7.

Two solutions for linux:

  • remount temporarily with the exec flag (very likely requires root/sudo permissions)

e.g.:

sudo mount -o remount,rw,exec /tmp
  • change the build path to a local mount point

e.g.:

mkdir -p ~/python/tmp
pip install --build ~/python/tmp pycrypto

Note: it's worth looking at the other answers:

  • verify autoconf and python2-dev or python3-dev packages are installed.
like image 115
Thomas B in BDX Avatar answered Sep 20 '22 22:09

Thomas B in BDX


I had a similar problem:

pip install --upgrade subprocess32

failed with

configure: error: cannot run C compiled programs

on aws after our admins tightened the settings and mounted tmpfs with the noexec option.

The solution was

TMPDIR=/var/tmp pip install --upgrade subprocess32
like image 38
sds Avatar answered Sep 19 '22 22:09

sds