Python Error ModuleNotFoundError: No module named 'transformers'

Question:

I’m getting below error when running ‘import transformers’, even though I have installed in the same vitual env. I’m using python 3.8

ModuleNotFoundError: No module named 'transformers'

Error:

enter image description here

I have uninstalled it and reinstalled it using ‘pip3 install transformers’ from python cmd line.

Then I tried to uninstalled again, and reinstalled in jupyter notebook using ‘!pip install transformers’, result shows ‘

Installing collected packages: transformers
Successfully installed transformers-4.24.0

I can also verify directly in Jupyter Notebook:

enter image description here

I tried to install transformers successfully in jupyter Notebook. After that still getting ModuleNotFoundError error (have tried restarted kernel too)

enter image description here

Asked By: ella

||

Answers:

its resolved now. I just tried to use %pip install transformers==3.4.0, instead of !pip install transformers==3.4.0 in jupyter book, and it worked. I can proceed with the project for now. Although I don’t know what I did wrong in my python command line earlier that caused the inconsistency. Will open a new thread.

Answered By: ella
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.