Environment: Linux Mint 17 Cinnamon.
This error is displayed:
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
when attempting the following in a virtualenv
:
pip install lxml
pip install pillow
pip install pycrypto
pip install pymongo (fails but still shows in pip freeze)
There are several solutions here that recommend installing python2.7-dev
:
Installing lxml in virtualenv via pip install error: command 'x86_64-linux-gnu-gcc' failed
Pillow installation error: command 'gcc' failed with exit status 1
fatal error: Python.h: No such file or directory
I am confused by this recommendation however because it is my understanding that using something like:
sudo apt-get install python2.7-dev
would add this to the main *system* instance of Python, rather that the one in virtualenv
. (see - https://unix.stackexchange.com/a/56392/92486)
Can I add python2.7-dev
just to the virtualenv
version of Python?
The
cffi
library needslibffi-dev
:Easiest way is:
and then
In Ubuntu 16.04.1 this worked for me:
Most of the time these are dependency-issues.
Following the stack-trace of the gcc compiler one can see the missing files. Sometimes installing the Python development packages is not enough.
For example: I tried to do
pip install requests[security]
in my virtualenv foo. This is the result that the pip-installer gave me.The important part is the:
#include <openssl/aes.h>
The compiler makes pretty clear that it is demanding this file - but it is not there in the filesystem.
Knowing that, the only thing left to do is: install the needed libraries!
Install the needed packages using your distributions package management tool: e.g. for Ubuntu:
aptitude install libssl-dev
Retry with pip in your virtualenv:
pip install requests[security]
This works for me, 12.04, python2.7.6 for package lxml
I installed
python2.7-dev
via Synaptic Package Manager in Linux Mint 17.I could then accomplish the following in
virtualenv
:And then I installed
libxml2-dev
andlibxslt1-dev
via Synaptic and could accomplish the following:I also did this so that the pymongo install didn't have any errors:
I'm still confused how this fixes the problem, because I thought
virtualenv
was an isolated environment. Any clarification about this appreciated.