Search code examples
pythonbert-language-modelhuggingface-transformerstransformer-model

Python ImportError: cannot import name 'version' from 'packaging' (transformers)


when I'm trying to simply import transformers I receive this error:

ImportError: cannot import name 'version' from 'packaging' (C:\Users\miria\packaging.py)

Can anyone help me solve this?

traceback


Solution

  • I think this is one of those cases where you have a bad naming. Maybe your file (or something inside your code) has a name that is overlapping one of the references you are trying to get. For example, if you are importing a certain module named "kivy" and your file is named "kivy", then the code will go after your file instead of the actual package you are trying to import.

    if that's the case, try changing the name and the problem will be solved.