google / brax

Massively parallel rigidbody physics simulation on accelerator hardware.
Apache License 2.0
2.25k stars 249 forks source link

Install files in brax/v2/io and brax/v2/envs/assets required in non-editable installations #292

Closed traversaro closed 1 year ago

traversaro commented 1 year ago

Without this change, many tests are failing after a non-editable installation with error:

2023-01-14T18:47:29.8721847Z _________________ ERROR collecting v2/spring/pipeline_test.py __________________
2023-01-14T18:47:29.8723983Z ImportError while importing test module '$PREFIX/lib/python3.10/site-packages/brax/v2/spring/pipeline_test.py'.
2023-01-14T18:47:29.8725020Z Hint: make sure your test modules/packages have valid Python names.
2023-01-14T18:47:29.8725639Z Traceback:
2023-01-14T18:47:29.8726594Z ../_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/lib/python3.10/importlib/__init__.py:126: in import_module
2023-01-14T18:47:29.8727869Z     return _bootstrap._gcd_import(name[level:], package, level)
2023-01-14T18:47:29.8729232Z ../_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/lib/python3.10/site-packages/brax/v2/spring/pipeline_test.py:20: in <module>
2023-01-14T18:47:29.8730502Z     from brax.v2 import test_utils
2023-01-14T18:47:29.8731783Z ../_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/lib/python3.10/site-packages/brax/v2/test_utils.py:22: in <module>
2023-01-14T18:47:29.8733083Z     from brax.v2.io import mjcf
2023-01-14T18:47:29.8733733Z E   ModuleNotFoundError: No module named 'brax.v2.io'

To reproduce:

# Run in an appropriate virtualenv or conda env
cd ~
git clone https://github.com/google/brax
cd brax
pip install .
# Navigate to a different directory to avoid cross-talking with the source directory
cd ~
mkdir testbrax
cd testbrax
pytest --pyargs brax -v

I guess the CI did not catched this error as it is only testing the editable install.

erikfrey commented 1 year ago

Thanks!