Closed Avasam closed 11 months ago
I can somewhat see the benefit of providing an escape route if scipy or pywavelet is not installable. But it seems better to me to by default install dependencies so that all features can be used.
I could always fork imagehash until PyWavelets 1.5 releases. Figured I'd try offering a more long-term solution upstream first. In the meantime I'm also blocked on PySide6 anyway.
I like most of the PR.
Is there a way to make the default install behave as if your [whash,phash] options are set? Or is the only way to defined the reverse, a without-whash and a without-phash extra option?
An alternative workaround is to install with pip --no-dependencies.
Is there a way to make the default install behave as if your [whash,phash] options are set? Or is the only way to defined the reverse, a without-whash and a without-phash extra option?
Not as far as I know, it'd be more like a imagehash[all]
.
An alternative workaround is to install with pip --no-dependencies.
That said, I didn't know about --no-dependencies
. Looking further into it, there's even a PR open to make the flag usable in requirements files, however there's a good chunk of discussion indicating uncertainty as per the "proper" fix for my scenario that prompted this PR: https://github.com/pypa/pip/pull/10837 (issue: https://github.com/pypa/pip/issues/9948)
Since I already end up having to use a custom install script for different reasons, I could restrict imagehash
< Python 3.12, and add a pip install scipy imagehash --no-deps
line in my script for Python 3.12. (in theory this should all resolve itself eventually)
Is this better? It keeps the existing default install behaviour, but more clearly offers, and explains how to, skip what are considered optional installs.
https://github.com/PyWavelets/pywt/issues/695 claims this is now resolved?
PyWavelets/pywt#695 claims this is now resolved?
My PyWavelets install issue was resolved by --no-dependencies
.
You mentioned liking part of the PR so I reduced the changes to just the optional runtime import and better error messages if it's a supported use-case.
I can somewhat see the benefit of providing an escape route if scipy or pywavelet is not installable. But it seems better to me to by default install dependencies so that all features can be used.
If you don't see value in these changes. You are welcome to close the PR.
Hmm, yes. If pip cannot install pywavelets and scipy, there is something seriously wrong or some specialized use case. Thank you for exploring this direction, maybe we can revisit it in the future.
It's generally nice to not install dependencies the user doesn't need on their machine. But this also makes imagehash installable on Python 3.12 ! (see error below)
I also improved the error message if the dependency is missing.