pytorch_tabular
pytorch_tabular copied to clipboard
Install Issues: 'get_num_classes' from 'torchmetrics.utilities.data'
When installing package via the pip command, I end up getting the following error when executing from pytorch_tabular import TabularModel. I am doing a clean install and no other packages were installed prior to your package. It looks like there is some version conflict between Pytorch lightning and your package.
ImportError: cannot import name 'get_num_classes' from 'torchmetrics.utilities.data' (/Users/vineeth/anaconda3/envs/pytorchtabular/lib/python3.9/site-packages/torchmetrics/utilities/data.py).
I tried to remove the 0.9.x version of torchmetrics (that was installed by default when using your pip command) and install 0.7.x, which resolved the above issue, but now I get a different issue with the following error:
ImportError: cannot import name 'RichProgressBar' from 'pytorch_lightning.callbacks'
Could be please help me in resolving this issue?
Thanks
ImportError: cannot import name 'RichProgressBar' from 'pytorch_lightning.callbacks'
I'm assuming you are using the latest main branch from GitHub because RichProgressBar was not in any of the PyPi ones.
Which version of PyTorch Lightning are you using?
I have the same issue, and I ran the tutorial on Google Colab Pro
Update: you should try to run !pip uninstall -y torchtext before install pytorch_tabular.
@tudoanh Uninstalling torchtext doesn't work. Moreover, I am getting an error like this - `ImportError Traceback (most recent call last)
ImportError: cannot import name 'get_num_classes' from 'torchmetrics.utilities' (/usr/local/lib/python3.7/dist-packages/torchmetrics/utilities/init.py)`
The solution is to install PyTorch Lightning through mamba / conda, and get rid of the pip dependency. pip installs an old version.
Thanks for the suggestion @NicoPiel. On Colab I tried installing Lightning using conda and I still get the original error on from pytorch_tabular import TabularModel:
ImportError: cannot import name 'get_num_classes' from 'torchmetrics.utilities.data' (/usr/local/lib/python3.7/site-packages/torchmetrics/utilities/data.py)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This confusion should be over with v1.0.* All dependencies have been upgraded