anybody else using Ubuntu on Windows? In my laptop I’m using arch linux and everything is working fine. However, since the laptop has no GPU I tried to configure jupyter notebook with all the libraries necessary, in Ubuntu for Windows 10, but I wasn’t able to run the notebook from the first lesson.
The error I’m getting is “ImportError: cannot import name ‘BatchSampler’” – I have searched on google/on the forums, but can’t find anybody with the same problem. Maybe I have a wrong library version installed? If someone has had the same issue, can you give me some tip?
Below is a screenshot of the traceback in jupyter notebook.
Thank you for your response! I had no idea that it would have no GPU support… In that case, it makes no sense to configure it in my windows desktop. I’m going to try to setup AWS using the free credits.
Can you please elaborate, I didn’t understand. I’ve same problem in my machine. I do have Nvidia GeForce 820M GPU. In python3, I can’t run “from torch.utils.data.sampler import BatchSampler”.
Thanks in advance.
I suspect this has to do with pytorch versions. Installing through conda gave me version 0.1.12_1, so I’ll try installing the current version 0.3 from source. Not only because of this, but I had other problems when I tried running lesson1 on my desktop - memory filled up and crashed.
I just ran into this. I had started with the correct version of pytorch 0.3 installed using “conda install pytorch -c pytorch”. In the course of installing some other files to get past errors, pytorch 0.1.12 was installed I believe as a dependency(?) which doesn’t include BatchSampler. Running “conda install pytorch -c pytorch” installed 0.3 again and I was able to run.
I also have the same problem with a newly created Paperspace machine (after running “git pull” and “conda env update”).
(fastai) paperspace@psetuga1v:~/fastai$ python -c “from fastai import *”
Traceback (most recent call last):
File “<string>”, line 1, in <module>
File “/home/paperspace/fastai/fastai/init.py”, line 1, in <module> from .basic_train import *
File “/home/paperspace/fastai/fastai/basic_train.py”, line 2, in <module> from .torch_core import *
File “/home/paperspace/fastai/fastai/torch_core.py”, line 2, in <module> from .imports.torch import *
File “/home/paperspace/fastai/fastai/imports/torch.py”, line 4, in <module> from torch.utils.data import BatchSampler, DataLoader, Dataset, Sampler, TensorDataset
ImportError: cannot import name 'BatchSampler
Ran into the same error. I think it’s got to do with the move to the rewritten fastai library.
What fixed it for me was just reverting to an earlier, working commit by issuing: git checkout 2e1ccb58121dc648751e2109fc0fbf6925aa8887
That puts the repo back to an earlier stage which gets everything working for me again. Note that this isn’t a resilient fix: if you intend to work on the fastai library code, this definitely wouldn’t be the way to go. Then again, if that’s the case, you probably know enough to fix the underlying root cause.
It seems to be the best option for now as they changed a lot to the fastai repo to use pytorch 0.4.1 features, but the setup process still using 0.3.1. Installing 0.4.1 is an option but in the future who knows what might break.
It seems like you already had your fastai conda env set up. In the step 8 of the howto you can see the instruction as: cd courses\dl1 del fastai mklink /d fastai ..\..\fastai cd ..\..
If you already did the above things, open an anaconda prompt, cd into fastai folder, activate fastai env and run these cd courses\dl1 rmdir fastai mklink /d fastai ..\..\old\fastai cd ..\..
Don’t try to import fastai from python started in the command line, run jupyter notebook and open lession1.ipynb in courses/dl1 and run the first 6 blocks of code. It should run without problem and torch.cuda.is_available() and torch.backends.cudnn.enabled should both return True.
Hoping to be helpful here I shared a Google Colab notebook ready to go, in order to make fast.ai course ready to go to anyone.
It has comments about common issues I solved too.
You are free to comment or fork it and let me/us know if/how you’ll improve it.