"ImportError: cannot import name 'BatchSampler'"

Thanks ! This will save a lot of time.Waiting notes for other lessons too.

In my case I enabled Developer mode in windows by opening start menu and search for developers settings, however I’m using windows 10 pro and not sure if you have the same. Also I saw that you ran del fastai, which doesn’t remove the symlink but rather delete files in fastai folder, instead of rmdir fastai. You should check to see if you had deleted any files in that folder and revert changes made to it, then run only the second bunch of code in my previous post, not the first one.

Hello, i pointed it to the old fastai but now in the jupyter notebook it tells me it can not find imports.

do you have an imports folder in /old/fastai? thanks

Hi Jake,

I tried to replicate the same steps.Still I am facing the issues. I am not able to import fastai library.Please suggest how to proceed.

Thanks,
Ritika

No. If you can’t import. It is possibly related to the folder structure. Make sure the symbolic link is point to your working directory.

1 Like

can you post the error so we can have a look please

Thanks, that was my issue. I had tried making a new folder for all Kaggle competitions and I had it as fastai/kaggle/fastai(symlink) I had to add another layer to the structure so now I have fastai/kaggle/competitions/fastai(symlink)

1 Like

Hi Jake,

Please find the screenshot attached.

Thanks,
Ritika

Hi @ritika26 Try this ln -s source_file myfile (details https://kb.iu.edu/d/abbe)

Personally, I prefer using absolute paths to make sure the folder structure is right.

it seems like you are using windows 10, then try open start menu and search for ‘developers settings’ and switch to developer mode, that should allow you to perform mklink command

After switching into developer mode I am able to create a symbolic link but my jupyter notebook failed to load.

Thanks,
Jake

Thank you @Moody for sharing the link. I am able to create a symbolic link but I am facing another issues like my juptyer notebook is not loading.

Any suggestion why I am getting this error now?
Thanks,
Ritika

I have never encountered this problem, but you can try these few things

  • Try in another browser (e.g. if you normally use Firefox, try with Chrome). This helps pin down where the problem is.
  • Try disabling any browser extensions and/or any Jupyter extensions you have installed.
  • Some internet security software can interfere with Jupyter. If you have security software, try turning it off temporarily, and look in the settings for a more long-term solution.
  • In the address bar, try changing between localhost and 127.0.0.1 . They should be the same, but in some cases it makes a difference.

Hope this helps

Thanks Jake for your support. Now I am able to run the codes that is available in dl1 folder in jupyter notebook. But when I am running the jupter notebook under ml1 folder I am getting the error

ModuleNotFoundError: No module named ‘fastai’

Do I need to create symbolic link for ml1 also?

Thanks,
Ritika

yes, one symlink should be created per course, just follow the same steps for create symlink as I posted but change dl1 to ml1 and you should be good to go. Remember to cd to the right folder, which is ml1 in this case

I created the symlink for ml1.Then i run the code in jupyter notebook I am still getting the error ModuleNotFoundError: No module named ‘fastai’

Thanks,
Ritika

I believe you are using the wrong name, the symlink should be named fastai, and not fastaiml .i.e mklink /d fastai ..\..\old\fastai

when i used fastai i am gettinng the below message

@ritika26
go to fastai\courses\ml1 and delete the fastai file (or folder) then run mklink /d fastai ..\..\old\fastai and try again