Skip to content

Avoid deprecation warnings in imageio#7124

Closed
steven-johnson wants to merge 1 commit intomainfrom
srj/py-imread
Closed

Avoid deprecation warnings in imageio#7124
steven-johnson wants to merge 1 commit intomainfrom
srj/py-imread

Conversation

@steven-johnson
Copy link
Copy Markdown
Contributor

(Cherry-picked from WIP #7109)

It seems that as of imageio v2.16, they offer new and old apis, which must be imported as imageio.v3 or imageio.v2 respectively; if you just import and use the naked imageio but have 2.16+ installed, you get a noisy and puzzling deprecation warning emitted to stdout, which is not great, especially for tutorials.

All the options here seem bad:

  • We could just leave stuff as-is, but that would mean that folks running with a newer (Feb 2022 +) install of imageio would get a distracting deprecation warning

  • We could play nicely with both older and newer versions of imageio by wrapping the import in a try block; that would work, but would be a distracting wart at the top of each tutorial

  • We could settle on using either the v2 or v3 API, but that means that folks with older imageio installs fail outright

  • For the moment, I settled on the last one (using v2), along with requirements.txt... which forced me to upgrade the version on all the buildbots, since they were mostly running 2.9.

I'd welcome feedback on this.

(Cherry-picked from WIP #7109)

It seems that as of imageio v2.16, they offer new and old apis, which must be imported as imageio.v3 or imageio.v2 respectively; if you just import and use the naked imageio but have 2.16+ installed, you get a noisy and puzzling deprecation warning emitted to stdout, which is not great, especially for tutorials.

All the options here seem bad:

- We could just leave stuff as-is, but that would mean that folks running with a newer (Feb 2022 +) install of imageio would get a distracting deprecation warning
- We could play nicely with both older and newer versions of imageio by wrapping the import in a try block; that would work, but would be a distracting wart at the top of each tutorial
- We could settle on using either the v2 or v3 API, but that means that folks with older imageio installs fail outright

- For the moment, I settled on the last one (using v2), along with requirements.txt... which forced me to upgrade the version on all the buildbots, since they were mostly running 2.9.

I'd welcome feedback on this.
@steven-johnson
Copy link
Copy Markdown
Contributor Author

(Adding @jiawen here to get comments from a Pythonista... our main Python go-to on the team, Alex Reinking, is taking time away from the project to finish his PhD thesis)

@steven-johnson
Copy link
Copy Markdown
Contributor Author

(This is probably obsoleted by #7125 -- don't land this without checking on that first.)

@steven-johnson steven-johnson added backport me This change should be backported to release versions python Issues related to Halide/Python interop labels Oct 26, 2022
@steven-johnson
Copy link
Copy Markdown
Contributor Author

Obsoleted by #7125

@steven-johnson steven-johnson deleted the srj/py-imread branch October 28, 2022 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport me This change should be backported to release versions python Issues related to Halide/Python interop

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant