Thinklab-SJTU / pygmtools

A Python Graph Matching Toolkit.
https://pygmtools.readthedocs.io/
Other
310 stars 20 forks source link

Using import to check for existince of a package raises an error #78

Closed bkmgit closed 1 year ago

bkmgit commented 1 year ago

When packaging and checking if installation has occurred correctly, one tries to import pygmtools. The current init.py file uses import to check for other packages. This raises an error that may prevent easy use of pygmtools in other systems. Rather than use import, use importlib.util.find_spec as documented at https://stackoverflow.com/questions/14050281/how-to-check-if-a-python-module-exists-without-importing-it

rogerwwww commented 1 year ago

That makes sense. While there are other uses of "import check" in classic_solvers.py linear_solvers.py neural_solvers.py multi_graph_solvers.py and utils.py, would you mind fix them together in #79 ?

You may double-check by searching for the usage of importlib in this repo.

bkmgit commented 1 year ago

Ok.

rogerwwww commented 1 year ago

Merged. Thank you!