7

I'm new to virtualenv (on windows). I'm trying to use pip (1.5) install a local wheel file, but it is failing.

The command is:

pip install --no-index -f C:/Users/<User>/Download openpyxl

In the pip.log, I can see where it finds the correct file, but then doesn't try to install it:

  Skipping link file:///C:/Users/<User>/Download/openpyxl-1.7.0-py2.py3-none-any.whl; unknown archive format: .whl

I have wheel (version 0.22) install globally as well as in the virtual environment. Any idea how I can get .whl to be a recognized format?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Brett Stottlemyer
  • 2,734
  • 4
  • 26
  • 38

2 Answers2

6

It appears wheel support is disabled.

Make sure that you have setuptools version 0.8 or newer installed, and that the use-wheel option is not set to false in $HOME/.pip/pip.conf.

Upgrading setuptools is easy enough if pip is already working:

pip install --upgrade setuptools

but note that older virtualenv versions can depend on older setuptools versions; you'll need to make sure that virtualenv is also up to date.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • "Requirement already up-to-date: setuptools" - global version is setuptools-2.0.2-py2.7.egg. So doesn't look like that is the problem. [edit] Tried upgrade both globally and in virtualenv [/edit] – Brett Stottlemyer Jan 06 '14 at 13:05
  • @BrettStottlemyer: The checked the `pip` source code; the archive format is only unrecognized if `use_wheel` is set to `False`; it is only set to `False` if `pip` did not find a setuptools new enough (it'll issue a warning), *or* if specifically disabled. – Martijn Pieters Jan 06 '14 at 13:08
  • @BrettStottlemyer: The fact that a direct install fails with a version spec parsing error is indicative that `pip` is not using the correct `setuptools` version, however. – Martijn Pieters Jan 06 '14 at 13:09
  • Odd. My virtual env has two setuptools folders in site-packages: "setuptools" and "setuptools-2.0.2-py2.7.egg-info". setuptools.pth has "./setuptools-0.6c11-py2.7.egg" in it, which doesn't exist. – Brett Stottlemyer Jan 06 '14 at 13:20
  • 1
    Did you have `distribute` installed at some point? It looks like some manual cleanup is required. – Martijn Pieters Jan 06 '14 at 13:23
  • Looks like the issue was virtualenv. I was on 1.9.1, and it looks like that installs the older setuptools. I upgraded to 1.11 and recreated the virtualenvs and now .whl is working. If you want to mention upgrade virtualenv, I would be glad to mark your answer correct. – Brett Stottlemyer Jan 06 '14 at 13:41
  • @BrettStottlemyer: Indeed; virtualenv versions do set a version dependency. Sigh; I wish they didn't do that. :-) – Martijn Pieters Jan 06 '14 at 13:45
  • 1
    This alone did not solve my problem. I finally made it work by `sudo pip install --upgrade pip`. – Yongwei Wu Jul 18 '16 at 10:39
3

I have bumped into the same problem with wheel when downloaded requirements with:

pip install --download /pip_mirror six django_debug_toolbar
dir2pi /pip_mirror/

and tried to install them with:

pip install six-1.7.3-py2.py3-none-any.whl

Even though there is no any config at $HOME/.pip/pip.conf and

$ easy_install --version
setuptools 5.4.1

I still get:

unknown archive format: .whl

I have managed to avoid the problem by adding --no-use-wheel like this, so got only tar.gz files (instead of .whl)

pip install --no-use-wheel --download /pip_mirror six django_debug_toolbar
dir2pi /pip_mirror/

After this pip install --index-url=file:///pip_mirror/simple/ six went without any problems

Kostyantyn
  • 5,041
  • 3
  • 34
  • 30