Unable to install package with custom pypi source
See original GitHub issue- I am on the latest Poetry version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).
- OS version and name: macOS 10.14.6 / docker image python:3.5
- Poetry version: 1.0.0
- Link of a
Gistrepository with the contents of your pyproject.toml file: https://github.com/ocavue/poetry_issue_celery
Issue
The steps to reproduce this bug is in the readme.
In short, I can’t install any package with a custom pypi source (https://pypi.douban.com/simple/). pip3 install celery -i https://pypi.douban.com/simple/
works find, so this should be a bug of poetry.
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (1 by maintainers)
Top Results From Across the Web
Why can't I install packages from PyPI with Pip? - Stack Overflow
When Pip only finds a "source package" on PyPI, and that source package contains native code, it tries to compile it, i.e. build...
Read more >Troubleshooting PyPI package installation | Cloud Composer
Locate the pip error in Cloud Build logs · In Google Cloud console, go to the Build history page. Go to Build history...
Read more >Error with pip install from PyPI in self hosted Gitlab - General
Prepare the following environment variables in your repo (Setting->CI/CD->Variables): PIP_URL, PIP_USERNAME, PIP_PASSWORD. Where PIP_URL is the ...
Read more >Installing Packages - Python Packaging User Guide - Python.org
This section covers the basics of how to install Python packages. ... It does not to refer to the kind of package that...
Read more >pip install - pip documentation v22.3.1
Install packages from: PyPI (and other indexes) using requirement specifiers. VCS project urls. Local project directories. Local or remote source archives.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@thomaszdxsn
I have already found the reason of this issue as my comments above. We need not more discussion about the reason.
If you just want to avoid this issue, your can use https://mirrors.aliyun.com/pypi/simple.
I did some little research. poetry use
requests.get()
to fetch packages from PyPI repository.request.get()
will follow 301 redirection by default. The reason that poetry can’t install packages from https://pypi.douban.com/ is that Douban server return 418 I’m a teapot. I guess that this is an anti-scraping logic.Use
curl
to visit pypi.douban.com. Get 301:Use
requests
to visit pypi.douban.com. Get 418:To avoid this
418
response, we can simply pass auser-agent
into the request header.Since adding a header in the request can fix this issue and I couldn’t see any disadvantage about this change, I can submit a PR to do it if you agree with me. @sdispater
Douban is one of the biggest Chinese companies that use Python as their main back-end language. The PyPI mirror their offer is very famous in the Chinese Python developer community.