thu-ml / tianshou

An elegant PyTorch deep reinforcement learning library.
https://tianshou.org
MIT License
7.84k stars 1.12k forks source link

Can't run test suite on macos - envpool not installable, causes ImportError #637

Closed ikamensh closed 2 years ago

ikamensh commented 2 years ago

Greetings,

According to https://tianshou.readthedocs.io/en/latest/contributing.html, I wanted to be able to run unit tests after doing a dev install. Here is what happens on macos:

________________________________________________________________________________________________________________ ERROR collecting test/discrete/test_a2c_with_il.py ________________________________________________________________________________________________________________
ImportError while importing test module '/Users/kai7rng/oss/tianshou/test/discrete/test_a2c_with_il.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
test/discrete/test_a2c_with_il.py:5: in <module>
    import envpool
E   ModuleNotFoundError: No module named 'envpool'
__________________________________________________________________________________________________________________ ERROR collecting test/modelbased/test_psrl.py ___________________________________________________________________________________________________________________
ImportError while importing test module '/Users/kai7rng/oss/tianshou/test/modelbased/test_psrl.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
test/modelbased/test_psrl.py:5: in <module>
    import envpool
E   ModuleNotFoundError: No module named 'envpool'

Maybe tests can have skip statement + import could happen inside individual tests?

Trinkle23897 commented 2 years ago

I'll fix it right now, sorry about that and thanks for reporting this issue!