Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Catch ValueError in module available (#615)
Browse files Browse the repository at this point in the history
* Catch ValueError in module available

* Update CHANGELOG
  • Loading branch information
ethanwharris authored Jul 27, 2021
1 parent 0890270 commit 2033c9e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

### Fixed


- Fixed a bug where serve sanity checking would not be triggered using the latest PyTorchLightning version ([#493](https://github.com/PyTorchLightning/lightning-flash/pull/493))

- Fixed a bug where train and validation metrics weren't being correctly computed ([#559](https://github.com/PyTorchLightning/lightning-flash/pull/559))

- Fixed a bug where an uncaught ValueError could be raised when checking if a module is available ([#615](https://github.com/PyTorchLightning/lightning-flash/pull/615))

## [0.4.0] - 2021-06-22

### Added
Expand Down
5 changes: 4 additions & 1 deletion flash/core/utilities/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ def _module_available(module_path: str) -> bool:
except ModuleNotFoundError:
# Python 3.7+
return False
except ValueError:
# Sometimes __spec__ can be None and gives a ValueError
return True


def _compare_version(package: str, op, version) -> bool:
Expand All @@ -59,7 +62,7 @@ def _compare_version(package: str, op, version) -> bool:
try:
pkg_version = Version(pkg.__version__)
except TypeError:
# this is mock by sphinx, so it shall return True ro generate all summaries
# this is mock by sphinx, so it shall return True to generate all summaries
return True
return op(pkg_version, Version(version))

Expand Down

0 comments on commit 2033c9e

Please sign in to comment.