Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I have my pip user-installed package be preferred over system?

I would like to figure out a "fool-proof" installation instruction to put in the README of a Python project, call it footools, such that other people in our group can install the newest SVN version of it on their laptops and their server accounts.

The problem is getting the user-installed libs to be used by Python when they call the scripts installed by pip. E.g., we're using a server that has an old version of footools in /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/.

If I do python2.7 setup.py install --user and run the main entry script, it uses the files in /Users/unhammer/Library/Python/2.7/lib/python/site-packages/. This is what I want, but setup.py alone doesn't install dependencies.

If I (revert the installation and) instead do pip-2.7 install --user . and run the main entry script, it uses the old files in /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ – that's not what I want.

If I (revert the installation and) instead do pip-2.7 install --user -e . and run the main entry script, it uses the files in . – that's not what I want, the user should be able to remove the source dir (and be able to svn up without that affecting their install).


I could use (and recommend other people to use) python2.7 setup.py install --user – but then they have to first do

pip-2.7 install -U --user -r requirements.txt -e .
pip-2.7 uninstall -y footools

in order to get the dependencies installed (since pip has no install --only-deps option). That's rather verbose though.

What is setup.py doing that pip is not doing here?

(Edited to make it clear I'm looking for simpler+safer installation instructions.)

like image 556
unhammer Avatar asked Sep 03 '25 16:09

unhammer


1 Answers

Install virtualenvwrapper. I allows setting up separate python environments to alleviate any conflicts you might be having. Here is a tutorial for installing and using virtualenv.

Related:

  • https://virtualenvwrapper.readthedocs.org/en/latest/
like image 156
Aaron Digulla Avatar answered Sep 05 '25 05:09

Aaron Digulla