ModuleNotFoundError in python in cs231 course

1.4k views Asked by At

I have decided to complete cs231 course and do its assignment. I happily watched the first 2 videos of the course and now I had to solve the first assignments. I followed the guidelines step by step which was shown in the video in this link: https://cs231n.github.io/setup-instructions/ Then, when I run the first cell, which is not the cell shown in the video but nonetheless it's in the assignments1 file which I downloaded from their site, I get a nasty error which has paralyzed me four a couple of hours. I'd be happy if anyone could respond. enter image description here IF you take a look at my picture, you'll see that files are added in the google drive, but surprisingly, it gives an error out of nowhere. Thanks.

===========================================================================

Update: Here is the snapshot of the video provided to guide students how to setup their google colab (in that link).

enter image description here

As you can see, in their vide the first chunk of code specifies their working directory but in the file that they have uploaded as their assignment1, they have not done so!

4

There are 4 answers

0
m0ss On BEST ANSWER

This was ridiculous! After dealing with it for couple of hours (trying to discover the current directory using cwd command and cd) with no avail, I decided to clear ALL files from my google drive and download the assignment1 file again enter image description here

Suprisingly, this time the colab page had the code in its beginning. I still wonder how that happened.

3
Sunilsai On

cs231n is a virtual environment according to documentation from the link u provided. Every time you want to work on assignment you should activate that environment by source ~/cs231n/bin/activate

1
Roshin Raphel On

This happens because cs231n is not in the current path. Add these line at the beginning of the code :

import sys
sys.path.append('./cs231n')
0
Jiahui-W On

I had the same problem. I ran the first block which imports the module 'sys' and appends the file path. After that I left and came back after 5 hours. When I log in again, I didn't run the first block. Then I came with the problem. That's the question! The new Google Drive allocated is different. Therefore, the python doesn't know where the file path is. So I tried to run the first block again and it really works. That's why you succeed by downloading the assignment1 file and running it again. This is my opinion. Hope this can help you!