-
Notifications
You must be signed in to change notification settings - Fork 346
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
[MRG] Fix import error when torch is not installed. #463
Conversation
Init file in tslearn/backend imports torch backend, which imports torch. This causes an import error when torch is not installed. This change fixes this issue by removing extra import in tslearn/backend/__init__.py Additionally, this change fixes failing tests when torch is not installed. Fixes tslearn-team#462
Thanks @eicca for this prompt PR! @YannCabanes coiuld you have a look? |
Also, if I may add, it could be a good idea to have a test specifically tailored for the no-pytorch context to make sure that we don't make this mistake again in the future, what do you think? |
Small update: I tried to compare the failing tests with and without pytorch and it looks like the same tests are failing. So I'd assume that this PR does fix all pytorch dependent tests :) |
Your edits to |
Thanks a lot for your quick PR @eicca! |
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## main #463 +/- ##
==========================================
- Coverage 93.06% 92.98% -0.09%
==========================================
Files 67 67
Lines 5625 5613 -12
==========================================
- Hits 5235 5219 -16
- Misses 390 394 +4
☔ View full report in Codecov by Sentry. |
Thanks a lot @eicca ! This is now merged in main, and we will generate a new release from this patch! |
Thanks a lot @rtavenar and @YannCabanes for taking care of this! |
Init file in
tslearn/backend
imports torch backend, which imports torch. This causes an import error when torch is not installed. This change fixes this issue by removing extra import intslearn/backend/__init__.py
Additionally, this change fixes failing tests when torch is not installed.
Fixes #462
I tried to run the tests locally, but some of them fail with and without pytorch being installed, so I can't say for sure if I fixed all test cases.
When this is fixed, I think some users will appreciate a new release, since the latest version is breaking for everybody who didn't install pytorch. To make things slightly worse, the latest version of pytorch is incompatible with the latest version of tensorflow: pytorch/pytorch#97580, therefore the temporary fix of installing pytorch won't work in some cases.