How to install lab_utils_uni on local PC?

I use Microsoft Edge.

1 Like

any other browser that you can try?

1 Like

Yes, google chrom, internet explorer.

1 Like

Can you check out the other browsers, and see if the image renders?

1 Like

I closed all browser and tried firefox and google chrom each. Both does not work. Strange :frowning:

1 Like

I just downloaded all the files to my local machine and opened it on Microsoft Edge - The image renders fine. This is simple HTML to render an image, nothing too complicated…worst case, there is some plug-in missing

2 Likes

Ok, sounds good :slight_smile: How to install missed plug-in?

1 Like

@Xingyi_Shi

The labs are designed to work in the Coursera environment flawlessly. Once we move away from that environment it can get a little tricky, and we do not guarantee that it will work exactly as expected in any outside environment - The issues can be caused by a multitude of reasons such as version mismatches or missing packages/libraries, just to name a few.

We typically look for the error messages to guide us through the missing pieces. If it is a version mismatch, at times we might get to see warning messages, otherwise we will need to figure it out ourselves (googling helps as well). Using all of these hints, we try to fix the missing/mismatched pieces. We do not have a compilation of what needs to be installed in an outside environment to exactly match the Coursera environment…and in the absence of any error/warning messages, your guess could be as good as mine.

1 Like

I saved all LAB Files and tried to run the very first cell, getting this error


1 Like

Hello @Sumaiya639 ,

Have you tried:

conda install -c conda-forge ipympl

in your project environment ?

In any cas keep at it, working locally is a good choice.

Francis

1 Like

Hi @shanup,

This is very good explanation. I have downloaded all lab files by click on “Download all fiels”. I must have missed certain applications in my PC because I could not open .ipynb and python files like lab_utils_uni.

When you say ‘saved it in your local machine (with the same directory structure) and pointed your IDE working directory to wherever these files are, then it should ideally run.’ 1)what do you mean by this? Did you mean download files need to save in C:/user name/MLS folder? 2) what directory structure I should follow and 3)what need to do to point my IDE working directory to the folder where all files saved?

Your guidance on this would be greatly appreciated and I look forward to hearing form you soon.

Many thanks, Christina

1 Like


Sometimes a picture can help.

1 Like

Hi @Francis60
Thank you for sharing the screenshot.
I’d be very happy if I can view the files just like what you did. But I could not work out what applications you have on? I’d appreciate if you could explain more what I need to do and what applications are required to install in Windows?
Look forward to hearing from you.
Many thanks
Christina

1 Like

While viewing a lab (for example…)

  • Use File->Open.

  • Find the file you’re looking for here:

  • Click on the check-box and then you get an option to download the file.

1 Like

The other method is to use the “Lab Files” menu.
You get a list of the files, and you can use the “Download all files” button.

1 Like

Hello @Christina_Fan,

Do you have python installed already?
You also need jupyter notebook to work into your browser locally or and IDE application like vscode(mine) or PyCharm.
I don’t know from where you start but if you are a beginner go with jupyter notebook, an IDE is very helpful but you could have too much to learn at one time.
One important thing is to create virtual environment(s) for your projet(s). You can manage virtual env with conda, pyenv or poetry. There is also Anaconda navigator to manage all those guys into a GUI (personally I do not recommend unless the other options are too complicated).

1 Like

Hi Francis

I was finally able to figure out how to make it work on my local laptop.

Basically I just installed Python, then use pip to install jupyter notebook and other packages used in the course. I hope this may help others who experienced the same challenge.

So far I was able to run all except the Course 2 W4 Assignment, somehow I encountered this error which seems to relate to a python file. I wonder why it got an error here and not in any other jupyter notebook files.

I’d appreciate if you/anyone could shed a light on this?

Thanks, Christina

Hello,

Check if utils.py is present in your notebook folder.

You should also take the time to familiarize yourself with virtual environments, as managing dependencies can become a real nightmare.

Thank you Francis. I appreciate your assistance.

I can see utils.py file in the folder, I wonder what could be other reasons caused the error?
image
Are you able to point out what I need to do to fix the error shown here:

Many thanks and I look forward to your insights?
Christina

Hello,

You may experience several problems.

  1. local settings leading to discrepancies (dependency issues for what I suggested to use virtual envs)

  2. Your answer in exercice 1 can be wrong leading to assert np.allclose(right, expected['right']) and np.allclose(left, expected['left']) = False into public_tests.py at line 81.

  3. Your local implementation does not accept for some reason the escape character “\”

# Case 3
X = (np.random.rand(11, 3) > 0.5) * 1 # Just random binary numbers
X_t = np.array([[0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0]])
X = np.concatenate((X, X_t.T), axis=1)

left, right = target(X, [1, 2, 3, 6, 7, 9, 10], 3)
expected = {'left': np.array([1, 3, 6]),
            'right': np.array([2, 7, 9, 10])}

assert np.allclose(right, expected[‘right’]) and np.allclose(left, expected[‘left’]), f"Wrong value when target is at index 0. \nExpected: {expected} \ngot: \{left:{left}, ‘right’: {right}\}"

One idea could be to test online in coursera your answer because your code can be right but local computation can slightly differ at some decimal position.

Bonne chance