MIT-REALM / neural_clbf

Toolkit for learning controllers based on robust control Lyapunov barrier functions
BSD 3-Clause "New" or "Revised" License
124 stars 43 forks source link

ImportError due to torchmetrics version #7

Closed rallen10 closed 1 year ago

rallen10 commented 1 year ago

When installing and running pytest, all tests fail with the error

ImportError: cannot import name 'get_num_classes' from 'torchmetrics.utilities.data'

See related problem here with proposed solution to simply downgrade torchmetrics to v0.6.0

I recommend pinning torchmetrics ==0.6.0 in requirements so new users don't run into this problem; at least until a more robust and less rigid solution is implemented.

In the mean time new users can resolve by manually installing torchmetrics with

conda activate neural_clbf
pip install torchmetrics==0.6.0
djaustin1 commented 1 year ago

Have this exact issue, however, I get the following error when I try to run conda activate neural_clbf. What am I missing? Thanks.

EnvironmentNameNotFound: Could not find conda environment: neural_clbf You can list all discoverable environments with conda info --envs.

image

dawsonc commented 1 year ago

@rallen10 Thanks for raising this issue, and sorry for the delayed response. I think torchmetrics is pinned at 0.5.1 now (I think I made this change sometime in the last month or so, before I realized people were actually using my code :sweat_smile: )

dawsonc commented 1 year ago

@djaustin1 I think your issue is that you do not seem to have created a conda environment for neural_clbf. There are instructions in the README:

conda create --name neural_clbf python=3.9
conda activate neural_clbf
pip install -e .
pip install -r requirements.txt

Does that work for you?