Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use pip install where one requirement has dependency on version on gcc-4.5

I am installing an egg packaged for pip, inside my virtualenv, under Python 2.7.2. The egg has 16 requirements, one of which (pycryptopp 0.5.29) is known to fail with gcc-4.6 and hence must be compiled with 4.5. The system has both gcc-4.6 (default) and gcc-4.5 installed.

How do I configure/hack pip install to build this package specially? (or do I just temporarily kludge the link /usr/bin/gcc while installing this package)

Do I need to clean up the existing (virtualenv)/build directory where it broke, and if so how?

(I already read the pip documentation and searched SO + SU)

like image 758
smci Avatar asked Jan 19 '23 11:01

smci


2 Answers

No need to fiddle around with symlinks here. On most Linux systems you can set the compiler to use with the CC env var. In case of pycryptopp and pip the following might help:

$ CC=/usr/bin/gcc-4.5 pip install pycryptopp

given that you have GCC 4.5 installed in that location. This worked fine for me on Ubuntu 11.10 (oneiric) with packages gcc-4.5 and g++-4.5 installed.

like image 144
ulif Avatar answered Jan 29 '23 15:01

ulif


(I retitled the question from "How to use pip install where one requirement must be compiled with gcc-4.5?")

1) The correct method is to build with "--disable-embedded-cryptopp" which links to libcryptopp. Some people report runtime issue but It Works For Me.

pip install --install-option="--disable-embedded-cryptopp" pycryptopp

2.) A truly ugly workaround which I used (and which ulif helpfully points out can be obviated by using CC=.. ) is to invoke pip install specifically for the problem package, and temporarily kludge the link to gcc.

pushd /usr/bin; sudo rm gcc-4.6; ln -s gcc-4.5 gcc; popd;
pip install pycryptopp
pushd /usr/bin; sudo rm gcc-4.5; ln -s gcc-4.6 gcc; popd;

Further reasons this is bad: it requires root access and messing with the link to gcc binary. It certainly can't be Makefile'd.

like image 43
smci Avatar answered Jan 29 '23 17:01

smci