0

I have a virtual environment. Since a couple of days I cannot run any pip commands and am getting the error:

  File "env/bin/pip", line 7, in <module>
    from pip import main
  File "/env/lib/python2.7/site-packages/pip/__init__.py", line 15, in <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File "/env/lib/python2.7/site-packages/pip/vcs/subversion.py", line 9, in <module>
    from pip.index import Link
  File "/env/lib/python2.7/site-packages/pip/index.py", line 30, in <module>
    from pip.wheel import Wheel, wheel_ext
ImportError: No module named wheel

I have wheel in the site-packages and it was installed earlier. how do I resolve this? I cannot use any pip commands.

user3548288
  • 23
  • 2
  • 6
  • What version of `pip` is this? `pip -V`. – Martijn Pieters Feb 08 '16 at 07:52
  • Similar problems are usually caused when using different methods to manage python packages, i.e. pip and apt-get/yum. (And/or when messed with virtual environment and system Python packages.) I would suggest to get wheel module and install it with `easy_install` explicitly specifying the Python interpreter to use. – Nikita Feb 08 '16 at 07:58
  • @Nikita: this isn't an issue with the `wheel` package. The `pip` installation appears to be corrupted; e.g. `pip.index` tries to import `pip.wheel`, but the latter is missing. – Martijn Pieters Feb 08 '16 at 08:11
  • @Martijn You got it right. Even pip -v won't run! – user3548288 Feb 08 '16 at 08:21

1 Answers1

0

Your pip installation appears to be broken. It is not the wheel project that is the problem here, it is the pip.wheel package (part of pip itself) that fails to import; it looks like /env/lib/python2.7/site-packages/pip/wheel.py is either missing or has been corrupted somehow.

I'd reinstall pip at this point.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • pip seems to be working in a different virtual environment, just not with this one environment. – user3548288 Feb 08 '16 at 09:24
  • @user3548288: it is corrupted in this specific environment. `/env/lib/python2.7/site-packages/pip/` would normally contain a `wheel.py` file, but in your case that appears to be missing or otherwise broken. – Martijn Pieters Feb 08 '16 at 09:25
  • I just pasted wheel.py from other vitual env's pip folder to this virtual env's pip folder and it started working :D Thanks Martijn – user3548288 Feb 08 '16 at 09:56