giotto-ai / pyflagser

Python bindings and API for the flagser C++ library (https://github.com/luetge/flagser).
Other
13 stars 15 forks source link

ERROR pyflagser - ModuleNotFoundError: No module named 'pyflagser.modules' #73

Open OswArti opened 3 years ago

OswArti commented 3 years ago

The pytest failed after running it in Ubuntu 16.04.7 LTS, with the following messages:

  1. Log after installation of pyflagser:

(giottoTDA) oarti001@raptor:~/pyflagser$ python -m pip install -U pyflagser Collecting pyflagser Downloading pyflagser-0.4.4-cp39-cp39-manylinux2010_x86_64.whl (400 kB) |████████████████████████████████| 400 kB 33.2 MB/s Collecting numpy>=1.17.0 Downloading numpy-1.21.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (15.7 MB) |████████████████████████████████| 15.7 MB 133.9 MB/s Collecting scipy>=0.17.0 Using cached scipy-1.7.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (28.4 MB) Installing collected packages: numpy, scipy, pyflagser Successfully installed numpy-1.21.0 pyflagser-0.4.4 scipy-1.7.0

  1. Log after running pytest:

(giottoTDA) oarti001@raptor:~$ pytest pyflagser ========================================================================================== test session starts =========================================================================================== platform linux -- Python 3.9.5, pytest-6.2.4, py-1.9.0, pluggy-0.12.0 rootdir: /disk/raptor/lclhome/oarti001/pyflagser, configfile: setup.cfg collected 0 items / 1 error

=============================================================== ERRORS ___ ERROR collecting test session /lclhome/oarti001/miniconda3/envs/giottoTDA/lib/python3.9/importlib/init.py:127: in import_module return _bootstrap._gcd_import(name[level:], package, level)

:1030: in _gcd_import ??? :1007: in _find_and_load ??? :972: in _find_and_load_unlocked ??? :228: in _call_with_frames_removed ??? :1030: in _gcd_import ??? :1007: in _find_and_load ??? :972: in _find_and_load_unlocked ??? :228: in _call_with_frames_removed ??? :1030: in _gcd_import ??? :1007: in _find_and_load ??? :986: in _find_and_load_unlocked ??? :680: in _load_unlocked ??? :855: in exec_module ??? :228: in _call_with_frames_removed ??? pyflagser/pyflagser/__init__.py:5: in from .flagser import flagser_unweighted, flagser_weighted pyflagser/pyflagser/flagser.py:6: in from .modules.flagser_pybind import compute_homology, AVAILABLE_FILTRATIONS E ModuleNotFoundError: No module named 'pyflagser.modules' ====short test summary info ========================================================================================= ERROR pyflagser - ModuleNotFoundError: No module named 'pyflagser.modules' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection ============================================================ 1 error in 0.21s ======= Am I missing something? Thanks
ulupo commented 3 years ago

Thanks for the report! Are you running these tests from inside a clone of the repository?

ulupo commented 3 years ago

I think it would help if we knew what sort of interaction with pyflagser you are looking for. Are you wishing to be just a user of the package? Or a developer? Since you are installing from PyPI, you are effectively choosing a user install. As such, why are you interested in running the unit test suite on the package?

OswArti commented 3 years ago

I installed it because it is needed for the giotto-tda library. I am doing some research on functional networks of the human brain using TDA, hence I would like to use giotto-tda for my research.

ulupo commented 3 years ago

Thanks for the info! It looks like you don't wish to be a developer (i.e. to edit the pyflagser source code), but just a user. In this case, you correctly installed pyflagser from PyPI. However, I suspect you also cloned the repo (i.e. you ran git clone https://github.com/giotto-ai/pyflagser.git). Can you confirm? If so, I would strongly advise against that, as it can only cause confusion. I would thus recommend deleting your cloned repo.

Ultimately, the problem is that you have performed a user install but are trying to run unit tests as if you had a developer install. The commands for running unit tests would be different (and somewhat more complicated) for a user install (PyPI) as yours. I can help with that if you really wish to run these tests. However, let me say that running unit tests as a user is somewhat pointless: we test the source code comprehensively in our CI, so there is basically no doubt those unit tests would pass with your user install. (Designing and) running unit tests is usually an activity reserved to those who wish to develop.

TL;DR: Your installation is almost surely fine. You have a user install so don't bother with running unit tests unless you have a specific reason for doing so.