Frage

I'm trying to distribute a package by registering it to PyPI with an external download_url pointing to a bitbucket zip file. The setup file used can be found here. I package it using

$ python setup.py sdist register

However, pip or easy_install cannot find the package

$ pip install PyBlockWork
Downloading/unpacking PyBlockWork
  Could not find any downloads that satisfy the requirement PyBlockWork
Cleaning up...
No distributions at all found for PyBlockWork
Storing complete log in C:\Users\oreichri\pip\pip.log

The pip log file looks like this:

------------------------------------------------------------
C:\Python27\Scripts\pip-script.py run on 10/30/13 14:17:36
Downloading/unpacking PyBlockWork

  Getting page https://pypi.python.org/simple/PyBlockWork/
  URLs to search for versions for PyBlockWork:
  * https://pypi.python.org/simple/PyBlockWork/
  Analyzing links from page https://pypi.python.org/simple/PyBlockWork/
  Could not find any downloads that satisfy the requirement PyBlockWork

Cleaning up...

  Removing temporary dir c:\users\oreichri\appdata\local\temp\pip_build_oreichri...
No distributions at all found for PyBlockWork

Exception information:
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\basecommand.py", line 134, in main
    status = self.run(options, args)
  File "C:\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\commands\install.py", line 236, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "C:\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\req.py", line 1085, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "C:\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\index.py", line 265, in find_requirement
    raise DistributionNotFound('No distributions at all found for %s' % req)
DistributionNotFound: No distributions at all found for PyBlockWork

The download url is available and functional on https://pypi.python.org/pypi/PyBlockWork/0.1.0 but pip seems only to look at https://pypi.python.org/simple/PyBlockWork/ which contains no link. I guess something must be wrong in the setup.py file but I cannot figure what.

War es hilfreich?

Lösung

The long answer to this question lies in the PEP 438. The short answer is that distribution of python package through PyPi is in redefinition. By default, newly registered package are put in a mode where the "url" and the "download_url" are not visited anymore by pip. Also, links are not added automatically to the https://pypi.python.org/simple/[package_name]/ web pages. To revert to the old behavior, one can log in his/her PyPi account and in the "url" tab of his/her package select "As above but also ask tools to scrape Homepage and Download URL (slow!)" as hosting mode. Of course, this has many implications which can be appreciated by reading a bit on this topic. Reading the PEP 438 is a good place to start but for those wanting more information, here is also a good place to go.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top