Week 3 No module named 'dlai_tools'

ModuleNotFoundError Traceback (most recent call last)
10 from copy import deepcopy
11 from testCases import *
—> 12 from public_tests import *
14 get_ipython().run_line_magic(‘matplotlib’, ‘inline’)

~/work/release/W2A1/public_tests.py in
2 from numpy import array
3 from testCases import *
----> 4 from dlai_tools.testing_utils import single_test, multiple_test

ModuleNotFoundError: No module named ‘dlai_tools’

I have this error, it’s the second time it appears on the second day I try to solve the programming assignment of week 3. Yesterday appeared between 11:00 - 11:10 pm (Texas), today I didn’t get any error but when I arrived at “Exercise 2 - random_mini_batches” when I try to call the function random_mini_batches_test(random_mini_batches) appeared another error related to this function, I run all the code again and restarted the kernel and appeared the same error of yesterday. I think that there is some kind of bug in your servers or something like that, and it’s frustrating because I can only do this assignment at night when I have enough free time.

We are sorry you are experiencing problems. I will look into this problem. Stay tuned :slight_smile:

Hello again,

After digging, it seems like you should never have this problem for Week 3. However, I will investigate your issue further for Week 1 and 2.

It might be the case that you have an old version of extra files installed on the server. Download your notebook. Delete all files and then refresh the lab to get the latest version. Hopefully, it should then work.

Let me know if it worked for you.

Sorry, the problem is present in week 3 assignment.

Hmm, you need to refresh your workspace. Make sure you delete all files (save your notebook to have as backup).

Can you print the first two lines of the file public_tests.py?

Make sure it reads

import numpy as np
from test_utils import single_test, multiple_test

Same situation for me for the week 1:
ModuleNotFoundError Traceback (most recent call last)
3 import sklearn
4 import sklearn.datasets
----> 5 from public_tests import *
6 from init_utils import sigmoid, relu, compute_loss, forward_propagation, backward_propagation
7 from init_utils import update_parameters, predict, load_dataset, plot_decision_boundary, predict_dec

~/work/release/W1A1/public_tests.py in
1 import numpy as np
----> 2 from dlai_tools.testing_utils import single_test, multiple_test
5 def initialize_parameters_zeros_test(target):

ModuleNotFoundError: No module named ‘dlai_tools’


Okey. Can you check if the library is installed correctly? If not try to install it and please take a screenshot of the output and post it here.

First, open a terminal (click on the jupyter icon as step 0):

Then check and download:

1 Like

It seems that " ?forceRefresh=true " fixes the situation

1 Like

Glad to hear you managed to get it working. :raised_hands:

1 Like

I encountered the same issue in W1A1 when I opened the file from my laptop and got it fixed by following this instruction. Thanks.

1 Like

I have the same error (Course 2, week 1):

ModuleNotFoundError: No module named ‘dlai_tools’

… but only after downloading the files and running the notebook locally. In the online workspace everything works fine.

However, I’d really like to run the notebook also locally - how do I fix this error there? @Kinzang_Dorji it looks like you had the same problem, how did you fix it?

@jonaslalin I noticed that my public_tests.py file does not start with

import numpy as np
from test_utils import single_test, multiple_test

but rather with

import numpy as np
from dlai_tools.testing_utils import single_test, multiple_test

even after I refreshed my workspace.

Thanks for any help!