Customize Include Path for Pip Installation

Feedback

Question:

I am attempting to install a library, denoted as

pyleargist

, which has a dependency on another library,

libfftw3

. I have manually installed the latter library, as I lack root privileges. To install

pyleargist

, I must install it under my home directory, specifically at

~/usr/include

and

~/usr/lib

. To aid in the installation process, I followed the instructions outlined in this post: https://superuser.com/questions/242190/how-to-install-matplotlib-on-os-x, and added the necessary components.

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

To ensure proper inclusion of files (.h and .a/*.so) in

pip

, it is necessary to refer to

/usr

. Despite this,

pip install --user pyleargist

raises an error message indicating a problem.

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

It seems like the incorrect path is causing the inability to locate the

*.c

files. It is unclear where

pip

may have downloaded the file.

I have a couple of questions. Firstly, in this situation, what is the process for installing

pyleargist

along with

include

and

lib

in the

~/usr

path? Secondly, in a more general sense, how can

pip

be given extra paths to locate include files or libraries if they are not present in the default path?

I want to inform you that I am currently using an

ubuntu

machine which does not grant me

sudo

privilege.

The following references are available:
– PyLeArgist version 1.0.1 can be found at https://pypi.python.org/pypi/pyleargist/1.0.1
– The fastest fourier transform in the west (FFTW) can be found at http://www.fftw.org/


Solution 1:

The flag of

--global-option

is associated with

pip

.

It is possible to utilize it for transmitting extra flags to

build_ext

.

To illustrate, to include a marker with the code

-I

.

pip install --global-option=build_ext --global-option="-I/home/users/abc/include/" pyOpenSSL


Solution 2:


This thread provided valuable assistance. Additionally, by appending the

--user

flag, you can utilize pip without requiring root privileges.

pip install --global-option="-I/home/users/abc/include/" mpi4py --user

If you’re utilizing python-v2.7, then the mentioned instruction installs the python bundle into

/home/username/.local/lib/python2.7/site-packages

.


Solution 3:


In case you lack root access, you can still obtain a virtual environment without the need for root. Moreover, the path to the virtual environment will be located in the home directory.

curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.10.1.tar.gz
tar xvfz virtualenv-1.10.1.tar.gz
cd virtualenv-1.10.1.tar.gz
python virtualenv.py myVE

then your path is set in your home:

cd myVE/bin
./python
>>> import sys
>>> sys.path
['', '/home/foobar/temp/virtualenv-1.10.1/myVE/lib/python33.zip', '/home/foobar/temp/virtualenv-1.10.1/myVE/lib/python3.3', '/home/foobar/temp/virtualenv-1.10.1/myVE/lib/python3.3/plat-linux', '/home/foobar/temp/virtualenv-1.10.1/myVE/lib/python3.3/lib-dynload', '/usr/lib64/python3.3', '/usr/lib/python3.3', '/usr/lib/python3.3/plat-linux', '/home/foobar/temp/virtualenv-1.10.1/myVE/lib/python3.3/site-packages']
>>> 

Frequently Asked Questions