Closed rominf closed 4 years ago
I cannot reproduce.
Does it happen only with this package or with others as well?
Only with this package. It also happens if I add it manually and run update.
I honestly don't know why this happens and the debugging will be difficult since I cannot reproduce it on my end.
If you try to access https://pypi.org/pypi/aioauth2/json
directly does this happen as well?
If you try to access https://pypi.org/pypi/aioauth2/json directly does this happen as well?
Everything is fine. I can install the package with pip
too.
I have no idea then. Poetry does not do anything funny to access this url. It's using requests
with the cachecontrol
package.
The only thing "odd" here that I see is that you have Poetry installed in the same virtualenv as your project's. If you use an external poetry
installation does this still happen?
I've installed poetry
system-wide - the same result.
I have had a similar issue when running poetry -vvv add py-mini-racer
.
I see there is a redirect loop https://pypi.org/pypi/py_mini_racer/json
-> https://pypi.org/pypi/py-mini-racer/json
-> https://pypi.org/pypi/py_mini_racer/json
-> ...
Eventually, I "fixed" the issue by clearing the cache.
@sfermigier, how did you clear the cache?
I tried poetry cache:clear
but it asks for the name of a cache, and I have no idea what this means.
So I used rm -rf ~/Library/Caches/pypoetry/
(specific to MacOS, caches locations vary from OS to OS).
OK, thank you for info, @sfermigier!
@sfermigier / @rominf when it asks for the name of a cache, its referring to any additional repositories that you might've added. One name that is reserved is pypi
β― poetry cache:clear --all pypi
Delete 169 entries? (yes/no) [no] yes
If you had added some other repository, you could clear that repository's cache the same way.
I had the same issue with this pyproject.toml
: https://github.com/wemake-services/wemake-python-styleguide/blob/c32d3f08909157ef55ff19c9805e4e18734d6fd0/pyproject.toml
Cleaning cache helped.
I just ran into this issue with trying to install cherrypy -- in my case, I had 674 entries in my cache and running @metasyn's suggestion fixed the problem. π
I suspected clearing the cache might help (and it did), but, like others, I didn't know how to. Would it make sense for the error message when running poetry cache:clear --all
to list the available caches? That would have saved me, and perhaps others, a trip to the internet to solve this. Currently the error message is
[MissingArguments]
Not enough arguments
cache:clear [--all] [--] <cache>
I was thinking something along the lines of
[MissingArguments]
Specify which cache to clear. Available caches are: pypi.
cache:clear [--all] [--] <cache>
I suspected clearing the cache might help (and it did), but, like others, I didn't know how to. Would it make sense for the error message when running
poetry cache:clear --all
to list the available caches? That would have saved me, and perhaps others, a trip to the internet to solve this. Currently the error message is[MissingArguments] Not enough arguments cache:clear [--all] [--] <cache>
I was thinking something along the lines of
[MissingArguments] Specify which cache to clear. Available caches are: pypi. cache:clear [--all] [--] <cache>
@sdispater Are the available caches listed somewhere in the documentation?
I just had the same error when performing a poetry update
. One of the problems in diagnosing what's the cause, is that the error message does not mention which URL causes the redirects.
Clearing the cache with poetry cache:clear --all pypi
fixed the TooManyRedirects
error though.
Clearing cache didn't work for me on windows, neither did deleting ~/.cache/pip
My pyproject.toml
:
[tool.poetry.dependencies]
python = "^3.6"
django = "2.1.8"
djangorestframework = "~3.9.1"
mysqlclient = "1.4.1"
sqlalchemy = "~1.3.3"
pandas = "~0.24.1"
gunicorn = "~19.9.0"
gevent = "~1.4.0"
python-dateutil = "^2.7"
requests = "^2.20"
celery = "4.3.0"
django-celery-beat = "~1.4.0"
django-celery-results = "~1.0.4"
numpy = "~1.16.1"
django-otp = "0.5.2"
qrcode = "6.1"
schema = "0.7.0"
django-import-export = "1.2.0"
elastic-apm = "^4.2"
celery_once = "2.1.0"
supervisor = "~4.0.2"
[tool.poetry.dev-dependencies]
pytest-django = "^3.4"
pytest-cov = "^2.6"
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
poetry install
works for the above, I get TooManyRedirects when I try to update any package or a plain poetry update
, maybe a regression in 0.12.16? EDIT Its in 1.0.0a3 too EDIT2 After running the new cache clear cmd in 1.0.0a3 its ok now
Just ran into this with p4python.
I put in some traces inside of requests and the redirects were for changing the case in the URL https://pypi.org/pypi/p4python/json between p4python
and P4Python
Clearing the cache worked around the problem as well.
Just hit with factory-boy. Cache clear did the trick. I tried to debug the issue to find the root cause and came up empty - albeit I didn't spend a lot of time in it.
After digging for a while, some clues are found indicating the problem is likely caused by using cachecontrol with requests. Here's what happened:
session.get()
method was called with URL https://pypi.org/pypi/jupyter-core/json.Notes:
I made some debugging while going through #1019 and found out a similar issue with the redirections when a package has an "alias"
For newer versions of poetry (1.0.0a4):
poetry cache clear --all pypi
I also had this today, when installing only a few dependencies. I had poetry installed, with version 0.12.16
My pyproject.toml is
[tool.poetry]
name = "some-env-name"
version = "0.1.0"
description = ""
authors = ["Angus Hollands <goosey15@gmail.com>"]
license = "MIT"
[tool.poetry.dependencies]
python = "^3.7"
jupyter = "^1.0"
jupyterlab = "^0.35.4"
bqplot = {path = "bqplot"}
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
Clearing the cache resolved the error. Given that the bqplot here is a local library, I would expect that this error would have been reproduced if I had omitted it from pyproject.toml
How to do poetry cache clear --all pypi
without interactions?
the -n
flag probably takes the default output of no
so cache doesnt get cleared
i also encountered this with a poetry update
.
Also encountered with poetry update
pyproject.toml
[tool.poetry]
name = "my-project"
version = "0.9.7"
description = "some description."
authors = ["Foo Bar <foo@test.com>"]
[tool.poetry.dependencies]
python = "^3.6"
pip = "^19.2"
[tool.poetry.dev-dependencies]
coverage = "^4.5"
flake8 = "^3.7"
freezegun = "^0.3.12"
httpretty = "^0.9.6"
ipdb = "^0.12.1"
mccabe = "^0.6.1"
mock = "^3.0"
moto = "^1.3"
nose = "^1.3"
nose-timer = "^0.7.5"
nose-watch = "^0.9.2"
parameterized = "^0.7.0"
rednose = "^1.3"
sphinx = "^2.1"
sphinx-click = "^2.2"
sphinx-rtd-theme = "^0.4.3"
sure = "^1.4"
vcrpy = "^2.0"
pylint = "^2.3"
black = {version = "^18.3-alpha.0", allows-prereleases = true}
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
poetry cache clear --all pypi
dint help me. the problem disappeared when I updated poetry to 1.0.0b8
.
I haven't looked into it much, but there probably needs to be some logic to try skipping cachecontrol when a TooManyRedirects error is encountered.
This should be fixed in the latest 1.0.0
release. If a TooManyRedirects
error is encountered the cache will now be automatically cleared.
I still got this issue as for Poetry version 1.1.5
. Clearing cache helped.
I still get the issue even when clearing the cache. I can trigger this just by adding the airflow package on 1.1.5, and what happens is that one of the dependencies needed to be downloaded is SQLAlchemy that gets requested from pypi as sqlalchemy and then redirected to SQLAlchemy which gets redirected to sqlalchemy and so on.
In other words:
GET https://pypi.org/pypi/sqlalchemy/json
User-Agent: python-requests/2.25.1
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
301 Moved Permanently
<html>
<head>
<title>301 Moved Permanently</title>
</head>
<body>
<h1>301 Moved Permanently</h1>
The resource has been moved to /pypi/SQLAlchemy/json; you should be redirected automatically.
<body>
<html>
GET https://pypi.org/pypi/SQLAlchemy/json
User-Agent: python-requests/2.25.1
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
301 Moved Permanently
<html>
<head>
<title>301 Moved Permanently</title>
</head>
<body>
<h1>301 Moved Permanently</h1>
The resource has been moved to /pypi/sqlalchemy/json; you should be redirected automatically.
<body>
<html>
I still got this issue as for
Poetry version 1.1.5
. Clearing cache helped.
Yes I can confirm after updating poetry to 1.1.5 the issue persists
Computer is on windows 10 and even using the clear cache command the caches aren't properly cleared.
A quick and dirty fix is to remove the cache folder manually from
Had the same issue today on macOS. Removing ~/Library/Caches/pypoetry/
solved it.
Am also having this issue with poetry versions 1.1.4 and 1.1.5 on OSX. poetry cache:clear --all pypi
gives the following error on both versions as well:
The command "cache:clear" is not defined.
Removing ~/Library/Caches/pypoetry/cache
fixes for me.
The command is now cache clear
π
On Fri, 26 Mar 2021, 16:23 Will Ronchetti, @.***> wrote:
Am also having this issue with poetry versions 1.1.4 and 1.1.5 on OSX. poetry cache:clear --all pypi gives the following error on both versions as well:
The command "cache:clear" is not defined.
Removing ~/Library/Caches/pypoetry/cache fixes for me as well.
β You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/python-poetry/poetry/issues/728#issuecomment-808346685, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJQZHOH2I5G6JOG3ULL4ALTFSYGPANCNFSM4GJVCBCA .
To completely clear the pypi cache the command is:
poetry cache clear pypi --all
I am experiencing this issue trying to run a poetry update
on Poetry 1.1.5 as well.
This solution https://github.com/python-poetry/poetry/issues/728#issuecomment-451004596 still works for me, just change cache:clear
to cache clear
.
After clearing the cache, the update worked fine.
Same here with Poetry 1.1.5 version on Manjaro Linux:
$ poetry lock
Updating dependencies
Resolving dependencies... (3.2s)
TooManyRedirects
Exceeded 30 redirects.
at /usr/lib/python3.9/site-packages/requests/sessions.py:166 in resolve_redirects
162β except (ChunkedEncodingError, ContentDecodingError, RuntimeError):
163β resp.raw.read(decode_content=False)
164β
165β if len(resp.history) >= self.max_redirects:
β 166β raise TooManyRedirects('Exceeded {} redirects.'.format(self.max_redirects), response=resp)
167β
168β # Release the connection back into the pool.
169β resp.close()
170β
After running
$ poetry cache clear pypi --all
Delete 691 entries? (yes/no) [no] yes
poetry lock
was fixed.
I ran into this issue today, but no amount of cache clearing helped, not via poetry commands nor via manually deleting all cache folders.
It turns out that at this moment, pypi redirects infinitely between the json
and json/
of a package that is not found. (In our case, we have a private repo as secondary source, where up until recently it would figure out that pypi did not have it, and then try the secondary source).
In other words:
curl --head https://pypi.org/pypi/bleh-bleh-no-exist/1.11.6/json/
HTTP/2 301
location: /pypi/bleh-bleh-no-exist/1.11.6/json
and then:
curl --head https://pypi.org/pypi/bleh-bleh-no-exist/1.11.6/json
HTTP/2 301
location: https://pypi.org/pypi/bleh-bleh-no-exist/1.11.6/json/
Setting bleh-bleh-no-exist
's source explicitly in the pyproject.toml
:
bleh-bleh-no-exist = {version = "^1.11.6", source = "our-private-source"}
... did not help 100%. On the next poetry add ...
it ran into the same redirect with that exact same package. We ended up having to remove the secondary = true
from our private repo source.
(To debug this, I added a print()
statement right after the self._cache_control_cache.delete(self._base_url + endpoint)
line in poetry 1.1.13's pypi_repository.py
.).
@cpbotha check this: https://github.com/python-poetry/poetry/issues/5802#issuecomment-1149994614
@cpbotha So I came across this issue and simply clearing the poetry cache did not work. It might have been an additional factor, but what ultimately solved my problem was deleting the pip cache folder. This folder can with the command:
python -m pip cache dir
Per this stackoverflow answer, that folder defaults to:
# Unix
~/.cache/pip and it respects the XDG_CACHE_HOME directory.
# macOS
~/Library/Caches/pip
# Windows
<CSIDL_LOCAL_APPDATA>\pip\Cache
Clearing the cache didn't work for me. I think in my case could be related to this issue: https://github.com/pypa/warehouse/issues/11535
Yes, pypi currently has problems and it's not connected to any issue in poetry as far as I can tell.
https://status.python.org/incidents/lgpr13fy71bk?u=p19pcdp3t62p
Clearing all caches, including pip's did not work for me today, while trying to add "Sphinx" as a dependency, even on a new project:
> poetry --version
Poetry version 1.1.13
> poetry new caca
Created package caca in caca
> cd caca
> poetry add Sphinx # tried both upper and lowercase 'S' here
Creating virtualenv caca-nrFt8i4o-py3.9 in /home/nicoco/.cache/pypoetry/virtualenvs
TooManyRedirects
Exceeded 30 redirects.
at ~/.poetry/lib/poetry/_vendor/py3.9/requests/sessions.py:166 in resolve_redirects
162β except (ChunkedEncodingError, ContentDecodingError, RuntimeError):
163β resp.raw.read(decode_content=False)
164β
165β if len(resp.history) >= self.max_redirects:
β 166β raise TooManyRedirects('Exceeded {} redirects.'.format(self.max_redirects), response=resp)
167β
168β # Release the connection back into the pool.
169β resp.close()
170β
I am also struggling with this issue. i try poetry add django and it gives me TooManyRedirects
I am also struggling with this issue. i try poetry add django and it gives me TooManyRedirects
:exclamation: This is due to an incident with pypi: https://status.python.org/incidents/lgpr13fy71bk?u=p19pcdp3t62p
I faced with the same issue. Clearing caches didn't help.
Also having this issue, no amount of cache clearing, making new envs, reinstalling poetry, etc. works; happens on multiple machines in different domains; seems to be associated with specific packages, but not just a few - like half of them
Same here, apparently it should be done in an hour or so :/
Using this thread as a sub instead of the pypi tracker π
-vvv
option).Issue
I run
poetry add
and get this: