Reputation: 19114
I've written a small tool and uploaded to to pypi (here), but I can't download it using pip. Here is the pip log:
------------------------------------------------------------
c:\python32\scripts\pip-script.py run on 04/11/12 15:53:45
Downloading/unpacking undo
Getting page http://pypi.python.org/simple/undo
Could not fetch URL http://pypi.python.org/simple/undo: HTTP Error 301: Moved Permanently - Redirection to url '/simple/undo/' is not allowed
Will skip URL http://pypi.python.org/simple/undo when looking for download links for undo
Getting page http://pypi.python.org/simple/
Real name of requirement undo is undo
URLs to search for versions for undo:
* http://pypi.python.org/simple/undo/
Getting page http://pypi.python.org/simple/undo/
Getting page http://bitbucket.org/aquavitae/undo
Analyzing links from page http://pypi.python.org/simple/undo/
Skipping link http://bitbucket.org/aquavitae/undo (from http://pypi.python.org/simple/undo/); not a file
Could not parse version from link: https://bitbucket.org/aquavitae/undo/get/latest.tar.gz (from http://pypi.python.org/simple/undo/)
Skipping link https://bitbucket.org/aquavitae/undo/get/latest.tar.gz (from http://pypi.python.org/simple/undo/); wrong project name (not undo)
Could not find any downloads that satisfy the requirement undo
No distributions at all found for undo
Exception information:
Traceback (most recent call last):
File "C:\python32\lib\site-packages\pip\basecommand.py", line 104, in main
status = self.run(options, args)
File "C:\python32\lib\site-packages\pip\commands\install.py", line 245, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "C:\python32\lib\site-packages\pip\req.py", line 978, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "C:\python32\lib\site-packages\pip\index.py", line 157, in find_requirement
raise DistributionNotFound('No distributions at all found for %s' % req)
pip.exceptions.DistributionNotFound: No distributions at all found for undo
Can anyone see where I'm going wrong? I am behind a proxy, and I though that this might be the problem but pip has no issue with other packages, just this, so I assume I've somehow packaged it wrong.
Upvotes: 2
Views: 2277
Reputation: 76599
There are multiple problems: your tar file has not got the package name in it ( 'undo' not a substring of 'latest.tar.gz'); and pypi for some reason wanted to redirect (which does not seem to be normal, so I will not go into that).
Normally pip first looks at all the urls that match your package name, both on the home page and on the download pages pypi provides on http://pypi.python.org/simple/undo/ (assuming you specified both). Any url on those pages that has the project name in it is somewhere is analysed.
Several things make pip reject a url:
Skipping link http://bitbucket.org/aquavitae/undo (from http://pypi.python.org/simple/undo/); not a file
This url has undo in it but it is not pointing to a file.
Could not parse version from link: https://bitbucket.org/aquavitae/undo/get/latest.tar.gz (from http://pypi.python.org/simple/undo/)
There is no version number in latest.tar.gz
Skipping link https://bitbucket.org/aquavitae/undo/get/latest.tar.gz (from http://pypi.python.org/simple/undo/); wrong project name (not undo)
no project name undo
in the file component.
That things now work is because https://bitbucket.org/aquavitae/undo/downloads
is accessible and has 3 links with undo in the filename part in it and many, many links that don't. Use:
pip install undo --no-install --log undo.log
and look at the undo.log
file.
Please note that pip uses the function parse_versions from the pkg_resources (in dist_packages) to determine what is the newest version available. So even if you specify undo-1.1.tar.gz
explicitly as the the version on your pypi download link, if your homepage also points to newer version like undo-1.2-dev-20120614
the latter is taken as found.
Upvotes: 1
Reputation: 30384
Change setup.py
's download_url
to https://bitbucket.org/aquavitae/undo/get/undo-0.5.1.tar.gz.
Upvotes: 0
Reputation: 19114
I don't know whether its a bug in pip or deliberate, but once I opened up the bitbucket site it worked, despite the fact that the actual file it needed to download (and did download) is hosted on pypi. So if anyone else has this problem, the solution is to make sure that all links on the pypi page are accessible, even if they don't host the download file.
Upvotes: 0
Reputation: 6907
You may need to use a link ending in something like latest.tar.gz#egg=undo
Upvotes: 0
Reputation: 13251
The link to bitbucket in https works only when you are authenticated. Use http link on bitbucket instead.
(Same issue for both website / issue tracked links in the pypi page, i can't access to it without login first)
Edit: http link redirect to the login page, and after login, i got:
You do not have access to this repository.
Upvotes: 1