Running the following command gives me the following error:
pip install pygame
Error Stack:
Traceback (most recent call last):
File "C:\Python34\lib\runpy.py", line 171, in _run_module_as_main
"__main__", mod_spec)
File "C:\Python34\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Python34\Scripts\pip.exe\__main__.py", line 5, in <module>
File "C:\Python34\lib\site-packages\pip\__init__.py", line 1, in <module>
from typing import List, Optional
ImportError: No module named 'typing'
Running this line in a Mac terminal fixed it for me:
/usr/local/opt/python#3.9/bin/python3.9 -m pip install --upgrade pip
I had the same issue. I also first tried the pip3 install pygame which was previously mentioned, before running this line. You may have to do that first. For the individual who said to try
pip install typing
that line of code will simply produce the same error. To fix it, you have to use to the aforementioned command(s).
I also ran into the same problem, because I made the foolish mistake of upgrading pip as suggested by Python.
I fixed this by downloading get_pip.py for python3.4 at https://bootstrap.pypa.io/pip/3.4/get-pip.py and running it:
python get_pip.py
It will automatically download the latest compatible version of pip (19.1.1 in this case).
Try to:
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
python get-pip.py
Do the following:
sudo apt update
sudo apt-get upgrade
If there is a problem, do:
sudo apt --fix-broken install
sudo apt-get upgrade
If there is still a problem, remove and recreate your venv. And Reinstall your requirements:
rm -rf venv
python3.9 -m venv venv
. venv/bin/activate
pip install -r requirements.txt
I encountered the same error on Ubuntu 20.04 when using python3.9, I tried to run sudo apt update && sudo apt upgrade.
The output advised me to run sudo apt --fix-broken install, which had solved my problem and python3.9 is running fine now.
I have also met this problem. Any command that starts with pip have the same error, ImportError: No module named 'typing'.
Finally, python -m pip install typing solved it.
I had this error using pip because my Ubuntu installation with Python 2.7 and Python 3.5 were crossed using the versions and pip.
My solution was to uninstall Python 2.7 and pip 2.7. I also uninstalled Python 3.5 and pip 3.
I then installed Python 3.7 using these directions: Installing the latest Python 3.7 on Ubuntu 16.04 and 18.04
I'm not sure if uninstalling 3.5 and adding 3.7 is necessary. You may just be able to remove 2.7 and be good, but this is what worked for me.
Try this one:
pip3 install pygame
It looks like you are importing from the package 'typing' but you do not have it installed. Try installing the package:
pip install typing
Related
I have installed pip for python 3.6 on Ubuntu 14. After I run
sudo apt-get install python3-pip
to install pip3, it works very well. However, after installation, when I am trying to run
pip3 install packagename
to install a new package, something strange occurs:
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 1479, in <module>
register_loader-type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module "importlib._bootstrap" has no attribute "SourceFileLoader"
It seems that I did nothing wrong, and I really cannot figure out the reason.
If you're getting this error running pip install dotenv, this is because the package is called python-dotenv not dotenv.
This worked for me:
sudo pip install python-dotenv
Faced the same problem. I think this is because python3.6 and pip3 were installed from different sources.
I suggest using python's inbuilt facility to install pip i.e
python3 -m ensurepip --upgrade
This should install pip3 and pip3.x where x in python3.x.
Same works for python2 also.
Tried to install Tensorflow in venv on Windows 10 machine with python 3.8 and got the same issue.
What helped for me was:
pip install setuptools --upgrade
I had the same problem on my ubuntu 18.04 with python 3.6. None of the above methods helped, but this one solved the problem:
pip3 uninstall setuptools
I had the same error whatever I asked to pip. I gave a look to this page: https://packaging.python.org/tutorials/installing-packages/
That line is the one that solved my problem:
python3 -m pip install --upgrade pip setuptools wheel
pip install setuptools --upgrade
This command solved my issue. It fixed my problem.
When updating from python3.4 to python3.6 on ubuntu 14.04. The following solved me:
wget https://bootstrap.pypa.io/ez_setup.py -O - | python3
If you face this issue in anaconda environment, simply upgrade setuptools using the following:
conda install -c conda-forge setuptools
That's because you are using an old version of setuptools, check up this issue.
I met the same problem, this is the key:
curl -sS https://bootstrap.pypa.io/get-pip.py | sudo python3
I had faced the same issue on Ubuntu 19.10 and now I upgraded to Ubuntu 20.04 and faced the issue again. This issue is due to broken pip3. So whenever you enter pip3 and hit enter it will show the same error. So instead of using "pip3 uninstall setuptools" use the below code
python3 -m pip uninstall setuptools
It resolved my issue 3rd time
I am facing the same problem, which is solved by downloading the source files of the setuptools and installing the module manually.
The setuptools can be downloaded here:
https://pypi.org/project/setuptools/
After downloading, unzip the package first, then cd to the directory and run
python setup.py install --user
For me the error happened while trying to create a virtual env with python 3.8:
sudo virtualenv venv -ppython3.8
And after trying all the answers here, finally the problem solved by installing the new version of virtualenv (20.0.7):
sudo pip3 install virtualenv
I encountered this error message triggered by a slightly different situation which I'll mention here for anyone who finds this.
This same error also occurs when installing the distribute Python package (which is currently just a compatibility layer in front of setuptools) in Python 3.6 or newer.
In my specific situation I discovered this as I was using pyzmail which has been somewhat abandoned and depends on distribute.
Collecting distribute
Downloading distribute-0.7.3.zip (145 kB)
ERROR: Command errored out with exit status 1:
command: /var/lang/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ssqyqflj/distribute/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ssqyqflj/distribute/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-hgbjn0js
cwd: /tmp/pip-install-ssqyqflj/distribute/
Complete output (15 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-ssqyqflj/distribute/setuptools/__init__.py", line 2, in <module>
from setuptools.extension import Extension, Library
File "/tmp/pip-install-ssqyqflj/distribute/setuptools/extension.py", line 5, in <module>
from setuptools.dist import _get_unpatched
File "/tmp/pip-install-ssqyqflj/distribute/setuptools/dist.py", line 7, in <module>
from setuptools.command.install import install
File "/tmp/pip-install-ssqyqflj/distribute/setuptools/command/__init__.py", line 8, in <module>
from setuptools.command import install_scripts
File "/tmp/pip-install-ssqyqflj/distribute/setuptools/command/install_scripts.py", line 3, in <module>
from pkg_resources import Distribution, PathMetadata, ensure_directory
File "/tmp/pip-install-ssqyqflj/distribute/pkg_resources.py", line 1518, in <module>
register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
I had the same issue when I tried to install the Slate package in Windows 10, Python 3.7.4 version:
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
The instruction that generated the error:
C:\WINDOWS\system32>python -m pip install slate
The instruction that worked:
C:\WINDOWS\system32>python -m pip install https://github.com/timClicks/slate/archive/master.zip
I had the same problem with my cloud computer. If all above didn't work for you don't worry. Here's how I resolved it:
Download the pip file (pip-version.tar.gz) from:
https://pypi.org/project/pip/#files
For cloud, use this
curl https://files.pythonhosted.org/packages/8e/76/66066b7bc71817238924c7e4b448abdb17eb0c92d645769c223f9ace478f/pip-20.0.2.tar.gz --output pip.tar.gz
Extract the content of the file and cd into the directory.
Run the following in the directory
python3 setup.py install --user
You should have pip3 working without errors.
pip3 install setuptools --upgrade
This also cured the issue on Python 3.9 running on Windows 10 and even on a custom Docker image.
I was having the same issue while using docker-compose. This exact error can be caused by not being the root user. Running the same commands with sudo fixed it for me. I don't not have setup-tools installed, and I'm running pip3. My issue was that IntelliJ didn't have sudo rights, so i had to do it from the terminal.
Above solutions were not working in my case for Ubuntu 20
If you run the following command:
sudo apt install python3-setuptools
Then you might get the result:
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-setuptools is already the newest version (45.2.0-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
But to actually solve it and re-install setuptools try following commands:
sudo apt download python3-setuptools
sudo dpkg -i python3-setuptools_45.2.0-1_all.deb
Note: Change the version of the python package that is downloaded
Traceback (most recent call last):
File "/usr/bin/pipenv", line 6, in <module>
from pkg_resources import load_entry_point
File "/home/myuser/.local/lib/python3.7/site-packages/pkg_resources.py", line
1479, in <module>
Mine looked pretty similar, but for some reason I had a python installation in my home directory .local folder.
I did some of the other answers in this thread to ensure I had good local copy of python, then did:
rm -rf ~/.local
Just go inside the /usr/lib/python3/dist-packages/, first copy setuptools file somewhere and then delete the setuptools. Everything will be okay for deleting you can use:
sudo rm -r setuptools
for copying
sudo cp -r setuptools /...Desktop/
After that if it gives errors just:
sudo pip3 install setuptools==3.8.1
to download again.
This question already has answers here:
ImportError: No module named pip
(31 answers)
Closed 10 months ago.
I can't use pip and I don't know why.
The error I get is shown below:
File "d:\python\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "d:\python\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "D:\Python\Scripts\pip.exe\__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'
If I try py -3.8 -m pip install I get
D:\Python\python.exe: No module named pip.
If I use get-pip nothing happens.
If I try to upgrade pip nothing happens.
Try
python -m ensurepip
This command activates pip.
Ref. https://docs.python.org/3/library/ensurepip.html
After this you can upgrade
python -m pip install --upgrade pip
I had the same problem. But in my case, when I was upgrading the pip version the new version stopped installing (upgrading) before the older version successfully uninstalled. After searching 4 or 5 sites I found:
python -m ensurepip
I was able to use the pip command and also this:
python -m pip install --upgrade pip
I don't know what OS you are using and what errors you got when using get-pip, but I had similar issue on Ubuntu20 and this solved it:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py --force-reinstall
Credit: #Benjamin's answer here: https://askubuntu.com/questions/1025189/pip-is-not-working-importerror-no-module-named-pip-internal
For Debian/Ubuntu/Linux Mint and derivatives users
Install pip using APT:
sudo apt install python3-pip
Try this
python -m pip install --upgrade pip
A suggestion, try to use anaconda or virtual env to avoid such issues.
I had the same problem, but found that python -m ensurepip just told me that the pip scripts were already installed. So what I did was delete the 2 pip directories under C:\Users\[user_id]\AppData\Local\Programs\Python\Python38\Lib\site-packages, then run python -m ensurepip again. That fixed it for me.
I tried to install a package through pip3, and I got this error. Every pip/pip3 command that I run gives me this error-
alexg#hitbox:~$ pip3 -V
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 7, in <module>
from pip import main
File "/home/alexg/.local/lib/python3.5/site-packages/pip/__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/home/alexg/.local/lib/python3.5/site-packages/pip/utils/__init__.py", line 27, in <module>
from pip._vendor import pkg_resources
File "/home/alexg/.local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3018, in <module>
#_call_aside
File "/home/alexg/.local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3004, in _call_aside
f(*args, **kwargs)
File "/home/alexg/.local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3046, in _initialize_master_working_set
dist.activate(replace=False)
File "/home/alexg/.local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2578, in activate
declare_namespace(pkg)
File "/home/alexg/.local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2152, in declare_namespace
_handle_ns(packageName, path_item)
File "/home/alexg/.local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2092, in _handle_ns
_rebuild_mod_path(path, packageName, module)
File "/home/alexg/.local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2121, in _rebuild_mod_path
orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'
I have tried running pip3 install --upgrade pip setuptools according to some answers, but every pip command gives me the error. I'm stuck and can't do anything.
What could have caused it, and how can this be fixed?
I'm on Ubuntu 16.04 with Python 3.5.2
I met the same issue with python 3.5.2 and pip3 (9.0.1). And I fixed it by following this workaround: https://github.com/pypa/setuptools/issues/885#issuecomment-307696027
More specifically, I edited line #2121~2122 of this file: "sudo vim /usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py"
#orig_path.sort(key=position_in_sys_path)
#module.__path__[:] = [_normalize_cached(p) for p in orig_path]
orig_path_t = list(orig_path)
orig_path_t.sort(key=position_in_sys_path)
module.__path__[:] = [_normalize_cached(p) for p in orig_path_t]
Upgrading setuptools worked for me:
pip3 install --upgrade setuptools
This may sound weird, because I had this issue and I had tried everything mentioned in SO and GitHub issues. But then I installed pip with easyinstall and pip command is working. Maybe now there are 2 pip packages now. But error is gone.
easy_install pip
I'm using virtualenv and upgrading setuptools didn't work for me. What did work was this workaround:
pip uninstall setuptools -y && pip install setuptools
Yet another answer, but following is the one which eventually fixed the issue for me. Since pip was compromised I was unable to use it for upgrading itself or setuptools and also using easy_install was bringing up the same issue. So I tried to install pip using Python.
The answer:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
pip install --upgrade setuptools
try -
pip install -U pip
pip install -U setuptools
if editing __init__.py doesnt help.
I tried most of the above suggested solutions but nothing worked as pip3 was totally non-functional, then I found this:
https://deeptalk.lambdalabs.com/t/trying-to-uninstall-tensorflow-or-matplotlib-pip-package-throws-attributeerror--namespacepath-object-has-no-attribute-sort/310
I think this is probably the issue with most of us. I tried the suggested solution and pip3 is working again.
For me the matplotlib was not present in dist-packages but instead it was in site-packages, so the command that worked for me was:
sudo rm ~/.local/lib/python3.5/site-packages/matplotlib-3.0.3-py3.5-nspkg.pth
ofcourse you need to change the above path based on your version and location of matplotlib.
This probably means that your dependencies got messed up.
Try to uninstall pip3 from scratch and it should work.
In case it doesn't work, delete your pip installation. In your case:
rm -r /home/alexg/.local/lib/python3.5/site-packages/pip/
And to be sure next time, best to work with virtual environments :)
Try :
sudo easy_install pip
and then
sudo easy_install setuptools
It probably happends because of messed-up dependencies.
I had the same problem using poetry.
Running
poetry run pip install --upgrade pip setuptools
instead of
pip install --upgrade pip setuptools
fixed the issue.
I had this same problem, and was unable to run any command with pip3 (including any commands like pip3 install --upgrade pip setuptools).
Only fix I've found was to completely uninstall and re-install python 3 (sudo apt-get remove python3, sudo apt-get install python3, sudo apt install python3-pip) and now pip3 is working properly again.
After trying all kinds of methods, such as reinstall pip, setuptools, and still can't fix the problem.
I follow the instruction of https://github.com/pypa/pip/issues/4216#issuecomment-286348680 and only with an external warning.
After that, I use pip to uninstall matplotlib.
Finally, all things seem okay.
I had this problem consistently (and used the workaround below to use pip in the python3 interpreter). To my surprise, after uninstalling all versions of numpy and reinstalling the latest one, pip began working again. I can't say for sure what happened, but it might be something to try if everything else has failed.
The workaround (pieced together from several sources I don't recall) is
start python3
import pip twice (getting an error the first time)
use pip.main within the interpreter
Here is a transcript:
>>> import pip
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py",
__import__(vendored_name, globals(), locals(), level=0)
ImportError: No module named 'pip._vendor.pkg_resources'
During handling of the above exception, another exception occurred
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 13,
from pip.exceptions import InstallationError, CommandError, Pi
File "/usr/lib/python3/dist-packages/pip/exceptions.py", line 6,
from pip._vendor.six import iteritems
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", l
vendored("pkg_resources")
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", l
__import__(modulename, globals(), locals(), level=0)
.
etc
.
AttributeError: '_NamespacePath' object has no attribute 'sort'
>>> import pip
>>> pkgs = ['asciiplotlib']
>>> pip.main(['install'] + pkgs + ['--upgrade'])
Collecting asciiplotlib
Using cached https://files.pythonhosted.org/packages/15/c5/46a2d
Installing collected packages: asciiplotlib
Successfully installed asciiplotlib-0.1.8
I fixed this with follows:
$curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
For python2:
$python get-pip.py
For python3:
$python3 get-pip.py
Now it works for me.
None of the other posted answered worked for me, but running the follow command solved t:
sudo apt-get purge --auto-remove python3-pkg-resources python3-setuptools
This is for windows users, who installed WinPython
We couldn't even run pip command. Uninstall and install of Anaconda 3
We faced similar error. Finally we removed folder "Python" which is inside C:\Users\you\AppData\Roaming\ and removed folder "conda" & "packages" which is inside C:\Users\you\AppData\Roaming\conda.
Then it worked.
I'm getting this error when trying to install any package with pip. I have two pip instances, one with Python 2.7 and other with Python 3.
Could not import setuptools which is required to install from a source distribution.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 375, in setup_py
import setuptools # noqa
File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 11, in <module>
from setuptools.extern.six.moves import filterfalse, map
File "/usr/local/lib/python2.7/dist-packages/setuptools/extern/__init__.py", line 1, in <module>
from pkg_resources.extern import VendorImporter
ImportError: No module named extern
Even when I try to install the 'extern' module I get this error. Also when installing with Python itself, like python setup.py install.
Thanks in advance.
sudo apt-get purge python-pkg-resources
sudo apt-get -f install
here actually packages are removed and
purged (any configuration files are deleted too).
-f : Attempt to correct a system with broken dependencies in place.
sudo pip install packagename
#sourcehere
Do this it will work
sudo pip install -U setuptools
I know this is an old thread, but I just wanted to contribute since I ran into this issue and this thread kept coming up in the results.
Note: This was on MacOS 10.12. My shell is zsh and I already have brew installed
First I ran each of these commands
brew install python
brew install python3
This will either install it or you'll receive an "already installed" message as I did.
Next, run the following command
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
And last:
sudo python get-pip.py
Final note: for my install to work, I ended up having to run the command with pip3
sudo pip3 install nameofinstallhere
Not sure whether it is installation issue or packege but it seems like you will not be able to import any package of them, if you have installed python perfectly then
try this commands
step 1 :
$which pip
/usr/local/bin/pip
step 2 :
/usr/local/bin/pip install django
or any of your package name.
I am considering ubuntu(OS)
You can try the following command; it has worked for me:
sudo apt-get install --reinstall python-setuptools
Whenever i try to use pip I get an error. For exampple:
$ sudo pip install gevent-websocket
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2675, in <module>
parse_requirements(__requires__), Environment()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 552, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==0.8.1
I feel tempted to change the value of into pip==0.8.2.. but I dont feel dealing with the consequences of 'hacking' up my installation...
I'm running python 2.7 and pip is at version 0.8.2.
I find this problem in my MacBook, the reason is because as #Stephan said, I use easy_install to install pip, and the mixture of both py package manage tools led to the pkg_resources.DistributionNotFound problem.
The resolve is:
easy_install --upgrade pip
Remember: just use one of the above tools to manage your Py packages.
I replaced 0.8.1 in 0.8.2 in /usr/local/bin/pip and everything worked again.
__requires__ = 'pip==0.8.2'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('pip==0.8.2', 'console_scripts', 'pip')()
)
I installed pip through easy_install which probably caused me this headache.
I think this is how you should do it nowadays..
$ sudo apt-get install python-pip python-dev build-essential
$ sudo pip install --upgrade pip
$ sudo pip install --upgrade virtualenv
I had this issue when I was using homebrew. Here is the solution from Issue #26900
python -m pip install --upgrade --force pip
Try re-installing with the get-pip script:
wget https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py
This is sourced from the pip Github page, and worked for me.
If you're on CentOS make sure you have the YUM package "python-setuptools" installed
yum install python-setuptools
Fixed it for me.
The root of the problem are often outdated scripts in the bin (Linux) or Scripts (Windows) subdirectory. I'll explain this using problem I encountered myself as an example.
I had virtualenv version 1.10 installed in my user site-packages (the fact it's in user site-packages not sytem site-packages is irrelevant here)
pdobrogost#host:~$ which virtualenv
/home/users/pdobrogost/.local/bin/virtualenv
pdobrogost#host:~$ virtualenv --version
1.10
After I upgraded it to version 1.11 I got the following error:
pdobrogost#host:~$ virtualenv --version
Traceback (most recent call last):
File "/home/users/pdobrogost/.local/bin/virtualenv", line 5, in <module>
from pkg_resources import load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2701, in <module>
return self.__dep_map
File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 572, in resolve
if insert:
pkg_resources.DistributionNotFound: virtualenv==1.10
File /home/users/pdobrogost/.local/bin/virtualenv mentioned in the error message looked like this:
#!/opt/python/2.7.5/bin/python2.7
# EASY-INSTALL-ENTRY-SCRIPT: 'virtualenv==1.10','console_scripts','virtualenv'
__requires__ = 'virtualenv==1.10'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('virtualenv==1.10', 'console_scripts', 'virtualenv')()
)
There, we see that virtualenv script was not updated and still requires previously installed version 1.10 of virtualenv.
Now, reinstalling virtualenv like this
pdobrogost#host:~$ pip install --user --upgrade virtualenv
Downloading/unpacking virtualenv from https://pypi.python.org/packages/py27/v/virtualenv/virtualenv-1.11.1-py27-none-any.whl#md5=265770b61de41d34d2e9fdfddcdf034c
Using download cache from /home/users/pdobrogost/.pip_download_cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fpy27%2Fv%2Fvirtualenv%2Fvirtualenv-1.11.1-py27-none-any.whl
Installing collected packages: virtualenv
Successfully installed virtualenv
Cleaning up...
does not help (neither pip install --user --upgrade --force-reinstall virtualenv) because script /home/users/pdobrogost/.local/bin/virtualenv is left unchanged.
The only way I could fix this was by manually removing virtualenv* scripts from /home/users/pdobrogost/.local/bin/ folder and installing virtualenv again. After this, newly generated scripts refer to the proper version of the package:
pdobrogost#host:~$ virtualenv --version
1.11
I was able to resolve this like so:
$ brew update
$ brew doctor
$ brew uninstall python
$ brew install python --build-from-source # took ~5 mins
$ python --version # => Python 2.7.9
$ pip install --upgrade pip
I'm running w/ the following stuff (as of Jan 2, 2015):
OS X Yosemite
Version 10.10.1
$ brew -v
Homebrew 0.9.5
$ python --version
Python 2.7.9
$ ipython --version
2.2.0
$ pip --version
pip 6.0.3 from /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-6.0.3-py2.7.egg (python 2.7)
$ which pip
/usr/local/bin/pip
I was facing the similar problem in OSx. My stacktrace was saying
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: setuptools>=11.3
Then I did the following
sudo pip install --upgrade setuptools
This solved the problem for me. Hope someone will find this useful.
On Mac OS X (MBP), the following (taken from another answer found herein) resolved my issues:
C02L257NDV33:~ jjohnson$ brew install pip
Error: No available formula for pip
Homebrew provides pip via: `brew install python`. However you will then
have two Pythons installed on your Mac, so alternatively you can:
sudo easy_install pip
C02L257NDV33:~ jjohnson$ sudo easy_install pip
Clearly the root cause here is having a secondary method by which to install python (in my case Homebrew). Hopefully, the people responsible for the pip script can remedy this issue since its still relevant 2 years after first being reported on Stack Overflow.
I had this problem because I installed python/pip with a weird ~/.pydistutils.cfg that I didn't remember writing. Deleted it, reinstalled (with pybrew), and everything was fine.
In my case (sam problem, but other packages) there was no version dependency. A sequence of pip uninstall and pip insstall did help.