0

I installed python 2.7 on mine shared host (it already had python 2.6 but they didnt want to upgrade it or install any packages) and pip. Configured PYTHONPATH and PATH in .bashrc. I dont have root access to this machine.

When I am checking sys.path with mine python installation it does not reference anywhere this shared location.

I checked commands:

which python
which pip

output:

/home/mgx/python27/bin/pip

and both provides me to mine installation but using

pip --version

output:

pip 1.1 from /usr/local/lib/python2.6/dist-packages/pip-1.1-py2.6.egg (python 2.6)

I can see that it using version from /usr/ not mine. How can I force it to use mine pip version? When I try to install with mine pip version by direct address it everything works but the short pip command is using wrong one. Also strange is that 'which' command show the good one...

Edit: output of cat $(which pip) and outputs of previous commands

#!/home/mgx/python27/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==1.4.1','console_scripts','pip'
__requires__ = 'pip==1.4.1'
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.exit(
        load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
    )
6
  • 2
    pip is usually just a trivial Python script that imports and runs the real code via pkg_resources. Can you cat $(which pip) and paste it here? In particular, does it have a shebang line that points to the wrong Python and/or uses env instead of pointing directly? Commented Nov 13, 2013 at 20:25
  • Posted in question. Hm.. this one is for sure right one as the shared host pip is in version 1.1. Commented Nov 13, 2013 at 20:40
  • 1
    OK, next possibility… Could the Python 2.6 site-packages and/or dist-packages be on your sys.path even in your Python 2.7? Run your Python and print sys.path to see. If it is, we need to figure out why and fix that. Commented Nov 13, 2013 at 20:50
  • No it's not... it is clearly running the version from 2.6 despite the fact which is saying otherwise... python is running all right. Using /home/user/python27/bin/pip is working correctly. Commented Nov 13, 2013 at 22:16
  • Next idea: Let's make sure that it's not something funky in your shell. Compare pip --version, $(which pip) --version, and env pip --version. Are they all wrong, or just one of them? Commented Nov 14, 2013 at 1:54

1 Answer 1

1

I think you may change your PATH variable so that your /home/mgx/python27/bin is searched first. Add the following line to you .bashrc and souce it afterward.

PATH=/home/mgx/python27/bin:$PATH

Then

source .bashrc

Or you could just alias pip in your .bashrc

alias pip='/home/mgx/python27/bin/pip'

I think this would fix it.

Sign up to request clarification or add additional context in comments.

4 Comments

Clearly this isn't the problem, or which python and which pip wouldn't give him the right information.
I think if he could paste here what $PATH maybe helpful.
PATH is like in this answer - export PATH=$PYTHONPATH:PATH and PYTHONPATH is /home/mgx/python27/bin.
Are you sure PATH is not changed somewhere else? What's the output of echo $PATH?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.