Describe the bug
A clear and concise description of what the bug is. Please specify the class causing the issue.
Now, I have tried in terminal and pycharm, always print error 'ImportError: cannot import name 'ClassificationModel''. But used to be all right. I wonder if it is the version problem?
To Reproduce
Steps to reproduce the behavior:
Any codes with codes 'from simpletransformers.classification import ClassificationModel, ClassificationArgs' will pose the error
Expected behavior
A clear and concise description of what you expected to happen.
No error
Screenshots
If applicable, add screenshots to help explain your problem.


Desktop (please complete the following information):
I have a similar error caused by release of version 0.42.0 today; was resolved by pip install simpletransformers==0.41
----> 1 from simpletransformers.classification import ClassificationModel
...
/usr/local/lib/python3.6/dist-packages/simpletransformers/classification/classification_model.py in <module>()
23 )
24 from tqdm.auto import tqdm, trange
---> 25 from tqdm.contrib import tenumerate
26
27 import pandas as pd
ImportError: cannot import name 'tenumerate'
It seems that the package is updating and some source codes have been modified. For example, simpletransformers/simpletransformers/classification/_init_.py and classification_model.py. If so, I think it's not friendly for using if updating like this
There was no _intentional_ change in how the imports work. But I did have a little problem with git which might have messed something up. I'll check this.
I can import and use these models without any issues. Can you guys check whether your transformers and tokenizers versions are updated as well? It shouldn't really matter, but you never know.
Regarding the tenumerate import issue, you may need to update your tqdm package.
Looking into this more closely on CoLab where I first encountered the problem today, pip install --upgrade tqdm resolves the problem by upgrading from tqdm-4.41.1 to tqdm-4.47.0 - https://colab.research.google.com/drive/1lRXnTyfMVxG-M06tSXZ1sfyRhI7qMcs6?usp=sharing
I'm also having similar problem importing the ClassificationModel, I keep on getting
ImportError: cannot import name 'tenumerate'
My tokenizers and transformers are up to date.
I'm also having similar problem importing the ClassificationModel, I keep on getting
ImportError: cannot import name 'tenumerate'My tokenizers and transformers are up to date.
Regarding the tenumerate import issue, you may need to update your tqdm package.
I have updated tqdm but still having the same message.
If you are in a notebook, you will need to restart the runtime after updating a builtin library (pip install --upgrade tqdm) - if you still have issues, report the version you have installed:
import tqdm
tqdm.__version__
tqdm version is 4.41.1.
I'm running on colab
You should be able to upgrade by running !pip install --upgrade tqdm in Colab. tenumerate seems to have been added in a very recent version.
I've also set a minimum version requirement for tqdm which should automatically update tqdm when Simple Transformers is installed. (This is simpletransformers==0.43.0)
You mean I should upgrade simpletramsformers because it seems tqdm is in its latest version??
No, your tqdm version is not the latest (0.47.0 is the latest). But, updating simple transformers should update both now.
It has worked. Thank you for the quick response.
I can import and use these models without any issues. Can you guys check whether your transformers and tokenizers versions are updated as well? It shouldn't really matter, but you never know.
Regarding the
tenumerateimport issue, you may need to update yourtqdmpackage.
thank you for your detailed reply. However, I have the same problem after I have check the package you mentioned. At last, I have moved to another computer and installed a new conda environment but there is another problem
'ImportError: cannot import name 'ClassificationModel' from partially initialized module 'simpletransformers.classification.classification_model' (most likely due to a circular import) (/home/yongdai/.conda/envs/transformers/lib/python3.8/site-packages/simpletransformers/classification/classification_model.py)'
I can only imagine that this is either due to a messed up environment or due to some weird file name which is causing the interpreter to try to import the script into itself (hence the circular import complaint).
In your second screenshot, it appears that the error is being thrown by transformers.py despite the import being executed directly inside the Python shell. I am not sure _why_ this happens but I'm pretty sure it _shouldn't_ be happening.
I can only imagine that this is either due to a messed up environment or due to some weird file name which is causing the interpreter to try to import the script into itself (hence the circular import complaint).
Thank you so much, your answer gives me the clue. After I changed the name 'transformer.py' to another name, that is, the name of my file conflicts with the package name, it can work now. Thanks for your quick response and detailed answer.
Thanks, this was a helpful find! Lacking inspiration I called a little scripting file in my working directory 'code.py' and ran into the same problem. Renaming solved it.
Most helpful comment
Thank you so much, your answer gives me the clue. After I changed the name 'transformer.py' to another name, that is, the name of my file conflicts with the package name, it can work now. Thanks for your quick response and detailed answer.