Skip to content

FIX: fix reading from http/https urls via imread #18185

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

Merged
merged 4 commits into from
Aug 11, 2020

Conversation

tacaswell
Copy link
Member

PR Summary

Uses the suggested fix of @tdpetrou .

closes #18129

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant

@tacaswell tacaswell added this to the v3.3.1 milestone Aug 5, 2020
@tacaswell
Copy link
Member Author

Fixed and squashed.

closes matplotlib#18129

Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
@tacaswell
Copy link
Member Author

fix and squashed again.



@pytest.mark.network
@pytest.mark.flaky
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could run python -m http.server in the background to get an always-available server that doesn't need access to the external network, but not sure it's worth the added complexity.

@QuLogic
Copy link
Member

QuLogic commented Aug 6, 2020

Travis macOS doesn't like the certificates; is it not set up properly?

@tacaswell
Copy link
Member Author

Tried restarting just to be sure, but it looks like this is failing with https certificat failures on osx 🤦

@tacaswell
Copy link
Member Author

Now it is failing to find the host at all...

@jkseppan
Copy link
Member

jkseppan commented Aug 7, 2020

The version of macOS that we use to test on Travis was changed to 10.12 recently so that we test on older systems too. It could be that Travis hasn't applied all OS updates?

@jkseppan
Copy link
Member

jkseppan commented Aug 7, 2020

Now it is failing to find the host at all...

That sounds like an intermittent network failure. But I can reproduce the certificate problem in a separate repository:

https://travis-ci.com/github/jkseppan/bookish-octo-winner/builds/178843673

@jkseppan
Copy link
Member

jkseppan commented Aug 7, 2020

And the fix is to use certifi to provide a current certificate file. This can be an actual problem on older systems.

certifi was already an indirect dependency but make it explicit
@jkseppan
Copy link
Member

jkseppan commented Aug 7, 2020

Here's my suggestion as a PR to your branch: tacaswell#23

@linchiwei123
Copy link
Contributor

Try put sudo /Applications/Python\ 3.8/Install\ Certificates.command before sudo ln -s python3 /usr/local/bin/python in your .travis.yml to install Certificates.
Maybe you don't need context=_get_ssl_context() anymore. @jkseppan

@anntzer
Copy link
Contributor

anntzer commented Aug 7, 2020

Very much from the peanut gallery: perhaps subprocess.run([sys.executable, "-mhttp.server"]) in a separate thread is simpler after all?

@jkseppan
Copy link
Member

jkseppan commented Aug 7, 2020 via email

@QuLogic QuLogic merged commit 74fdc27 into matplotlib:master Aug 11, 2020
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Aug 11, 2020
dopplershift added a commit that referenced this pull request Aug 11, 2020
…185-on-v3.3.x

Backport PR #18185 on branch v3.3.x (FIX: fix reading from http/https urls via imread)
@tacaswell tacaswell deleted the fix_htpps_imread branch August 18, 2020 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error reading png image from URL with imread in matplotlib 3.3
7 participants