Issue
As mentioned in the coursera help articles in order to download notebooks from the class we need to zip all the content of root folder into single file and download the final workspace.tar.gz using these steps: but it is not working all courses.
Anyone knows proper way to do this !!
Solution
- Open the home folder of your coursera jupyter notebook:
you can do this by opening any of the course notebooks and thanm selectingfile> open
or by clicking onJupyter icon
at the top left corner of notebook.
- Open terminal inside the notebook:
On the home page of your notebooks, at the top left corner selectnew> terminal
- Check in which dir you are:
this is important as different courses have their materials in different dir!
Some courses have a dir namejovyan
and inside that you have two folders generallywork
andwork-ro
.
in work you have your actual content that you can see on your notebook home page.
in work-ro you have onlyread_only
folder. This same folder you have it in yourwork
dir but you cant open the content of that folder after downloading! (I dont know why I cant open it)
I turns out that this folder contains images which are in your notebooks. that is the reason you will have to zip both these folders.
Its not necessary that all the course have this folder namedwork
!
In some courses materials are directly insideroot
dir. In such cases you can find the directory with your material by finding folder name ending with -ro
Ex in one of my course I located a folder namedTF-ro
and there was another folder namedTF
containing all course material! As per above patternTF-ro
contained read_only folder.
Just in case you are wondering how to navigate inside terminal: [Use these commands]
ls: list everything inside the folder
cd: to change the folder you are currently in
Ex:cd .. #go to previous folder
cd <dirname> #go to that specified folder
- compress both the folders using tar:
Navigate to the folder which contains both of these folders i.ework
andwork-ro
or if you read my second case thanTf
andTF-ro
or folders in your case.
Use this to make tar file:
Use this when your folder contains only two dirs that you want
tar -czvf <choose a name>.tar.gz <address of dir to compress>
Ex:tar -czvf data.tar.gz ./
use this when you are in root folder and you have multiple dir along with the folders you want
tar -czvf <choose a name>.tar.gz <dir1 addres> <dir2 addres>
Ex:tar -czvf data.tar.gz ./work ./work-ro
Just in case you are wondering!
./ means current folder.
- Check the size of your tar file:
This is also important!!
If your process of making tar file is taking too long or your terminal appears to be frozen ! than there are some big files in your home folder.
You can check the size of your tar file using:ls -lh data.tar.gz
. Normally the size should not be more than 10 - 15 Mbs.
If your size is in GBs than you are mostly downloading large amount of datasets and csv files!
you cannot download big files like this! [Workaround for this problem are mentioned below]
run this command:du
This will list all the dir's and the size of dir's in current folder.
Figure out which folder has more size.
Note: size shown in this commands are in Number of sections occupied1 section = 1024 bytes
Exclude these folder wile making tar...
In order to remove previous tar file runrm data.tar.gz
make the tar like this:
tar -czvf <yourName>.tar.gz --exclude=<address to exclude> <dir/dirs to zip>
Ex:tar -czvf data.tar.gz --exclude=./work/data --exclude=./work/- ./work ./work-ro
- Move the file :
You can only see the content in the work folder (or any other folder your content is in) on your class's notebook home folder.
This is why we will move over tar file to that folder. move using this commandmv <file name> <location>
Ex :mv data.tar.gz ./work
- Download your file:
Now you can see your file in your home folder in your browser. simply select the file you will see download option available at the top !!
Sometimes you dont see the download button on the top, in such cases...
right click your file> save link As> then save it with .tar.gz extension
Just to confirm check the size of file you have downloaded and one in your classroom!!
Work Around for downloading big data sets:
Your course generally does not use all the csv's or data sets that it has stored in the data folder. When you do the assignments see which files are / data sets are used and download only those manually.i.e opening that file on your classroom and downloading it using using file> download
if you still want the entire thing than make separate tar file of that folder only. Than split the tar file (you will find it online easily) and than download as I have mentioned earlier! After the download it is necessary to concatenate the files:
cat allfiles.tar.gz.part.* > allfiles.tar.gz
I would suggest not to waste time in doing this!! Just download what is required and that's it!!
I hope this was helpful !! cauz I spent 5 hr figuring out how to do it !! ENJOY !!
Answered By - luckyCasualGuy
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.