Mac - Python - import error: "No module named site" - python

Tonight I am trying to get the package called "requests" installed and have begun fumbling around with the terminal and do not have very much intuition when it comes to this sort of thing.
Computer is a mac mini, osx version 10.9.4
In /Library/Python I have 4 folders: 2.3 2.5 2.6 and 2.7.
In /Applications I have "Python 2.7" and "Python 3.4"
I can open IDLE and type 8+8 and I get 16 just fine.
Here is the error I am getting in terminal:
host-210-117:~ Mario$ python
ImportError: No module named site
host-210-117:~ Mario$ pip
ImportError: No module named site
My goal is to run this command in the terminal:
pip install requests
I believe pip is already installed. I run the file "get-pip.py" in IDLE and this is what it says:
Requirement already up-to-date: pip in /Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg
Cleaning up...
This may have something to do with paths? I would appreciate some guidance/hints/tips, thanks!
Oh and just a little more info that might help solve this question. Here is the first few lines of the program I'm running:
import base64
import hmac
import json
import requests
import time
import urllib
import os
Which gives me this error in IDLE (so I guess it importing those first few packages with no problem?) :
>>>
Traceback (most recent call last):
File "/Users/Mario/Desktop/pyak/pyak.py", line 4, in <module>
import requests
ImportError: No module named requests
>>>
***** System path list:
sys.path
['/Users/Mario/Desktop/pyak', '/Users/Mario/Documents', '/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/Library/Python/2.7/site-packages']
*** another update:
host-210-117:~ Mario$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
*** a little more info (is this supposed to happen?)
host-210-117:~ Mario$ which pip
/usr/local/bin/pip
host-210-117:~ Mario$ pip
ImportError: No module named site
*** After changing .bashrc
.bashrc: here's what in the file
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
alias python=/Library/Python/2.7/python
here is the output of running:
pip install requests
host-210-117:~ Mario$ pip install requests
Downloading/unpacking requests
Downloading requests-2.4.1-py2.py3-none-any.whl (458kB): 458kB downloaded
Installing collected packages: requests
Cleaning up...
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1435, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 671, in install
self.move_wheel_files(self.source_dir, root=root)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 901, in move_wheel_files
pycompile=self.pycompile,
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 215, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 205, in clobber
os.makedirs(destdir)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/requests'
Storing debug log for failure in /Users/Mario/Library/Logs/pip.log

I met the same question, and error info is:
ModuleNotFoundError: No module named 'xxx'
and finally solved by
brew install python3
brew link python3
sudo python3 -m pip install xxx
// or `sudo python3 -m pip install -r requirements.txt`

From what I can tell you have three versions of Python on your system.
The one that comes with OSX /Library/Frameworks/Python.framework/Versions/2.7/
Python 2.7 from python.org /Library/Python/2.7/site-packages
Python 3.4 from python.org
pip is installed against the Python 2.7 version you downloaded (the one you see in your Applications folder), unfortunately the default Python for your shell is the one that's bundled with OSX, and there is no pip installed there.
IDLE is also bundled with the Python that you downloaded, which is why it keeps telling you that pip is installed, but it doesn't work from the shell.
Since you are probably using the Python downloaded from python.org as your "primary" Python (after all, its the one with IDLE that you are using), you need to set your shell environment to point to this Python as default.
The easiest way to do that is to add a variable in .bashrc that creates an alias python and points it to the right binary. To do that, add this line to /Users/yourusername/.bashrc - files with . are hidden by default, so you'll have to write the entire file name in the command line to open it. Add the following line:
alias python=/Library/Python/2.7/python
Save the file and then close all terminal windows and open it again. Now type pip and it should work correctly, and then you can proceed to installing requests.
For future reference, try to stick with one version of Python. I personally ignore the bundled version and use the one from brew, but you can stick to the Python downloaded from python.org.

I fixed mine with:
brew reinstall python
It fixed all my broken paths. I think I broke it with a broken brew package that had a wrong python version dependancy or something like that.

site.py is a standard module that is run by python by default. It allows tweaking sys.path and running some code before your code starts running. It should live in the standard library and can hardly be somehow absent. However, you can disable automatic importing of the module by passing -S switch to python.
Anyway, you should somehow inspect why the module can not be imported. Try to examine sys.path list.

You are trying to install the package in '/Library/Python/2.7/site-packages/requests' but it requires root permissions to do so. This should do the trick:
$ sudo pip install requests

I did some reading. The command line,
python3.10 -m pip install pandas
as long as you have the latest version of pip updated, this will install pandas to the specific python that you wanted otherwise it defaults to the latest version installed in my case Anaconda. You can change the python3.10 for your desired version of python to install too.

sudo easy_install pip
sudo pip install requests

Related

Install via pacman to specific version of Python

The default Python version for MSYS2 seems to be 3.8. I need to use 3.7 at the moment because I have to use PyInstaller and it is not currently compatible with 3.8 in MSYS2. I can download the earlier version of Python from http://repo.msys2.org/ and install it using pacman. With a fresh install of MSYS2 I run the following commands:
pacman -S glib2-devel
pacman -U python-3.7.4-1-x86_64.pkg.tar.xz
pacman -S python-pip
pacman -S python-setuptools
If I try to run a python script I am met with an error:
File "setup.py", line 15, in <module>
from setuptools import setup
ModuleNotFoundError: No module named 'setuptools'
This is due to the fact that everything installed after Python is actually installing in the default Python 3.8 location rather than 3.7:
C:\msys64\usr\lib\python3.8\site-packages
If I copy and paste the contents of site-packages into Python 3.7 and then try running a script I get the error:
File "setup.py", line 15, in <module>
from setuptools import setup
File "/usr/lib/python3.7/site-packages/setuptools/__init__.py", line 19, in <module>
from setuptools.dist import Distribution
File "/usr/lib/python3.7/site-packages/setuptools/dist.py", line 34, in <module>
from setuptools import windows_support
File "/usr/lib/python3.7/site-packages/setuptools/windows_support.py", line 2, in <module>
import ctypes
File "/usr/lib/python3.7/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ImportError: No such file or directory
Which is supposed to be resolved via libffi, which was installed prior to Python, but likely does not go to a location that 3.7 can recognize?
Is there a way to set a specific version of Python as the default in MSYS2? Perhaps a path that can be set in the .bashrc file? I tried to set PYTHONPATH in there to Python 3.7 but it didn't make a difference as to where the packages ended up being installed to.
Go to the following URL...
https://repo.msys2.org/msys/x86_64/
Look for the version of the package you need and download it. Use
pacman -U pkgname
To install it...
The reason I know this is because gcc11 on MSYS is non-functional... it produces programs which crash and say
"During startup your program exited with code..." mentioned here:
During startup program exited with code 0xc0000139
The only workaround is to downgrade to the previous compiler which does work or use clang, which was not an option for me.
Trying to use an old version of Python is probably possible, but I think it will be very difficult. You would need to make sure all the other installed packages are compatible.
I am using PyInstaller with Python 3.8 in MSYS2 without issues. I would recommend trying to work through any issues with that, instead of trying to use older versions of packages.

pip is not installing pyowm correctly for some reason

I am trying to install this package pyowm via pip. but it is not working for some reason. It is a ubuntu 16 VM. I have used pip to install other packages and it has all worked fine before so I am not sure why this one is having problems.
ubuntu#ip-172-31-22-187:~/.cache/pip$ pip install pyowm
Collecting pyowm
Installing collected packages: pyowm
Exception:
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/ubuntu/.local/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/home/ubuntu/.local/lib/python2.7/site-packages/pip/req/req_set.py", line 784, in install
**kwargs
File "/home/ubuntu/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/home/ubuntu/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/home/ubuntu/.local/lib/python2.7/site-packages/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/home/ubuntu/.local/lib/python2.7/site-packages/pip/wheel.py", line 316, in clobber
ensure_dir(destdir)
File "/home/ubuntu/.local/lib/python2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pyowm-2.5.0.dist-info'
As you can see it thinks I don't have the right permission. So I did this instead:
ubuntu#ip-172-31-22-187:/usr/local/lib/python2.7/dist-packages$ sudo -H pip install pyowm
Collecting pyowm
Installing collected packages: pyowm
Successfully installed pyowm-2.5.0
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
But when I try to call it this happens:
ubuntu#ip-172-31-22-187:~/.cache/pip$ python3
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyowm
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'pyowm'
>>>
So now I am very confused. pip says it did the job, but pyowm doesn't show up? The result is same for python 2.7 or 3.5.
And I can see that the pyowm stuff is there:
ubuntu#ip-172-31-22-187:/usr/local/lib/python2.7/dist-packages/pyowm$ pwd
/usr/local/lib/python2.7/dist-packages/pyowm
ubuntu#ip-172-31-22-187:/usr/local/lib/python2.7/dist-packages/pyowm$ ls
abstractions caches commons constants.py constants.pyc exceptions __init__.py __init__.pyc utils webapi25
And I did try to upgrade pip as well but this is what I got:
ubuntu#ip-172-31-22-187:/usr/local/lib$ pip install --upgrade pip
Requirement already up-to-date: pip in /home/ubuntu/.local/lib/python2.7/site-packages
ubuntu#ip-172-31-22-187:/usr/local/lib/python2.7/dist-packages/pyowm$ pip -V
pip 9.0.1 from /home/ubuntu/.local/lib/python2.7/site-packages (python 2.7)
So I am very very confused. I am at version 9.0.1, but why does the cmd output earlier show I am on version 8? Why do I suddenly need to sudo to install pyowm when yesterday I installed reportLab without needing sudo? Why after installing it with sudo I can't call on pyowm?
A very valid question!
I assume you're trying to install pyowm for Python 3. If so you need to use pip3. Ubuntu comes with Python 2.7 and 3.5.
For Python 2.*: use pip install pyowm.
For Python 3.*: use pip3 install pyowm.
pip3 does not come with linux by default, use sudo apt-get install pip3 to get it.
The permission problem is most likely caused from the fact that you may not be root, not to worry! You can use the command sudo to give you root permissions for the following command.
So to install pyowm, you'd use: sudo pip3 install pyowm. Take special note of the sudo.
As a bit of background, I tried the commands you used and got almost exactly the same errors. When I ran this it worked fine :)
Hope this helps!
Hi I know it's been 2 years, but hopefully this answer can help somebody.
You installed pyowm with sudo, and then tried to access it with your current user's installation of python3 instead of root user's python3.
If you do:
sudo pip3 install pyowm
Then to access your installed library you need to open the right python3 interpreter:
sudo python3 # this interpreter belongs to root user, and has pyowm installed.
AND NOT:
python3 # this interpreter belongs to a normal user, it doesn't have pyowm installed.
And finally, if you ever have permission issues with any directory, you can always give yourself permission if you have root user access.
Just do:
sudo chmod 777 <path_to_directory_where_you_want_permissions>
Now 777 is bad practice, but it's ok when you're messing around on your own computer. If you're on a deployed server or a work machine you'll want to find the right combination, may be 665 or 666.
In your case the command would be:
sudo chmod 777 /usr/local/lib/python2.7/dist-packages/
Also notice when you call pip instead of pip3 it invokes python2.7 and not python3! So if want python3, use pip3. This is linux specific. Most linux distributions follow this convention for python installations. On Windows I usually see just "python" mapped to the latest installation of python :)

Error using pelican-quickstart "No module named html_parser"

I decided to give pelican a try, but when I run pelican-quickstart, I get the following dialog:
$ pelican-quickstart
Traceback (most recent call last):
File "/usr/local/bin/pelican-quickstart", line 9, in <module>
load_entry_point('pelican==3.4.0', 'console_scripts', 'pelican-quickstart')()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 357, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2394, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2108, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/Library/Python/2.7/site-packages/pelican-3.4.0-py2.7.egg/pelican/__init__.py", line 20, in <module>
from pelican.generators import (ArticlesGenerator, PagesGenerator,
File "/Library/Python/2.7/site-packages/pelican-3.4.0-py2.7.egg/pelican/generators.py", line 23, in <module>
from pelican.readers import Readers
File "/Library/Python/2.7/site-packages/pelican-3.4.0-py2.7.egg/pelican/readers.py", line 24, in <module>
from six.moves.html_parser import HTMLParser
ImportError: No module named html_parser `
There was a similar error message in this post, and since I'm running Python 2.7.6 on OS X 10.10 (Yosemite), there may be a similar issue.
What's the best way to address this?
Reinstall Pelican doesn't help me, so I made a little fix in pelican
Modifications were made in following file
/Library/Python/2.7/site-packages/pelican/readers.py
at line 24 place
from six.moves import html_parser
instead of
from six.moves.html_parser import HTMLParser
and at line 299
class _HTMLParser(html_parser.HTMLParser):
instead of
class _HTMLParser(HTMLParser):
Modification actual for pelican 3.6.0, but seems to applicable for other version if search for this lines in readers.py file. This is just quick workaround, hope this problem will be solved at pelican's side.
This error seems to come from Python 2.7.6 on OSX. When I install python via Homebrew and reinstall this module I got rid of this error.
$ pip uninstall pelican
$ brew install python
$ which python # should show /usr/local/bin/python
$ python -V # should show Python 2.7.8
$ pip install pelican
I think that you've probably encountered with version conflict problem in module six.
Try sudo pip install virtualenv to create an isolate python environment.
start
create your pelican path mkdir /path/to/pelican
go to /path/to/pelican and create an isolate python environment with virtualenv venv
activate virtualenv source venv/bin/activate
install pelican under the venv(without sudo!) pip install pelican markdown
done
and now you are free to any problem mentioned above. all the dependencies in the venv are isolated from the global environment.
To quit the venv, type deactivate
I was running into the same error message.
six was also already installed, but an old version (1.4.1)
pip install six --upgrade
Installed six 1.10.0, which made pelican-quickstart finally work :)
You may need to install six.
if you're using pip, try
pip install six
and then restart pelican-quickstart

Please help a newbie install NLTK on Mac OS 10.5.8

I'm completely new to programming. I've been trying various ways to install NLTK on my Mac (running OS 10.5.8), and none of them is working. Please help! Here's what I've done so far.
Since at first I didn't realize that newer versions of Python required OS 10.6 or higher, I first tried to install the latest versions of both Python 3 and Python 2, but this obviously didn't work. I then cottoned on and found an older installation (the filename is python-2.7.6-macosx10.3.dmg), which installed successfully.
I then tried to follow the instructions on this page, which I copy below:
Install Setuptools: http://pypi.python.org/pypi/setuptools
Install Pip: run sudo easy_install pip
Install Numpy (optional): run sudo pip install -U numpy
Install PyYAML and NLTK: run sudo pip install -U pyyaml nltk
Test installation: run python then type import nltk
Steps 1 and 2 worked fine, but when I try steps 3 and 4, I get an error. The error is the same whether I try step 3 or step 4:
unknown0021E9E0E476:~ Tom$ sudo pip install -U numpy
Traceback (most recent call last):
File "/usr/local/bin/pip", line 8, in <module> load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 271, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 2173, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 1906, in loadentry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/Library/Python/2.5/site-packages/pip-1.4.1-py2.5.egg/pip/__init__.py", line 10, in <module>
from pip.util import get_installed_distributions, get_prog
File "/Library/Python/2.5/site-packages/pip-1.4.1-py2.5.egg/pip/util.py", line 17, in <module>
from pip.vendor.distlib import version
File "/Library/Python/2.5/site-packages/pip-1.4.1-py2.5.egg/pip/vendor/distlib/version.py", line 13, in <module>
from .compat import string_types
File "/Library/Python/2.5/site-packages/pip-1.4.1-py2.5.egg/pip/vendor/distlib/compat.py", line 276
return b''
^
SyntaxError: invalid syntax
I then found a different set of instructions on this page. It first has you install Xcode and MacPorts, which I did (again finding older versions compatible with 10.5.8). I got through the next few steps successfully: installed python27, made it the system default (sudo port select --set python python27), and installed the dependencies py27-numpy, py27-yaml, and py27-scipy. However, I can't install one needed package, py27-matplotlib. Here's what happens when I try:
unknown0021E9E0E476:~ Tom$ sudo port install py27-matplotlib
---> Computing dependencies for py27-matplotlib
---> Dependencies to be installed: py27-pyobjc-cocoa py27-pyobjc py27-six py27-tkinter tk Xft2 tcl xorg-libXScrnSaver xorg-scrnsaverproto py27-tornado py27-backports-ssl_match_hostname py27-backports
---> Staging py27-pyobjc into destroot
Error: org.macports.destroot for port py27-pyobjc returned: command execution failed
Error: Failed to install py27-pyobjc
Please see the log file for port py27-pyobjc for details:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-pyobjc/py27-pyobjc/main.log
Error: The following dependencies were not installed: py27-pyobjc-cocoa py27-pyobjc py27-six py27-tkinter tk Xft2 tcl xorg-libXScrnSaver xorg-scrnsaverproto py27-tornado py27-backports-ssl_match_hostname py27-backports
To report a bug, follow the instructions in the guide:
http://guide.macports.org/#project.tickets
Error: Processing of port py27-matplotlib failed
Without this package, I can't go on to install NLTK.
I've also tried installing NLTK in PyCharm, but that didn't work either: see this question. I'm at my wits' end here, so any help would be much appreciated!
ETA: Problem solved! I downloaded the tar.gz file from https://pypi.python.org/pypi/nltk and followed the install instructions in the package, and now I can import NLTK in the Python shell. Is it possible that I was simply trying to install things while in the wrong directory? (I'd still like to use NLTK in PyCharm, so answers to that question will still be welcome.)
Try installing the scipy package which includes matplotlib and numpy, I was a TA on a course where we used numpy and matplotlib quite a lot and using the scipy package to install was a solution for a lot of people.
The individual binary and source packages are available from: scipy docs
sudo port install py27-numpy py27-scipy py27-matplotlib py27-ipython +notebook py27-pandas py27-sympy py27-nose

Resolve pip/virtualenv fiasco after upgrading Python 2.5 to Python 2.6?

I upgraded Python 2.5 to Python 2.6 on my system and it's crapping out ( yeah, it's my fault but at least this isn't a high priority production server ). pip didnt work so I had to manually grab the latest pip which is compatible with Python 2.6.
I now have to use pip-2.6 as the command. Is there a way to make this override pip, which seems to be the reference to the 2.5 package? pip gives me this:
$ pip
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 2675, in <module>
parse_requirements(__requires__), Environment()
File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 552, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==0.7.2
I did a which pip which gives me:
/usr/local/bin/pip
If I vim into that, I see this:
#!/usr/bin/python2.6
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==0.8.3','console_scripts','pip'
__requires__ = 'pip==0.8.3'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('pip==0.8.3', 'console_scripts', 'pip')()
)
The other thing is, I did a pip-2.6 install -U virtualenv and invoking virtualenv used to work, but now the reference is gone..
$ which virtualenv
/usr/local/bin/virtualenv
$ virtualenv
-bash: /usr/bin/virtualenv: No such file or directory
Could anyone provide insight as to how I can map pip to pip-2.6 and how I can make virtualenv work?
I think the key was logging out or reloading my bash, because they seem to work perfectly now.
Reinstalling pip via easy_install solved the problem for me.
I had a nice pip/virtualenv/virtualenvwrapper environment set up and the upgrade to Ubuntu Natty caused those DistributionNotFound errors to be thrown. This is due to the Python version being updated I presume. Here is what fixed the problem for me:
run as root:
easy_install pip
pip install virtualenv
I ended up at this page because I wanted to upgrade the version of pip on my Lucid VPS 1 and also ended up having to use pip-2.6 as the command. Closing my PuTTY session then logging back in and reloading my bash worked for me, although it was probably just the restarting of the session that did the trick.
I did not want to use easy_install to reinstall pip as I am using Lucid and want the newer (Oneiric) version of Pip, the one that supports uninstall. Earlier, I had added support for manual downloads of lucid-backports 2, but linuxnoobishly was not able to figure out how to actually install the backported version. I decided to just do it using Curl.

Categories