Reputation: 385
I'm trying to install some packages with pip on a computer where I do not have root access. I'm running into some problems with the dependencies. Basically, I install a package 1:
cd path/to/package1
pip install . --install-option="--prefix=path/to/my/install/dir"
but when I try to install package 2:
cd path/to/package2
pip install . --install-option="--prefix=path/to/my/install/dir"
It cannot find package 1. How do I set the directory where it looks for dependencies?
Upvotes: 0
Views: 662
Reputation: 385
This doesn't really answer the question but does fix the underlying problem --- installing using
pip install . --user
installs everything in a local directory that pip knows to look in.
Upvotes: 0
Reputation: 12845
Try to use virtualenv - it makes package management right.
This way, you first create virtualenv:
$ virtualenv aaa
Using base prefix '/Users/el/.pyenv/versions/3.5.1'
New python executable in /Users/el/tmp/aaa/bin/python3.5
Also creating executable in /Users/el/tmp/aaa/bin/python
Installing setuptools, pip, wheel...done.
then
$ source aaa/bin/activate
This sets environment variables and all new installations pip
will do in this folder.
When you finish work with it, just do:
$ deactivate
Now you exited from virtualenv to usual "system" one.
As a result:
You may easily fix modules versions with pip freeze > requirements.txt
. Now this file contains all modules with pinned versions in easy format:
appdirs==1.4.0
packaging==16.8
pyparsing==2.1.10
six==1.10.0
You may recreate this environment from scratch, just using:
$ virtualenv folder
$ source ./folder/bin/activate
$ pip install -r requirements.txt
Upvotes: 2