ModuleNotFoundError: No module named 'src'

Hello ,

I have the classic "ModuleNotFoundError: No module named 'src' " when I run my project.

Notice that the editor shows that it is recognizing the imports src... but when I run it I get the above error.

I have done plenty of search and I did the following (not in this sequence) :

1) Fix the project interpreter.

2) Invalidate Caches and Restart

3) Edit the configurations of the project.

4) Restart the computer.

5) Check the environment variables of Windows

I have done all these again and again but the problem " ModuleNotFoundError: No module named 'src' " still exists.

The next step was to copy each of my source files to a new project. The new project ran without problem.

I see one by one the interpreter options of the old and new project and they are the same.

The problem still exists to the old project. I don't know what I am doing wrong.

I want the old project run as the new (identical) one.

1 comment
Comment actions Permalink

Hi,

When having a problem running your code, I would first check if it's running ok from the system terminal to make sure the problem is not related to your code.

If it's not, we need more information about your project structure and the imports you are doing.

0

Please sign in to leave a comment.