pycrypto installation: configure error: cannot run C compiled programs
Asked Answered
S

4

7

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
Selective answered 10/6, 2014 at 23:37 Comment(0)
G
7

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.
Glitter answered 11/9, 2018 at 20:19 Comment(0)
I
5

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
Ironing answered 23/5, 2018 at 13:18 Comment(0)
R
3

I had the same error message when installing pycrypto (although nothing to do with paramiko). The solution for me was:

yum install autoconf
TMPDIR=/home/$USER/tmp
TMP=$TMPDIR
TEMP=$TMPDIR
export TMPDIR TMP TEMP

and then install again:

pip install pocrypto
Rame answered 14/8, 2017 at 11:34 Comment(0)
Q
0

I had this same problem in Chrubuntu 14.04, and solved it by first doing:

apt-get install python-dev

...to fix something to do with header files, and then:

pip install pycrypto

...to solve the actual problem with paramiko. However, then paramiko had a problem with something ecdsa, and 'pip install paramiko' said everything was already installed, no problem, so I did 'pip uninstall paramiko' followed by 'pip install paramiko', and now I can import paramiko in python without a problem.

There is probably a more elegant way to solve that last bit but this worked well enough for me.

Quake answered 5/8, 2014 at 20:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.