29

I have a closed-source Python module I am developing and would like to share with people in my workplace. I have built a wheel via setup.py bdist_wheel with this setup.py file:

#!/usr/bin/env python

from setuptools import setup, find_packages

setup(name='mypkg',
      version='0.0.1',
      description='tools for work',
      author='tbhartman',
      packages=find_packages('src', exclude=['test*']),
      package_dir = {'':'src'},
      entry_points={
          'console_scripts':[
              'runtool = mypkg.run:main',
              ],
          },
      install_requires = ['argparse'],
      classifiers = [
          'Development Status :: 3 - Alpha',
          'Programming Language :: Python :: 2',
          ]
     )

I want to test the installation process, so I try pip install dist\mypkg-0.0.1-py2-none-any.whl and get the following traceback:

Exception:
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\pip\basecommand.py", line 139, in main
    status = self.run(options, args)
  File "C:\Python27\lib\site-packages\pip\commands\install.py", line 235, in run
    InstallRequirement.from_line(name, None))
  File "C:\Python27\lib\site-packages\pip\req.py", line 118, in from_line
    return cls(req, comes_from, url=url)
  File "C:\Python27\lib\site-packages\pip\req.py", line 43, in __init__
    req = pkg_resources.Requirement.parse(req)
  File "build\bdist.win32\egg\pkg_resources\__init__.py", line 2929, in parse
    reqs = list(parse_requirements(s))
  File "build\bdist.win32\egg\pkg_resources\__init__.py", line 2876, in parse_requirements
    "version spec")
  File "build\bdist.win32\egg\pkg_resources\__init__.py", line 2841, in scan_list
    raise ValueError(msg, line, "at", line[p:])
ValueError: ('Expected version spec in', 'dist/mypkg-0.0.1-py2-none-any.whl', 'at', '/mypkg-0.0.1-py2-none-any.whl')

Storing complete log in C:\Users\tbhartman\pip\pip.log

What is the problem and how to I fix it?

1
  • It appears that pip is trying to search from an index for mypkg-0.0.1-py2-none-any.whl, but it has trouble parsing that string to get a package/version. How do I tell pip to just use the wheel file, rather than searching for a package?
    – tbhartman
    Feb 13, 2015 at 16:30

2 Answers 2

48

I was using a very out-of-date version of PIP.

$ pip -V
pip 1.3.1 from C:\Python27\lib\site-packages (python 2.7)

I upgraded to pip 6.0.8 and all is well.

2
  • 7
    Just use pip install --upgrade pip to upgrade pip Apr 9, 2017 at 16:48
  • In very old versions, you may need to run python -m pip install --upgrade pip
    – Yonatan
    Jan 5, 2018 at 16:05
30

Using the Ubuntu 14.04 AMI on AWS, I found I had to upgrade setuptools:

sudo pip3 install -vU setuptools
1
  • Works like a charm. I had the same problem, this fixed it.
    – sebisnow
    Jun 8, 2016 at 7:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.