decargroup / navlie

A state estimation package for Lie groups!
https://decargroup.github.io/navlie/
MIT License
158 stars 13 forks source link

Tests not running with import errors #115

Closed vkorotkine closed 8 months ago

vkorotkine commented 8 months ago

After installing navlie with pip install -e ., running pytest tests results in the following error. Running on Linux Mint 20.2 Cinnamon 64-bit. Using a pyenv version 3.10.1, and the examples run fine. But pytest looks for python 2.7.

(navlie_test_env) vassili@vassili-HP-ProBook-430-G5:~/projects/navlie$ pytest tests
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-4.6.9, py-1.8.1, pluggy-0.13.0
rootdir: /home/vassili/projects/navlie
collected 15 items / 23 errors                                                 

==================================== ERRORS ====================================
__________ ERROR collecting tests/integration/test_batch_noiseless.py __________
ImportError while importing test module '/home/vassili/projects/navlie/tests/integration/test_batch_noiseless.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/integration/test_batch_noiseless.py:1: in <module>
    from concurrent.futures import process
E   ImportError: No module named concurrent.futures
_________ ERROR collecting tests/integration/test_filter_ekf_basic.py __________
/usr/lib/python2.7/dist-packages/_pytest/python.py:507: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python2.7/dist-packages/py/_path/local.py:701: in pyimport
    __import__(modname)
E     File "/home/vassili/projects/navlie/tests/integration/test_filter_ekf_basic.py", line 58
E       def ekf_trial(trial_number: int) -> List[GaussianResult]:
E                                 ^
E   SyntaxError: invalid syntax
_______ ERROR collecting tests/integration/test_filter_ekf_noiseless.py ________
/usr/lib/python2.7/dist-packages/_pytest/python.py:507: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python2.7/dist-packages/py/_path/local.py:701: in pyimport
    __import__(modname)
E     File "/home/vassili/projects/navlie/tests/integration/test_filter_ekf_noiseless.py", line 59
E       def ekf_trial(trial_number: int) -> List[GaussianResult]:
E                                 ^
E   SyntaxError: invalid syntax
____ ERROR collecting tests/integration/test_interacting_multiple_models.py ____
/usr/lib/python2.7/dist-packages/_pytest/python.py:507: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python2.7/dist-packages/py/_path/local.py:701: in pyimport
    __import__(modname)
E     File "/home/vassili/projects/navlie/tests/integration/test_interacting_multiple_models.py", line 68
E       def imm_trial(trial_number: int) -> List[GaussianResult]:
E                                 ^
E   SyntaxError: invalid syntax
___________ ERROR collecting tests/integration/test_invariant_so3.py ___________
/usr/lib/python2.7/dist-packages/_pytest/python.py:507: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python2.7/dist-packages/py/_path/local.py:701: in pyimport
    __import__(modname)
/usr/lib/python2.7/dist-packages/_pytest/assertion/rewrite.py:304: in load_module
    exec(co, mod.__dict__)
tests/integration/test_invariant_so3.py:1: in <module>
    from navlie.lib.states import SO3State
navlie/__init__.py:1: in <module>
    from .types import (
E     File "/home/vassili/projects/navlie/navlie/types.py", line 18
E       dof: int,
E          ^
E   SyntaxError: invalid syntax
___________ ERROR collecting tests/integration/test_iterated_ekf.py ____________
/usr/lib/python2.7/dist-packages/_pytest/python.py:507: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python2.7/dist-packages/py/_path/local.py:701: in pyimport
    __import__(modname)
E     File "/home/vassili/projects/navlie/tests/integration/test_iterated_ekf.py", line 80
E       trial_number: int,
E                   ^
E   SyntaxError: invalid syntax
_____________ ERROR collecting tests/unit/test_associate_stamps.py _____________
ImportError while importing test module '/home/vassili/projects/navlie/tests/unit/test_associate_stamps.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/unit/test_associate_stamps.py:1: in <module>
    import numpy as np
E   ImportError: No module named numpy
_____________ ERROR collecting tests/unit/test_batch_residuals.py ______________
/usr/lib/python2.7/dist-packages/_pytest/python.py:507: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python2.7/dist-packages/py/_path/local.py:701: in pyimport
    __import__(modname)
/usr/lib/python2.7/dist-packages/_pytest/assertion/rewrite.py:304: in load_module
    exec(co, mod.__dict__)
tests/unit/test_batch_residuals.py:3: in <module>
    from navlie.types import Measurement
navlie/__init__.py:1: in <module>
    from .types import (
E     File "/home/vassili/projects/navlie/navlie/types.py", line 18
E       dof: int,
E          ^
E   SyntaxError: invalid syntax
______________ ERROR collecting tests/unit/test_body_velocity.py _______________
/usr/lib/python2.7/dist-packages/_pytest/python.py:507: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python2.7/dist-packages/py/_path/local.py:701: in pyimport
    __import__(modname)
E     File "/home/vassili/projects/navlie/tests/unit/test_body_velocity.py", line 107
E       T_12 = SE3.inverse(T_a1) @ T_a2
E                                ^
E   SyntaxError: invalid syntax
__________________ ERROR collecting tests/unit/test_camera.py __________________
/usr/lib/python2.7/dist-packages/_pytest/python.py:507: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python2.7/dist-packages/py/_path/local.py:701: in pyimport
    __import__(modname)
/usr/lib/python2.7/dist-packages/_pytest/assertion/rewrite.py:304: in load_module
    exec(co, mod.__dict__)
tests/unit/test_camera.py:1: in <module>
    from navlie.lib.camera import PinholeCamera, PoseMatrix
navlie/__init__.py:1: in <module>
    from .types import (
E     File "/home/vassili/projects/navlie/navlie/types.py", line 18
E       dof: int,
E          ^
E   SyntaxError: invalid syntax
________________ ERROR collecting tests/unit/test_composite.py _________________
/usr/lib/python2.7/dist-packages/_pytest/python.py:507: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python2.7/dist-packages/py/_path/local.py:701: in pyimport
    __import__(modname)
/usr/lib/python2.7/dist-packages/_pytest/assertion/rewrite.py:304: in load_module
    exec(co, mod.__dict__)
tests/unit/test_composite.py:1: in <module>
    from navlie.lib import (
navlie/__init__.py:1: in <module>
    from .types import (
E     File "/home/vassili/projects/navlie/navlie/types.py", line 18
E       dof: int,
E          ^
E   SyntaxError: invalid syntax
_________________ ERROR collecting tests/unit/test_datagen.py __________________
/usr/lib/python2.7/dist-packages/_pytest/python.py:507: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python2.7/dist-packages/py/_path/local.py:701: in pyimport
    __import__(modname)
/usr/lib/python2.7/dist-packages/_pytest/assertion/rewrite.py:304: in load_module
    exec(co, mod.__dict__)
tests/unit/test_datagen.py:1: in <module>
    from navlie.lib.models import SingleIntegrator
navlie/__init__.py:1: in <module>
    from .types import (
E     File "/home/vassili/projects/navlie/navlie/types.py", line 18
E       dof: int,
E          ^
E   SyntaxError: invalid syntax
__________________ ERROR collecting tests/unit/test_filter.py __________________
/usr/lib/python2.7/dist-packages/_pytest/python.py:507: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python2.7/dist-packages/py/_path/local.py:701: in pyimport
    __import__(modname)
/usr/lib/python2.7/dist-packages/_pytest/assertion/rewrite.py:304: in load_module
    exec(co, mod.__dict__)
tests/unit/test_filter.py:1: in <module>
    import navlie as nav
navlie/__init__.py:1: in <module>
    from .types import (
E     File "/home/vassili/projects/navlie/navlie/types.py", line 18
E       dof: int,
E          ^
E   SyntaxError: invalid syntax
___________________ ERROR collecting tests/unit/test_imu.py ____________________
/usr/lib/python2.7/dist-packages/_pytest/python.py:507: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python2.7/dist-packages/py/_path/local.py:701: in pyimport
    __import__(modname)
E     File "/home/vassili/projects/navlie/tests/unit/test_imu.py", line 42
E       assert np.allclose(U @ U_inv, np.eye(5))
E                            ^
E   SyntaxError: invalid syntax
______________ ERROR collecting tests/unit/test_interpolation.py _______________
/usr/lib/python2.7/dist-packages/_pytest/python.py:507: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python2.7/dist-packages/py/_path/local.py:701: in pyimport
    __import__(modname)
/usr/lib/python2.7/dist-packages/_pytest/assertion/rewrite.py:304: in load_module
    exec(co, mod.__dict__)
tests/unit/test_interpolation.py:1: in <module>
    from navlie.utils import state_interp
navlie/__init__.py:1: in <module>
    from .types import (
E     File "/home/vassili/projects/navlie/navlie/types.py", line 18
E       dof: int,
E          ^
E   SyntaxError: invalid syntax
_______________ ERROR collecting tests/unit/test_meas_models.py ________________
/usr/lib/python2.7/dist-packages/_pytest/python.py:507: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python2.7/dist-packages/py/_path/local.py:701: in pyimport
    __import__(modname)
E     File "/home/vassili/projects/navlie/tests/unit/test_meas_models.py", line 31
E       x: MatrixLieGroupState, model: MeasurementModel, atol=1e-6, rtol=1e-4
E        ^
E   SyntaxError: invalid syntax
________________ ERROR collecting tests/unit/test_plot_poses.py ________________
ImportError while importing test module '/home/vassili/projects/navlie/tests/unit/test_plot_poses.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/unit/test_plot_poses.py:1: in <module>
    import numpy as np
E   ImportError: No module named numpy
______________ ERROR collecting tests/unit/test_preintegration.py ______________
/usr/lib/python2.7/dist-packages/_pytest/python.py:507: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python2.7/dist-packages/py/_path/local.py:701: in pyimport
    __import__(modname)
E     File "/home/vassili/projects/navlie/tests/unit/test_preintegration.py", line 206
E       Qd_fd = L @ rmi.covariance @ L.T
E                 ^
E   SyntaxError: invalid syntax
______________ ERROR collecting tests/unit/test_process_models.py ______________
/usr/lib/python2.7/dist-packages/_pytest/python.py:507: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python2.7/dist-packages/py/_path/local.py:701: in pyimport
    __import__(modname)
E     File "/home/vassili/projects/navlie/tests/unit/test_process_models.py", line 27
E       cov_test = L @ np.identity(3) @ L.T
E                    ^
E   SyntaxError: invalid syntax
___________________ ERROR collecting tests/unit/test_spkf.py ___________________
/usr/lib/python2.7/dist-packages/_pytest/python.py:507: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python2.7/dist-packages/py/_path/local.py:701: in pyimport
    __import__(modname)
/usr/lib/python2.7/dist-packages/_pytest/assertion/rewrite.py:304: in load_module
    exec(co, mod.__dict__)
tests/unit/test_spkf.py:1: in <module>
    from navlie.lib.states import MatrixLieGroupState, VectorState, SE3State
navlie/__init__.py:1: in <module>
    from .types import (
E     File "/home/vassili/projects/navlie/navlie/types.py", line 18
E       dof: int,
E          ^
E   SyntaxError: invalid syntax
__________________ ERROR collecting tests/unit/test_states.py __________________
/usr/lib/python2.7/dist-packages/_pytest/python.py:507: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python2.7/dist-packages/py/_path/local.py:701: in pyimport
    __import__(modname)
E     File "/home/vassili/projects/navlie/tests/unit/test_states.py", line 20
E       sample_states: Dict[str, State] = {
E                    ^
E   SyntaxError: invalid syntax
__________________ ERROR collecting tests/unit/test_utils.py ___________________
/usr/lib/python2.7/dist-packages/_pytest/python.py:507: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python2.7/dist-packages/py/_path/local.py:701: in pyimport
    __import__(modname)
E     File "/home/vassili/projects/navlie/tests/unit/test_utils.py", line 55
E       e.reshape((1, -1)) @ np.linalg.inv(c) @ e.reshape((-1, 1))
E                          ^
E   SyntaxError: invalid syntax
_________________ ERROR collecting tests/unit/test_van_loan.py _________________
ImportError while importing test module '/home/vassili/projects/navlie/tests/unit/test_van_loan.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/unit/test_van_loan.py:1: in <module>
    import numpy as np
E   ImportError: No module named numpy
!!!!!!!!!!!!!!!!!!! Interrupted: 23 errors during collection !!!!!!!!!!!!!!!!!!!
vkorotkine commented 8 months ago

This was a pyenv issue. Following one of the comments from https://stackoverflow.com/questions/40718770/pytest-running-with-another-version-of-python, fixed by running python -m pip install pytest and then python -m pytest tests