Vacassal Alsk
Vacassal Alsk

Reputation: 513

upgrade pip without root access

I am trying to use pip 8 in a super computer where I don't have root access. After downloading pip from:

https://pip.pypa.io/en/stable/installing/

I do:

myname@edison04:~/software/pip> python get-pip.py --prefix=~/local_python_lib/
Collecting pip
  Using cached pip-8.0.3-py2.py3-none-any.whl
Collecting wheel
  Using cached wheel-0.29.0-py2.py3-none-any.whl
Installing collected packages: pip, wheel
  Found existing installation: pip 1.5.4
    Uninstalling pip-1.5.4:
Exception:
Traceback (most recent call last):
  File "/tmp/tmplu5E1W/pip.zip/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/tmp/tmplu5E1W/pip.zip/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/tmp/tmplu5E1W/pip.zip/pip/req/req_set.py", line 725, in install
    requirement.uninstall(auto_confirm=True)
  File "/tmp/tmplu5E1W/pip.zip/pip/req/req_install.py", line 752, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/tmp/tmplu5E1W/pip.zip/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/tmp/tmplu5E1W/pip.zip/pip/utils/__init__.py", line 266, in renames
    shutil.move(old, new)
  File "/usr/common/usg/python/2.7.9/lib/python2.7/shutil.py", line 300, in move
    rmtree(src)
  File "/usr/common/usg/python/2.7.9/lib/python2.7/shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "/usr/common/usg/python/2.7.9/lib/python2.7/shutil.py", line 252, in rmtree
    onerror(os.remove, fullname, sys.exc_info())
  File "/usr/common/usg/python/2.7.9/lib/python2.7/shutil.py", line 250, in rmtree
    os.remove(fullname)
OSError: [Errno 13] Permission denied: '/global/common/edison/usg/python/2.7.5/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg/pip/__init__.py'
You are using pip version 1.5.4, however version 8.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

It tries to remove the already existing pip which I don't want to (and I don't have permissions to).... May I ask what can i do? Thank you.

A few more updates: adding --user does not help:

myname@edison04:~/software/pip> python get-pip.py --prefix=~/local_python_lib/ --user
ERROR: Can not combine '--user' and '--prefix' as they imply different installation locations
You are using pip version 1.5.4, however version 8.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

myname@edison04:~/software/pip> python get-pip.py  --user
Collecting pip
  Using cached pip-8.0.3-py2.py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-1.5.4
You are using pip version 1.5.4, however version 8.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

This installs pip-1.5.4 on some location, however I want to use pip 8.0.3 instead... Further more, when i locate the installed pip, and try to check their version... I think it just links my local bin to the pip 1.5.4 global bin

key01027@edison04:~> find . -name "pip"
./software/pip
./local_python_lib/pip
./.local/bin/pip
./.local/edison/2.7.9/lib/python2.7/site-packages/pip
./.local/edison/2.7.9/bin/pip
./.cache/pip
key01027@edison04:~> cd .local/
key01027@edison04:~/.local> cd bin/
key01027@edison04:~/.local/bin> ls
pip  pip2  pip2.7
key01027@edison04:~/.local/bin> ./pip --version
pip 1.5.4 from /global/common/edison/usg/python/2.7.5/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg (python 2.7)
key01027@edison04:~/.local/bin> ./pip2 --version
pip 1.5.4 from /global/common/edison/usg/python/2.7.5/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg (python 2.7)
key01027@edison04:~/.local/bin> ./pip2.7 --version
pip 1.5.4 from /global/common/edison/usg/python/2.7.5/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg (python 2.7)

What could I do? Thank you

further, using virtual env also does not solve this problem:

After set up the virtualenv, it also does not help...

(dev)key01027@edison08:~/software> which pip 
/global/homes/k/key01027/dev/bin/pip 
(dev)key01027@edison08:~/software> pip install --upgrade pip 
Cannot fetch index base URL https://pypi.python.org/simple/ 
Could not find any downloads that satisfy the requirement pip in /global/common/edison/usg/python/2.7.5/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg 
Downloading/unpacking pip 
Cleaning up... 
No distributions at all found for pip in /global/common/edison/usg/python/2.7.5/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg 
Storing debug log for failure in /global/homes/k/key01027/.pip/pip.log 

Upvotes: 1

Views: 2881

Answers (1)

Jason De Arte
Jason De Arte

Reputation: 555

Python Virtual Environments solve this problem by allowing you to segment off your project's dependencies from others on the same system.

Most locked down systems still provide virtualenv, if not - contact your system administrator.

http://docs.python-guide.org/en/latest/dev/virtualenvs/

https://pypi.python.org/pypi/virtualenv

Upvotes: 1

Related Questions