Skip to content
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

Google cloud storage needs requests >= 2.18.0 but the setup.py only requires >= 2.4.0 #3747

Closed
newt0311 opened this issue Aug 7, 2017 · 10 comments
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release.

Comments

@newt0311
Copy link

newt0311 commented Aug 7, 2017

According to the requests changelog the Response class was turned into a context manager only in version 2.18.0. However in google/resumable_media/requests/download.py line 62 (inside _write_to_stream) the code tries to use "response" as a context manager. Some digging reveals that this response makes its way from Client._http which is defined in google/cloud/client.py and gets the Response object from google/auth/transport/requests.py:AuthorizedSession.

So... it definitely feels like something in here needs to require requests >= 2.18.0 (maybe all of them?).

Thoughts?

Detailed info:

  1. OS type and version: N/A
  2. Python version and virtual environment information: 2.7 but I don't think it matters.
  3. google-cloud-python version: google-cloud-storage v 1.3.1
  4. Stacktrace if available: below.
  5. Steps to reproduce: Install a version of the requests library less than 2.18.0. Get some blob that exists. Try blob.download_as_string(). I personally re-pro'd this with version 2.10.0 to check. Note that the setup.py only requires 2.0.0 for storage and 2.4.0 for client, etc...

-- PG.

@lukesneeringer
Copy link
Contributor

lukesneeringer commented Aug 7, 2017

Aha, thanks for reporting @newt0311.

I had a theory that this might have been the root cause of #3736 as I said there this morning (although the subsequent pip freeze he gave shows requests 2.18). You are getting a different error, but I bet it is the same issue -- we are being too loose on our lower bound.

@lukesneeringer
Copy link
Contributor

@jonparrott @dhermes Any issue with bumping our minimum bound to 2.18.0?

@lukesneeringer lukesneeringer self-assigned this Aug 7, 2017
@lukesneeringer lukesneeringer added priority: p2 Moderately-important priority. Fix may not be included in next release. status: acknowledged labels Aug 7, 2017
@dhermes
Copy link
Contributor

dhermes commented Aug 7, 2017

  1. I have no issue with bumping the minimum bound
  2. I am so grateful to @newt0311 for putting in this legwork.

@theacodes
Copy link
Contributor

I have no issues with bumping the minimum bound.

@sonlac
Copy link
Contributor

sonlac commented Aug 7, 2017

@lukesneeringer Yes, thank you. It could be related to my issue #3736. I re-checked and the fact is that I used requests 2.12.3 (I forced it in my requirements.txt) which is required (> 2.0.0) by google-cloud 0.27.0

@dhermes
Copy link
Contributor

dhermes commented Aug 7, 2017

@sonlac That would certainly explain the lack of __exit__

@newt0311
Copy link
Author

newt0311 commented Aug 7, 2017

Oh yeah: that __exit__ AttributeError is what I was seeing on my end. I should have attached the stack trace. Must have slipped my mind (apologies). Anyway thanks for taking a look and for the fast fix.

-- PG.

Update: I only noticed this because I was running things on google-cloud-dataflow. I suspect people's local setups tend to be fairly up-to-date so bugs like this get masked...

@lukesneeringer
Copy link
Contributor

lukesneeringer commented Aug 8, 2017

@sonlac Yeah, the older version of requests was almost definitely your problem. I am super glad now that I wrote fauxquests back in the day, because I recognized the error immediately (which is why I asked you about it).

@lukesneeringer
Copy link
Contributor

I only noticed this because I was running things on google-cloud-dataflow. I suspect people's local setups tend to be fairly up-to-date so bugs like this get masked...

Yep. pip by default will do the newest it can, so it would only appear for people with an older version already installed in their virtualenv.

@sonlac
Copy link
Contributor

sonlac commented Aug 8, 2017

I only noticed this because I was running things on google-cloud-dataflow. I suspect people's local setups tend to be fairly up-to-date so bugs like this get masked...

Not always true. Sometimes, people fix google-cloud to a specific version in requirements.txt. So, pip tried to install the latest packages it can. For my case, I fixed google-cloud to 0.24.0 but pip installed google-cloud-storage 1.3.0 for all versions older than google-cloud 0.27.0. The fact that the google-cloud-storage 1.3.0 only works with google-cloud-core 0.26.0 (google cloud 0.27.0) https://github.com/GoogleCloudPlatform/google-cloud-python/releases/tag/storage-1.3.0. It's is something about "user-aware", so just be careful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release.
Projects
None yet
Development

No branches or pull requests

5 participants