Beginner: Setup ✅

Hi All,

I’m having issues with setting up fastai in jupyter notebooks on my MacBook Air (or maybe I just don’t know how to use jupyter…).

I have installed fastai and nbdev using mamba as per Lesson 2 video:

Then in jupyter notebook I called !pip install fastai and a message states that fastai is already installed. However, when I try to import fastai modules, it says that the Module cannot be found.

I feel like I’m missing something fundamental here? Thanks in advance for any help or suggestions.

Hi All,

Found the answer on stackoverflow. I’m leaving the link her in case someone has the same problem as me:

jupyter-notebook-cant-find-modules-for-python

3 Likes

Not exactly sure how to resolve your issue, but my suggestion would be for beginner just to use either kaggle/colab notebooks to get started.
The kaggle list for all the notebooks jeremy uses can be found here:
Jeremy Howard | Notebooks Grandmaster | Kaggle
Otherwise you would have to spend large propotion of your learning time dealing with dependency issues and such, and it could be quite frustrating often times. :sweat:

2 Likes

Great to hear~

Thanks, Josh. I actually started with Kaggle as the book and the lesson notes suggested that it’s too hard for a beginner to run ML code locally. However, for some reason, my Kaggle CPU always shoots up to 100% and I lose the autocomplete feature. I thought I would give jupyter notebooks a try just for the autocomplete feature. This is probably because of my coding inexperience, but I struggle to code without autocomplete and IntelliSense. That all being said, you are right - I will give Kaggle another try.

1 Like

(nevermind, I fixed it; after reviewing the notebook on Kaggle, I realize the function was defined up in an earlier cell)

Hello, I have trouble running a piece of code on my system, from this timestamp: Lesson 3: Practical Deep Learning for Coders 2022 - YouTube

I am having trouble running plot_function() as it is written, running into unknown argument issue. From this thread, I conclude it is because of older version of fastbook.

But, how do I get the latest version? I am running the following packages below. How do I get the latest fastbook? From the Jupyter notebooks, they are running !pip install -Uqq fastai to install.

Hi all,

I’m running on a Windows 10 machine and I’m trying to follow the steps in Lesson 2 for fastsetup. I’ve done the following steps so far:

  • Install GitHub Desktop
  • Install Windows Terminal from the Windows Store
  • Install wsl using the command wsl --install
  • Reboot PC
  • Activate WSL in terminal by typing wsl
  • Fork fastai/fastsetup: Setup all the things (github.com)
  • Navigate to the directory of the fork
  • Type ./setup-conda.sh

This is where I’m stuck. I’m getting the error “/usr/bin/env: ‘bash\r’: No such file or directory”

I’m a complete Linux noob and have no clue how to proceed. Google didn’t give much help. Any help is appreciated.

If not, is there any reason I shouldn’t just set things up by letting VS Code or PyCharm install my conda interpreter and pip install the rest of the missing packages? Thank you.

Hi all,
I’ve started trying the bird_or_not image classifier in lesson one and I was wondering if fast ai uses GPU by default. I have an Nvidia GPU installed locally and have been trying to figure out a way to make my resnet use the GPU while training.
Basically, I need a fast ai alternative of

device=torch.device('cuda')

Any help is appreciated. Thanks in advance!

It usually does this automatically. Check

import torch
torch.cuda.is_available()

to see if everything is set up correctly. If it returns False there might be something wrong with the installation.
The fastai way to move data manually to the GPU is: something.to('cuda') (something.to('cpu') to moves it to the cpu).

1 Like

Thank you. I was working in a different environment where pytorch was not installed. Now I’ve changed the environment and I am getting the following error:
BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.

Above is the code and I’m using a windows pc with Nvidia RTX 3070 gpu.

The error seems to be occurring when running verify_images method.
Found the solution here given by Life.exe.

2 Likes

Console can open shells for many tools.
Your console has opened up a Powershell session, you just need to open one for Ubuntu
Click the little down arrow and select Ubuntu.
Then you will have an ubuntu bash console, and the commands will work from there.

image

To make this window your default for next time you open the console app, you will find that option under the settings menu.

2 Likes

Thanks Allen. How is that different from running the command wsl from the command prompt. Also, now that I’m using the dropdown to select Ubuntu, I guess now my challenge is finding my linux home directory and pointing my GitHub Desktop at it. Is that correct or am I missing a step that’s making this harder?

Edit: Easier than expected. Found by typing explorer.exe .
Edit2: Now permission denied. There has to be some setup steps that I’m missing.

Preformatted textHow is that different from running the command wsl` from the command prompt.

Good question. one that @bencoman can likely answer better than I can.

I think the wsl from command prompt was added as a shortcut,
if you run it from the windows start menu, it will launch but the icon in the console tab still shows the ‘cmd’ icon, so I suspect it is still limited in some way or has an extra layer of redirection.

However if you launch from windows start menu choosing ‘run as administrator’ you will see the linux icon in the console tab, so I suspect that is that same as choosing from inside console.

Try all 3 and see if there is a difference with the permission issues you are having

1 Like

AFAIK there is no difference starting the a Linux shell from the pulldown or typing wsl at a windows command prompt. I was impressed that @AllenK noticed the small detail that I’d missed of the powershell icon in the tab…
image

but with the additional info that you’d run wsl from Powershell, its irrelevant that the original shell was Powershell. Your commands are processed only by the Linux shell.

btw, I usually start my Linux shell doing WindowsButton-R wsl <enter>

now my challenge is finding my linux home directory

I think you may already have found it, but you should see a Linux icon in Windows Explorer…
image

and pointing my GitHub Desktop at it

As a general rule, I would hesitate to use GIthub Desktop to manage files on WSL because of potential line endings issues. YMMV though, since there are settings to help, that you should familiarise yourself with so if you want to give it a go…

Now permission denied. There has to be some setup steps that I’m missing.

To assist, you would need to report your actions leading up to this error.

1 Like

As a general rule, I would hesitate to use GIthub Desktop to manage files on WSL because of potential line endings issues. YMMV though, since there are settings to help, that you should familiarise yourself with so if you want to give it a go…

I see. I only went the GitHub Desktop route because it was recommended in the lesson 2 video the way Jeremy does at the below timestamp

I’m totally open to other ways to set things up as I was merely trying to follow along with Jeremy. I think I’m going to google some information about setting up a Conda environment in a Ubuntu on a Windows machine rather than just following the steps in the video.

Thank you both for the help and patience!

1 Like

If you are using WSL on Windows 11, Linux gui apps will work, so installing Github Desktop for Linux may be an option (I haven’t tried it yet)

I think I’ve managed to git things working by not using GitHub desktop and instead using the below snippet. I still wonder if there’s something obvious I’ve missed, because I can’t follow Jeremy’s steps from lesson 2, and from searching I can’t seem to find anyone else with same issues as me. Anyways, thank you for the patience and help. Hopefully I’m good to go now.

git clone https://github.com/fastai/fastsetup.git

1 Like

I’ll sometimes clone using HTTPS if I’m on a new system, not yet set up SSH keys and only want a quick read-only copy. This provides exactly the same clone as via SSH.

The difference comes when you want to push changes back to the server. When you cloned using SSH, the push authenticates transparently. When you cloned using HTTPS, it used to be that you had to enter your username/password EACH time, except github has now dsiabled username/password and you need to have set up a Personal Access Token (PAT). Down the bottom of that link it indicates there is some way to cache your PAT, but I’ve not used this method so can’t advise.

I can’t seem to get the first lesson up and running. I have a MacBook Pro M1 Max and the notebook seems to get stuck at learn.fine_tune(3) step. What’s interesting is that it was working fine (slow but worked) on my MacBook Air M1 just a month ago or something. Does anyone know what might be the reason?

I tried running Jupyter with this OMP_NUM_THREADS=1 jupyter-lab but it didn’t help.

I also noticed that the download_images block is taking a lot of time even on my beefed up machine.