You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
'HTTPResponse' object has no attribute 'strict' #7936
I am on the latest stable Poetry version, installed using a recommended method.
I have searched the issues of this repo and believe that this is not a duplicate.
I have consulted the FAQ and blog for any relevant entries or release notes.
If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.
Issue
AttributeError
'HTTPResponse' object has no attribute 'strict'
at ~/Library/Caches/pypoetry/virtualenvs/rubber-duck-py3.10/lib/python3.10/site-packages/cachecontrol/serialize.py:54 in dumps
50│ ),
51│ u"status": response.status,
52│ u"version": response.version,
53│ u"reason": text_type(response.reason),
→ 54│ u"strict": response.strict,
55│ u"decode_content": response.decode_content,
56│ }
57│ }
58│
I am not able to install or add packages and blocked significantly. I do not see this issue on internet. Am i using a wrong python version? this is the latest version of poetry , shall i revert?
Reacted by Claudio Verdú Ruiz, Guillaume Pellerin, Wendy Tang, Jye Lewis, Milad Khajavi, Joe Zeimen, 張泰瑋(Chang Tai Wei), Alexandra Ding, Konstantin, Kiran Patel and 36 more
Reacted by Facheng Guo, Shailendra Paliwal and ybyang
however since poetry requirements do not allow urllib3 2.0, this shows that you, or whatever you used to install poetry, have upgraded something that you should not have done
please close
Reacted by Marc LaBelle, Georgios Adzhygai, Pedro Coelho, Madhukar Holla, Jordan Whiteley, Daniil Shevelev, Adam Skluzacek, Stephanie Kirmer, 김진원, Tim Schäfer and 22 more
PS I do not know why you write here "I do not see this issue on internet." when, as I now see, you have already commented on that other issue
Reacted by Adam Skluzacek, Stephanie Kirmer, Tim Schäfer, José Seraquive, Gowtham R Raman, Taner Topal, Arpit Rana, Ptorioo, Brandon Kauffman, Joshua Bates and 9 more
Poetry has urllib3 pinned below 2.0, so you had to mess something up on your end (for example by installing your project and poetry into the same environment). In any case, this is not Poetry's fault.
Reacted by Kiran Patel, Niek Heinen and Erik Bjäreholt
Reacted by Marc LaBelle, Georgios Adzhygai, Pedro Coelho, Brandon, Tim Schäfer, Gowtham R Raman, Maciek, malicious, Joshua Bates, aaron and 3 more
Can be the case that you are still using poetry < 1.2; in that case you will need to pin urllib to < 2 because it was a dev dependency as you can see here.
Reacted by Artur Malinin, Marc LaBelle and danekantner
Can be the case that you are still using poetry < 1.2; in that case you will need to pin urllib to < 2 because it was a dev dependency as you can see here.
I surely confirm I am using latest version 1.4.2 in and out(global) of my virtual environment.
@aakashrshah I am having the same issue (this issue started to happen a couple days ago).
Would you mind if I ask you how did you "removed the line with strict in cache control", please?
@aakashrshah I am having the same issue (this issue started to happen a couple days ago).
Would you mind if I ask you how did you "removed the line with strict in cache control", please?
I had the same issue, and I fix it by deleting the terminal I was running it from and rerun it in another terminal.
It was a virtual environment issue for me.
Issue: I was debugging using a terminal which is running poetry virtual environment.
Fix: I deleted the terminal and create the new one that was on base environment and everything works fine.
I had the same problem when installing poetry in a virtual environment. I found that when running poetry install in a virtual environment, poetry still use outdated urllib3 and requests installed in the machine. So I tried to upgrade urllib3 and requests (outside of virtual environment) and it works.
I was about to fork Poetry and create a PR that adds the urllib3 = "^1.26.16" dependency to Poetry's pyproject.toml, but something tells me there's probably some recondite reason for the omission of the dependency? Or has just no one gotten around to adding it?
I was about to fork Poetry and create a PR that adds the urllib3 = "^1.26.16" dependency to Poetry's pyproject.toml, but something tells me there's probably some recondite reason for the omission of the dependency? Or has just no one gotten around to adding it?
Yes, there reason is that this bug is not present in Poetry anymore. This is only a case for non-standard installation which are discouraged.
Oh, thx! There must've been something nonstandard about my environment because I used mamba/conda for another project. But now I'm running into #8679 instead of this one. ^.^
To above all, why not check pip install poetry urllib3 requests --upgrade? I meet with this issue today when I run "poetry install", I can't downgrade urllib3 because other part of project lock the dependency version, and only upgrade those 2 like hungiito wrote won't work.
That's because I forgot to upgrade the most important poetry-1.4.1, and that version require urllib3<2.0.0,>=1.26.0
But now the latest version of poetry is 1.8.1, and everythings work fluently, don't need to manually edit any link in site-packages. Now what about try to upgrade those 3 package all?
@LaoshuBaby Have you tried upgrading urllib3 and requests outside of Poetry's virtual environment? In my case, I installed Poetry in a venv folder and noticed that Poetry uses the urllib3 in root environment rather than in venv directory
@LaoshuBaby Have you tried upgrading urllib3 and requests outside of Poetry's virtual environment? In my case, I installed Poetry in a venv folder and noticed that Poetry uses the urllib3 in root environment rather than in venv directory
@LaoshuBaby Have you tried upgrading urllib3 and requests outside of Poetry's virtual environment? In my case, I installed Poetry in a venv folder and noticed that Poetry uses the urllib3 in root environment rather than in venv directory
As @jeromegit wrote earlier, this is surely due to using Poetry 1.4.
Same error arose when we had to use conda (Azure ML Compute) as virtual environment manager (always try to avoid conda at any cost...). Then when one installs poetry on a freshly created conda environment using conda
conda install poetry
Poetry 1.4 is installed, by the same time downgrading urlib3 and requests.
Using pip to install Poetry solved the "issue", installing latest Poetry 1.8 without any downgrade
Activity
dimbleby commentedon May 16, 2023
this is psf/cachecontrol#292
however since poetry requirements do not allow urllib3 2.0, this shows that you, or whatever you used to install poetry, have upgraded something that you should not have done
please close
dimbleby commentedon May 16, 2023
PS I do not know why you write here "I do not see this issue on internet." when, as I now see, you have already commented on that other issue
Secrus commentedon May 17, 2023
Poetry has
urllib3pinned below 2.0, so you had to mess something up on your end (for example by installing your project and poetry into the same environment). In any case, this is not Poetry's fault.josumoreno-BP commentedon May 17, 2023
Can be the case that you are still using poetry < 1.2; in that case you will need to pin urllib to < 2 because it was a dev dependency as you can see here.
aakashrshah commentedon May 17, 2023
Good by me if we want to close it. Currently I removed the line with strict in cache control.
I tried it on python 3.10, 3.11 with latest poetry and latest pip.
I don’t know what did I mess up on my end.
Thanks though.
aakashrshah commentedon May 17, 2023
I surely confirm I am using latest version 1.4.2 in and out(global) of my virtual environment.
chanwutk commentedon May 17, 2023
@aakashrshah I am having the same issue (this issue started to happen a couple days ago).
Would you mind if I ask you how did you "removed the line with strict in cache control", please?
FachengG commentedon May 18, 2023
@chanwutk
Here is a solution for anyone faced similar problem:
use
Noneto replaceresponse.strict.Not sure about side-effect, but it will work again.
aakashrshah commentedon May 18, 2023
Hi @chanwutk
I deleted line 54
python3.10/site-packages/cachecontrol/serialize.py:54
chanwutk commentedon May 18, 2023
Thank you!!
Update poetry to 1.4.2
fix(poetry): pin urllib below version 2
21 remaining items
tew9 commentedon Aug 10, 2023
I had the same issue, and I fix it by deleting the terminal I was running it from and rerun it in another terminal.
It was a virtual environment issue for me.
Issue: I was debugging using a terminal which is running poetry virtual environment.
Fix: I deleted the terminal and create the new one that was on base environment and everything works fine.
hope that helps
ayub-kokabi commentedon Sep 14, 2023
I've deleted all poetry virtual environments and created a new virtual environment again, and the problem was resolved.
windows 11.
bramses commentedon Jan 4, 2024
For me, I had moved my folder with
poetryinto a subfolder later on and for some reason that broke everything.~/folder_afolder_ainto~/new_parent_folder/folder_apoetry add,poetry installetcstill not sure why. but when i moved it back to
~, it was fine again.hungiito commentedon Jan 13, 2024
I had the same problem when installing
poetryin a virtual environment. I found that when running poetry install in a virtual environment, poetry still use outdatedurllib3andrequestsinstalled in the machine. So I tried to upgrade urllib3 and requests (outside of virtual environment) and it works.In short
deactivate # deactivate virtual env (if activated) pip3 install --upgrade pip pip3 install --upgrade urllib3 requestsTelofy commentedon Feb 6, 2024
I was about to fork Poetry and create a PR that adds the
urllib3 = "^1.26.16"dependency to Poetry's pyproject.toml, but something tells me there's probably some recondite reason for the omission of the dependency? Or has just no one gotten around to adding it?Secrus commentedon Feb 6, 2024
Yes, there reason is that this bug is not present in Poetry anymore. This is only a case for non-standard installation which are discouraged.
Telofy commentedon Feb 6, 2024
Oh, thx! There must've been something nonstandard about my environment because I used mamba/conda for another project. But now I'm running into #8679 instead of this one. ^.^
LaoshuBaby commentedon Mar 1, 2024
To above all, why not check
pip install poetry urllib3 requests --upgrade? I meet with this issue today when I run "poetry install", I can't downgrade urllib3 because other part of project lock the dependency version, and only upgrade those 2 like hungiito wrote won't work.That's because I forgot to upgrade the most important poetry-1.4.1, and that version require urllib3<2.0.0,>=1.26.0
But now the latest version of poetry is 1.8.1, and everythings work fluently, don't need to manually edit any link in site-packages. Now what about try to upgrade those 3 package all?
♥
hungiito commentedon Mar 2, 2024
@LaoshuBaby Have you tried upgrading
urllib3andrequestsoutside of Poetry's virtual environment? In my case, I installed Poetry in avenvfolder and noticed that Poetry uses theurllib3in root environment rather than invenvdirectoryLaoshuBaby commentedon Mar 2, 2024
I did not specify a venv environment
hungiito commentedon Mar 3, 2024
Can you try upgrading both pip and poetry
LaoshuBaby commentedon Mar 3, 2024
@hungiito
I execute this command and upgrade everything to the latest, which can solve the problem originally raised by this issue.
You can do it without upgrading pip, but it will not cause problems if you upgrade it according to my test.
(In short, now my pip, requests, urllib3, and poetry are all up to date.)
That's why I recommend you upgrade(if you can) them.
ChrCoello commentedon Mar 5, 2024
As @jeromegit wrote earlier, this is surely due to using Poetry 1.4.
Same error arose when we had to use conda (Azure ML Compute) as virtual environment manager (always try to avoid conda at any cost...). Then when one installs poetry on a freshly created conda environment using conda
Poetry 1.4 is installed, by the same time downgrading
urlib3andrequests.Using pip to install Poetry solved the "issue", installing latest Poetry 1.8 without any downgrade
pip install poetrygithub-actions commentedon Apr 5, 2024
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.