C1W2 Practice Lab Grader Error

Hello,

I’m having trouble submitting the Course 1, Week 2 practice lab (Linear Regression). The autograder appears unable to import the numpy module properly — I keep getting the following error after submission:

Total Score
Try Again・0/100

Exercise 2

0/50
Failed test case: Exception during compute_gradient test 1: name ‘np’ is not defined. Expected: None, but got: None. Failed test case: Exception during compute_gradient test 2: name ‘np’ is not defined. Expected: None, but got: None.

Exercise 1

0/50
Failed test case: Exception during compute_cost test 1: name ‘np’ is not defined. Expected: None, but got: None. Failed test case: Exception during compute_cost test 2: name ‘np’ is not defined. Expected: None, but got: None. Failed test case: Exception during compute_cost test 3: name ‘np’ is not defined. Expected: None, but got: None.

I saved my notebook manually and ran all cells (both one-by-one and using “Run All”) without any errors. The error only appears after I submit.

Could you please help me troubleshoot this?

Thank you.

1 Like

The grader does not expect you to use numpy in your code for the exercises. So the grader environment does not provide the numpy package.

Try modifying your code to not use numpy methods.

Thanks so much for the quick reply. I’ll rewrite my code without NumPy. Have a great day!

1 Like

Update: The grader on the Learning Platform does not import numpy, so you can’t use it in your graded exercises.

Use regular Python functions instead. For example, use “sum()” instead of “np.sum()”.