Thinklab-SJTU / pygmtools

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

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

Closed bkmgit closed 7 months ago

bkmgit commented 9 months 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 9 months 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 9 months ago

Ok.

rogerwwww commented 7 months ago

Merged. Thank you!