AttributeError: 'module' object has no attribute 'python_implementation' running pip
Asked Answered
E

6

17

I installed Cygwin with Python set-up tools. When I try to run pip install awscli I get the following error:

$ pip install awscli
Traceback (most recent call last):
  File "/usr/bin/pip", line 8, in <module>
    load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
  File "build/bdist.linux-i686/egg/pkg_resources.py", line 318, in load_entry_point
  File "build/bdist.linux-i686/egg/pkg_resources.py", line 2221, in load_entry_point
  File "build/bdist.linux-i686/egg/pkg_resources.py", line 1954, in load
  File "/usr/lib/python2.5/site-packages/pip-1.5.4-py2.5.egg/pip/__init__.py", line 9, in <module>
    from pip.log import logger
  File "/usr/lib/python2.5/site-packages/pip-1.5.4-py2.5.egg/pip/log.py", line 9, in <module>
    from pip._vendor import colorama, pkg_resources
  File "/usr/lib/python2.5/site-packages/pip-1.5.4-py2.5.egg/pip/_vendor/pkg_resources.py", line 1112, in <module>
    class MarkerEvaluation(object):
  File "/usr/lib/python2.5/site-packages/pip-1.5.4-py2.5.egg/pip/_vendor/pkg_resources.py", line 1120, in MarkerEvaluation
    'python_implementation': platform.python_implementation,
AttributeError: 'module' object has no attribute 'python_implementation'

Am I missing something in my path or is my Python implementation hosed?

Eadwine answered 16/3, 2014 at 15:9 Comment(1)
Try to download the module from github and run python setup.py install.Apostolate
R
19

Do you have a folder called "/platform" inside your python app?

If you do, it will scope-shadow the native python "platform" module. When modules you're using try to get information about the system, they'll get a null object back. This will often cause errors like:

AttributeError: 'module' object has no attribute 'version'

AttributeError: 'module' object has no attribute 'machine'

AttributeError: 'module' object has no attribute 'python_implementation'

Simply rename the "/platform" folder to something else to resolve the problem.

Rhyolite answered 9/12, 2014 at 23:55 Comment(4)
I had a file named platform and this helped me. Thanks !Clarey
Crazy. My script was called platform.py because that was a very reasonable name for what I was creating; but apparently that name is verboten.Lice
Life saved. Thank youCrossbreed
Damn, that's crazy. This was a nightmare to debug, but yes, do not name your stuff "platform".Gallican
P
7

Re-installing pip might fix it, try it using easy_install:

sudo easy_install pip

Pentagrid answered 21/3, 2014 at 22:27 Comment(0)
D
4

Do you have a folder called "/platform" inside your python app? GOT THE POINT! I remove my own platform.py, it still not work. later i remove the remained platform.pyc ,it worked!

Doubletime answered 27/2, 2015 at 1:59 Comment(2)
So, are you recommending they remove platform.pyc?Shope
yes, when running ”import platform“, it first of all find platform.pyc, if exists, it will run directly. if not, it will compile and generate platform.pyc and then run it. so if you don't want to overwrite python's platform.py you should clear all of them.Doubletime
G
1

Similar to what others have posted, I got the same error from having a platform.py file (rather than directory). I renamed it and the error went.

Galla answered 11/2, 2020 at 13:45 Comment(0)
N
0

I got this error when my .virtualenvs folder for a linux (fedora) system was symlinked to a Network shared drive (on a Windows server). Upgrading the system pip

sudo pip install --upgrade pip

And then creating a new ~/.virtualenvs/ locally with a fresh virtualenv did the trick for me.

Neap answered 24/3, 2015 at 1:14 Comment(0)
S
0

I'll add another name to the list: I had a script named profile.py in the startup directory that was causing the same problem.

Strangely enough, I thought I might have had a file called platform.py in the directory. I use Python in the manufacture of turbine blades, which have features we call 'platforms'. They also have a 'profile' (the airfoil leading edge profile, to be exact), and when I saw profile.py a light bulb went off, as I was aware of Python's 'profile' module from the Standard Library.

Funny how this never came up before - I've been using IPython since ~Python2.7.9, and there wasn't even a problem back in the 3.6 days (I'm upgrading to 3.8.6).

Scow answered 5/12, 2020 at 0:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.