How to remove .ipynb checkpoint

Add “.ds_store” too. Most the Mac Users will face problems with .DS_Store Files. @ecdrid Please include this change also in you pull request

if label not in (’.ipynb_checkpoints’,".ds_store" ): instead of if label not in (’.ipynb_checkpoints’):

1 Like

Going into the directory and typing “rm -r .ipynb_checkpoints/” got rid of the problem for me.

Thanks for the help

Sure…
Sorry for late reply
Also __MACOSX Or something?

It’s already done…
Thanks and Sorry for late reply…
Kind of lost in the forum due to it’s exponential expansion

I am using Azure Deep learning VM and connecting through GIT BAsh as terminal.I cloned the file from the

the git location as mentioned in below image

but when i start running the lession1 why the content is different than the 2018 content like below

Original Git folder contents lesson1 page details as shown below

Please let me know did i copied/cloned from wrong location.
or do we have to edit the wiki page info.
@amritv and @Chris_Palmer do u have any idea about this ?

https://github.com/fastai/courses is wrong I think…

What you want is https://github.com/fastai/fastai

I wonder why that wiki page is pointing to this - either the wiki page is not for the current course, or it must be an very old reference…

1 Like

That is the 2017 course wiki.

Complete n00b here, but this worked for me.
After lesson 1 I made a folder emmanotemma with subfolders train and valid in exactly the same way as dogs and cats in lesson 1.
I duplicated the lesson 1 notebook and that is where the error may have arisen. Again, n00b here.

Running the following code in the notebook worked for me:

!rm -r data/emmanotemma/.ipynb_checkpoints
!rm -r data/emmanotemma/valid/emma/.ipynb_checkpoints
!rm -r data/emmanotemma/train/emma/.ipynb_checkpoints
!rm -r data/emmanotemma/valid/notemma/.ipynb_checkpoints
!rm -r data/emmanotemma/train/notemma/.ipynb_checkpoints

Of course you will have to insert your own folder instead of emmanotemma and corresponding subfolders.

9 Likes

thanks! that works for me too :slight_smile:

thanks worked for me

I had the same problem and this code helped solve the issue. Thanks.
Is there a way to solve it permanently? I read something about adding a git ignore file in the repository, not sure if that works.

This seems to solve the problem!
(Although it would have been good to know why the files are getting created at all)
A more generic way of doing this (so that you don’t have to keep changing the folder name for every dataset you load in) -

UPDATE 1 - Thanks to @wilpat for pointing this out.

%cd '{PATH}'
!find '.' -name '*.ipynb_checkpoints' -exec rm -r {} +

This will recursively search all sub-folders in the dataset for the checkpoint files and delete them.

5 Likes

The read_dirs function has been updated with your code with a little extra, but i still got the same issue.

I had to add a check for ‘.ipynb_checkpoints’ in the loop creating fnames.
Pasting the edited code:

def read_dirs(path, folder):
lbls, fnames, all_lbls = [], [], []
full_path = os.path.join(path, folder)
for lbl in sorted(os.listdir(full_path)):
    if lbl not in ('.ipynb_checkpoints','.DS_Store'):
        all_lbls.append(lbl)
        for fname in os.listdir(os.path.join(full_path, lbl)):
            if fname not in ('.ipynb_checkpoints','.DS_Store'):
                fnames.append(os.path.join(folder, lbl, fname))
                lbls.append(lbl)
return fnames, lbls, all_lbls

I keep getting the issue of
find: ‘{PATH}’: No such file or directory

A dumb question :raised_hands: but are you running this snippet after loading in the path variable?
In lesson1.ipynb this is on input 6.
PATH = "data/dogscats/"

Yes i am.

Got it now. My bad. Two mistakes here.
!cd doesn’t actually change the path. Some weird thing with ipython and bash.
Should have used %cd

Second, in the second line, if I had cd’ed into the directory there is no need for the {PATH} variable. Should have replaced that with .

Leaves me wondering why it worked for me in the first place. Updating my answer.
Thanks for pointing this out!

1 Like

There is a drop function in the notebook, but it does not cover everything. When you delete a cell, there is a Undo Delete Cell item in the Edit menu, but you can also undo changes in text in cells by pressing Ctrl-Z (or Cmd-Z). I think (though I’m not 100% sure) of having a buffer to undo each cell: so that you can undo changes in separate cells independently. 156-315.80 Exam Questions This means, of course, that you have to click the cell you want to undo things before you can actually undo anything.

If you use the JupiterLab file browser (e.g. click on the “Files” tab on the left) to create files or directories, or upload files, it will create an “.ipynb_checkpoint” sub-directory in the directory that you are modifying.

So, for example, if you used the File browser to upload images into “train” and “valid”, it will create checkpoints in those directories.

Don’t know if this behavior can be suppressed. I used the "rm -r … " command (see previous posts) to remove the checkpoints after they were created.

1 Like

thanks worked for me

I had the same problem. I fixed it by going through ALL folder directories for the project I am working on did a ls -a to see if the file was there, if it was I used the following command to remove of instances:
rm -r .ipynb_checkpoints/

Hopes this works for you!