Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip install customized include path

I'm trying to install a library pyleargist. It requires another lib libfftw3 to be manually installed which I've installed. Since I don't have the root privilege, I have to install libfftw3 under my home directory: ~/usr/include and ~/usr/lib. Then I follow this post: https://superuser.com/questions/242190/how-to-install-matplotlib-on-os-x, added:

export LDFLAGS="-L~/usr/lib"
export CFLAGS="-I~/usr/include 

So that pip knows it have to consult /usr to get the include (.h files) and lib (.a, *.so files). However, while running pip install --user pyleargist, it complains about:

gcc-4.4.real: src/leargist.c: No such file or directory
gcc-4.4.real: no input files
error: command 'gcc' failed with exit status 1

I guess what happened is that the path is incorrect so that it can't find the *.c files (I think pip should have downloaded the file somewhere but not sure where it is).

So my questions are the following: 1) in this particular case, how can I install pyleargist with include and lib path under ~/usr? 2) more generally, how can one provide additional path for pip so that it knows where to get the additional include files or libs if not found in the default path?

p.s I am on an ubuntu machine without sudo privilege.

ref:
https://pypi.python.org/pypi/pyleargist/1.0.1
http://www.fftw.org/

like image 307
clwen Avatar asked Sep 28 '13 21:09

clwen


People also ask

Does pip install add to PATH?

The Pip Install is Not in the System Variable For Python commands to run from a Windows Command Prompt, the path of your pip install will need to be added to your PATH system variable. It should be added automatically if you installed Python via the installation file.

Why is pip not on PATH?

One of the most common problems with running Python tools like pip is the “not on PATH” error. This means that Python cannot find the tool you're trying to run in your current directory. In most cases, you'll need to navigate to the directory in which the tool is installed before you can run the command to launch it.


1 Answers

pip has a --global-option flag

You can use it to pass additional flags to build_ext.

For instance, to add a -I flag:

pip install --global-option=build_ext --global-option="-I/home/users/abc/include/" pyOpenSSL
like image 187
hahakubile Avatar answered Oct 18 '22 03:10

hahakubile