I downloaded all the files in ML specialization for my future revision, as suggested in the course. Now my computer Windows 10 can’t open them. I tried installing Python but still it doesn’t work. What is the best way to open the ipynb files? Thanks so much.
If you plan to only read the text, then you may use Google Colab to open them.
However, if you plan to run the lab, then another issue is that if you don’t have the same Python environment as on Cousera, then a chance is that you might not be able to run through all the cells without any error. By the same environment, I mean to have the same version of Python and other libraries used. Google Colab won’t give us that. Normally we need to do quite a bit of work to set each environment up ourselves.
@Marapeledona@rmwkwok I think if you want to use .ipynb (which stand for Interactive Python Notebook) on your local machine you can installed the Anaconda on your machine which is one of the best option. However you can go with VS code and other software for your local machine.
If you want to use it online again you can go with Google Colab as suggested by @rmwkwok or Kaggle Notebooks.
So if you tried to open the .ipynb file using simple Python software on your system it will show all the code cells, markdown, and metadata as these file are in JSON format.
Now If you are able to master all the environment setup as on Coursera. I think you may succeed in replicating it on your local machine. But it requires lot of efforts to check each and every function and libraries (version and all) associated with code. Thats why when it come to do coding on the Coursera you are getting some of the ready made recipe (i.e., ready use setup environment).
Thank you Raymond and Prashant. Let me recap. If I just want to view, I should download Google Colab, which uses simple Python software to open .ipynb files. If I want to code and run the exercises, I should best download Anaconda. I have currently downloaded the latest version of Python. Would you recommend me some links by which I could follow the protocol to download Anaconda, since my goal is to run the files and play around?
Colab is an online service provided by Google. You open their web page, and then you can upload your notebook there to view (and run) it.
You can write your own notebooks on Colab also. If you want to use a lot of computing resources, you’ll need a paid account. Small projects you can run for free.
Given the challenges of installing Anaconda or VSCode locally, I’d go with an online service (unless you’re an IT wizard or have a lot of experience).
To run, as I said, the issue is the environment (getting the right version of Python and library). There is no steps or protocal for how to go from zero to one environment that gets a specific lab to run. Getting the anaconda is just a good start, and the heavy lifting is what comes next.
I can provide some starter steps and note where extra exploration work from you will be needed. Steps 1 to 6 below are relatively easy. Step 7-8 require your inspection work and can start to get uneasy. Step 9 is the biggest thing that will require a lot of your work and time, and if some library version is no longer downloadable, it will either be impossible or takes it to another level of difficulty.
Get your lab files (as structured on Cousera) unzipped and ready in a location of your computer.
Google “anaconda” for its official website and download the version that works for your machine.
After installing anaconda, you will already have the default Anaconda Python environment. The thing is, default environment does not mean an environment that will work for each and every one of your labs. It may work for some, and not for the others.
Now we try our luck and see if the default environment works for one lab. Google for something like “how to launch jupyter lab on Anaconda” for some steps. If you follow the steps and fail. This may mean that the “jupyter lab” software is not pre-installed, and you will need to google for instructions to install it. After that, launch it.
Jupyter-lab has a file explorer on the left (Cousera doesn’t) with a base directory pointing to some folder on your computer. You will need to google for steps on how to find out that folder path, and then either change the path to the location storing your lab files, or move your lab files to the default path.
After you can view your lab files on Jupyter-lab, you may double click the ipynb file to open it, and run it like on Cousera. If everything works, then this lab is okay. If something does not work, then the heavy lifting comes.
I guess there could be at least 3 kinds of error. (1) ImportError - this means a certain library isn’t installed in your environment; (2) FileNotFoundError - this means you didn’t get all lab files and place them exactly the same as the file structure on Cousera; (3) Other run time error - this can mean anything, including a certain library’s version doesn’t match with that on Cousera.
If (2) happens, that’s easy, you get the files ready.
If (3) happens and you find that it’s a library version issue or if (1) happens, then you will better setup a new environment and get all packages installed there as required. Before you do that, you will need to first go back to Cousera to (1) get the list of which versions of what packages are being used and (2) find the Python version. You may google for how to get the list and the Python version. Then google for (1) how to setup a new environment on Anaconda with the required Python version, (2) how to link your new environment to Jupyter lab, (3) how to activate your new environment and install packages. You want to do (2) so that your jupyter lab can switch between environments and you want to do (3) to make sure the packages are installed in the correct environment that you just created and they won’t mess with your default environment and other environments created by you for other labs.
If you reach step 6 for a certain lab and it works fine, then no problem. Otherwise, your code may stop running as expected at a certain code cell. Then before rushing to step 9 which is really going to be very time-consuming, I would recommend you to stop and think (1) whether you can bypass the error, (2) whether you really need to run the rest of the code or (3) whether you can code your own version to replace the problematic part, because getting through step 9 won’t make us learn better in machine learning but is going to cost a lot of energy without any guarantee.
I should also warn that we probably won’t be able to support you through getting a new environment ready for a specific lab, because remote trouble-shooting on personal system is never straight-forward and actually will require skills from both sides, so if you want to try it on your own, that’s okay, but again, avoid step 9 if possible.
Thank you, Raymond. That is overhwhelming. Would it not be easier to do as TMosh mentioned above, that I can upload my files to Google Colab, both to view AND run them, instead of this heavylfiting required for Anaconda? Or is setting up the environment in Google Colab also a major issue?
Anaconda will give you an Anaconda’s default environment that may be ok for some labs and not the others. Similarly, Google Colab will give you a Google Colab’s default environment that may be ok for some labs and not the others.
If you set up an environment with Anaconda, that environment is in your computer and you won’t lose it. If you set up an environment on Google Colab, that environment will go after the session is ended. As far as I know, there is no permanent session for Google Colab.
As I said, I always advice to avoid step 9, the most heavylifting part, if you don’t have to run the part of the code that a default environment won’t do.