Originally reported by: Flybeafd (Bitbucket: Flybeafd, GitHub: Unknown)
When I upgrade to setuptools==20.1.1,
pip install setuptools==20.1.1
pip install python-mimeparse
will raise `ImportError: No module named extern error.
➜ ~ pip install --no-cache-dir python-mimeparse
Collecting python-mimeparse
Downloading python-mimeparse-1.5.1.tar.gz
Could not import setuptools which is required to install from a source distribution.
Traceback (most recent call last):
File "/Users/user/.pyenv/versions/2.7.11/lib/python2.7/site-packages/pip/req/req_install.py", line 375, in setup_py
import setuptools # noqa
File "/Users/user/.pyenv/versions/2.7.11/lib/python2.7/site-packages/setuptools/__init__.py", line 11, in <module>
from setuptools.extern.six.moves import filterfalse, map
File "/Users/user/.pyenv/versions/2.7.11/lib/python2.7/site-packages/setuptools/extern/__init__.py", line 1, in <module>
from pkg_resources.extern import VendorImporter
ImportError: No module named extern
I test with setuptools==19.6.2, it has the same problems:
➜ ~ pip install setuptools==19.6.2
Collecting setuptools==19.6.2
Using cached setuptools-19.6.2-py2.py3-none-any.whl
Installing collected packages: setuptools
Found existing installation: setuptools 20.1.1
Uninstalling setuptools-20.1.1:
Successfully uninstalled setuptools-20.1.1
Successfully installed setuptools-19.6.2
➜ ~ easy_install -h
Traceback (most recent call last):
File "/Users/user/.pyenv/versions/2.7.11/bin/easy_install", line 7, in <module>
from setuptools.command.easy_install import main
File "/Users/user/.pyenv/versions/2.7.11/lib/python2.7/site-packages/setuptools/__init__.py", line 11, in <module>
from setuptools.extern.six.moves import filterfalse, map
File "/Users/user/.pyenv/versions/2.7.11/lib/python2.7/site-packages/setuptools/extern/__init__.py", line 1, in <module>
from pkg_resources.extern import VendorImporter
ImportError: No module named extern
It seems that setuptools drop Python 2.x support after 19.x(does not show in history page)? Or just I missing something?
Hello!
I've met this problem on MacOS. Are there any plans to fix this problem or somebody knows w/a for it?
Thanks in advance.
I apologize for not responding to the original post. It seems to have slipped through the cracks.
It seems that setuptools drop Python 2.x support.
Not at all. Setuptools declares and tests support for Python 2.6+. The continuous tests run against source and I've specifically run many late setuptools versions on Python 2.7 and 3.5 on a regular basis.
The problem is almost certainly that you have a corrupted environment (which can happen if you mix pip installs and either setup.py install or easy_install installs of setuptools).
You probably have a pkg_resources package around that still has an old version and doesn't have the necessary extern functionality. You'll need to inspect your environment and track down from where pkg_resources is being imported and why it doesn't have the extern package.
I can help answer questions as you investigate, but I'm going to close this ticket, as I don't believe there's anything setuptools can do to fix the apparent issue.
thanks for your comment!
I've investigate my environment
print json.dumps(sys.path, indent=2)
[
"",
......
"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python",
......
"/Library/Python/2.7/site-packages"
]
and found old "pkg_resources.pyc" file in another "sys.path" member (not "site-packages"):
$ll /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/ |grep pkg_resources
pkg_resources.py.OLD.1461747665.37
pkg_resources.pyc
after remove:
rm /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.pyc
all works fine!
Hi - I am not finding an old version of a pkg_resources.pyc on a MacBook OSX El Capitan install, only the one located at /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python. Is there anything else that you can suggest that will cause this module import error breaking the easy_install install?
What I end up doing was brew install python then pip install --upgrade pip setuptools for those running MacBook OSX El Capitan
Thx a lot for helping me to solve this problem ! @cukejianya
I also solved the same problem! Thanks!
Worked for me too (on Mac OSX Sierra). Thank you @cukejianya !
Most helpful comment
What I end up doing was
brew install pythonthenpip install --upgrade pip setuptoolsfor those running MacBook OSX El Capitan