-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Poetry not always find latest version from PyPi #3543
Comments
This comment has been minimized.
This comment has been minimized.
I faced the same issue. The only way I found to get it to work is to clear the PyPI cache:
then run Resolving dependency can take several 100 seconds. |
I also had to update pip to get the latest
|
I call this art piece, "A portrait of a sad programmer". Note that it includes time stamps of me trying to install version 0.9.13 of a dep I just released. TL;DR is that the answer above works, but arriving there is painful:
Perhaps exiting the poetry shell will clear some cache?
OK, I'll give it a few minutes:
Arg. I guess I better google it. After finding this ticket:
Ahhhh. |
|
Also hit this today and the incantation posted above worked, thank you! This happened to a package of mine that I had just updated - and published to pypi using poetry. My poetry version is Edit: today I encountered the same issue with |
Also had this problem today... I wish only deleting the cache would solve the problem, that would be understandable.
|
This does not always work, either. |
This seems to be the only way out. |
I've run into this as well. Cache seems to be too aggressive. Maybe failure to find a solution can trigger a cache refresh? |
Just switched to poetry and I ran into this on my first day of using it. I agree that the cache should be wiped in case the package is not found. |
My storyYeah, I'm in total agreement that in the event of a solver error, poetry should rub cache and try again... however, I'm wondering if the actual issue is a bit more subtle - perhaps this points to a bug in the caching logic. At the time of writing (6 May 2022), I'm experiencing this solver error (click to expand) when `sphinx-charts==0.1.2` package has been published since 12 Feb 2022.
More to the point, I'm experiencing it while building a docker container. Why is that important? Because the starting image layer has no cache in the first place. Here's the dockerfile (click to expand).
It's the last I solved the issue by commenting out that last line, shelling into the container and doing as advised above:
If I then uncomment the
HypothesisI might be wrong, but I don't think anything online would have changed (e.g. the response from any query to pypi), because that last package was published months ago... So I'm wondering if to set off this sequence of events, I had made some mistake (or there was some other problem) that put my lockfile out of sync with I note that all of the solutions (eg from @kornpow and @kakyoism ) in this thread - with the exception of the trace provided by @mlissner - would also have refreshed any change in pyproject.lock, as well as refreshing the cache. @mlissner waited a few minutes, but his entire trace spanned <9 minutes and I don't know how long the cache expiry is in poetry but I bet it's at least 10 minutes, which would explain that experience. (possible) ConclusionMy suspicion is that to solve this:
|
I've just updated a library on pypi and tried to update it locally, but nothing except for cache clean solved the issue: After a cache clean and update it worked. hopefully this could be solved. |
|
Example with python 3.10.1 + poetry 1.1.12 https://pypi.org/project/libvcs/0.13.0a15/ pyproject.toml diff (bumped)
diff --git a/pyproject.toml b/pyproject.toml
index eb1b789..117e030 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -57,7 +57,7 @@ vcspull = 'vcspull:cli.cli'
python = "^3.9"
click = "~8"
kaptan = "*"
-libvcs = "~0.13.0a14"
+libvcs = "~0.13.0a15"
colorama = ">=0.3.9"
[tool.poetry.dev-dependencies] poetry update libvcs
pip install -U libvcs --pre
poetry update libvcs -vvv
|
This is pretty rough, would be nice if there was a |
@pbarker Agreed. @python-poetry: Is adding a |
AFAIK this was added in #5519 which got released in 1.2.0b2. |
I also have stumbled upon this issue. A couple of hours passed since I released a new version of a package on PyPI and still, Anyway, the point is: sometimes it's not However, |
Poetry requires rich metadata for each package; to get that we use the PyPI JSON API instead of the Simple HTML API (which would require us to download each package to extract metadata) -- what you're running into is the Fastly CDN layer that caches the JSON API. If it takes more than a few hours for your package to be visible through the JSON API, I'd suggest reaching out to the warehouse team by opening an issue on https://github.com/pypi/warehouse |
I have the same troubles, see: #4438 (comment) And yes, it seems that the real problem is not up-to-date JSON API in PyPi -> pypi/warehouse#11939 But poetry can add a fallback to the old "Simple HTML API" if the version is not found in PyPi JSON until pypi/warehouse#11939 is fixed?!? |
@neersighted I notice the
But in the meantime the user experience is that pip still works and poetry doesn't ... which is far from ideal. I'm not sure that it's just a CDN issue as the pypi/warehouse#11939 shows us that the JSON API is up to date for the pypi/{NAME}/{VERSION}/json endpoint, but out of date at the /pypi/NAME/json endpoint. Maybe a hybrid approach could work - using the "old Simple HTML API" to find the up-to-date versions, then the JSON API to get the metadata. Ugly yes, fragile, maybe but still much better downloading the packages and a quick fix for those in need? No word from the pypi/warehouse team about a fix or timeframe AFAIK? |
I'm really not sure how I feel about checking both APIs to see if they agree, or how we would express that to the user. Is the idea that during Seems like a fairly awful workaround (as in, the user can't do anything and it would be very invasive to make it consistent) for a known Warehouse issue with a (hopefully) finite shelf life... I'd love to hear more from users if people are getting bit by this frequently. |
Also after doing some more digging, it looks like the Simple API is suffering from this too, but less frequently -- it does look like it's simply a CDN issue, given some of the upstream debugging and pypi/warehouse#11935. |
@neersighted yeah I agree it's pretty ugly , but i thought I'd mention it anyway in case things get desperate. My project 'came right' after 24 hours or so. I've no idea if this was a simple timed retry thing, or a fix, or even an ops intervention as there's nothing on the ticket. |
This should now be resolved. |
At the server level, or should the stale JSON also be purged from Fastly? |
Entirely resolved. We have issued purges for all affected responses. |
I'm going to close this issue as we chose it as the grab bag for this round of issues. Next time Poetry is reporting inconsistent metadata vs pip we can open a new one. The original issue seems to have been a solver issue, but the OP long since went silent so I'm going to ask them to open a new issue if they encounter it again. |
Idk if we are still waiting for a push from Pypi, but it doesnt seem to be solved for me. I still can push |
You'll want to raise that with pypi, not here. |
Will do. The only reason why I bring it up here is @dl said everything is fixed, in this thread, and I confirmed everything is not fixed. |
Looks like we overlooked projects which had old releases but new files added after the bug was introduced. We're looking into purging these as well. |
I found a workaround. Solution:
JFYI, these files look like this: Filename: Content: |
For me the solution was to list all the caches, then clear them all: poetry cache list
poetry cache clear pypi --all
poetry cache clear PyPI --all
poetry cache clear _default_cache --all Yes, there was |
There was a change in naming across 1.1 and 1.2. If you want to be aware of data that is not cached you need to clear it. This only presents when a maintainer uploads new wheels after you have first solved for a package. |
|
It seems like this issue still persists... Pip can resolve the package, but poetry can not find it. Just removing the cache did not work. Only removing the package, cleaning the cache and reinstalling the package allowed poetry to find the correct version. |
Clearing the cache did not work in my case, but |
+1, also works with |
|
weird this ticket is closed. the ONLY decent workaround (aside from wiping the entire cache, which is absurd for a large project), is to use a venv. then you can pip install the package, then you can poetry update it... and everything works. the --no-cache operation can take 20 minutes for me, so it's a non-starter. |
Due I also got this problem and read this issue, I followed poetry suggestion and for me worked
|
Thanks! I sometimes needed to wait 10-20 minutes to be able to lock. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
-vvv
option).I have no idae with how poetry cache or pypi index works, hence this may be a not bug :)
Issue
Let's say I have two project named
p1
,p2
.p1
is published on pypi andp2
dependent onp1
.When a new version released for
p1
(let's say v2.0), I update dependentp1 = ">=2.0,<3.0"
to myp2
project.Then
poetry update
will complain:but
poetry run pip install p1==v2.0
works.If wait some time (about 5 ~30 minutes) after I release
p1
,poetry update
finally will works.PS: I DO NOT use pypi mirror.
The text was updated successfully, but these errors were encountered: