-
-
Notifications
You must be signed in to change notification settings - Fork 568
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
Added a condition for jaxlib
imports
#1803
Added a condition for jaxlib
imports
#1803
Conversation
return importlib.util.find_spec("jax") is not None | ||
"""Check if jax and jaxlib are installed""" | ||
return (importlib.util.find_spec("jax") is not None) and ( | ||
importlib.util.find_spec("jaxlib") is not None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another approach would be to create a new have_jaxlib
function to carry out this condition, but I am not sure if that would be better
With have_jaxlib
we will be able to point out if jaxlib
is not installed. Otherwise, I guess the exceptions would be "Jax or jaxlib not installed"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creating have_jaxlib
would complicate things unnecessarily
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
Codecov Report
@@ Coverage Diff @@
## develop #1803 +/- ##
========================================
Coverage 99.24% 99.24%
========================================
Files 345 345
Lines 19049 19049
========================================
Hits 18906 18906
Misses 143 143
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Description
If
jax
is already installed in an environment where the user updatespybamm
to develop, importingpybamm
gives the following error (asjaxlib
is not available on windows butjax
is) -Fixes #1801
Type of change
Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.
Key checklist:
$ flake8
$ python run-tests.py --unit
$ cd docs
and then$ make clean; make html
You can run all three at once, using
$ python run-tests.py --quick
.Further checks: