Best practices for setting up Fastai on Mackbook Pro with M1 Max Chip


I recently got the MacBook Pro with M1 Max chip :star_struck:. I’d like to have local Fastai installed on the system for quick prototyping. What is the best practice of setting up the Fastai.

Shall I install Fastai directly on the Mac OS or use virtual platforms like docker? Any ideas, hints or links to get Fastai configured on the MacBook Pro with apple chip from the past experience will be much appreciated.

Thanks in advance

Kind regards,


Hi, I just installed fastai on macbook with M1 Pro by running

mamba create -n fastai
mamba activate fastai
mamba install -c fastchan fastai

Now in Python I see that torch.backends.mps.is_available() is True and I can set models to device like .to('cpu') or .to('mps')

Let me know if you are using M1 GPU in your training


Hi Kasiannenko,

It worked for me as you said so no need for additional configs. I tried running a model using mps and it is training faster than cpu. Cool.


1 Like

For those using pip, pip install fastai also works.

1 Like

I’ve spent A LOT of time trying to get my M1 Mac working with the course using mps…

Had different breakages at Lesson 1, 2 and 4 sadly.

Issues with versions mostly around protobuf, pytorch, python etc.

My solution for the time being is to resign and say that Macbook’s aren’t currently the ideal machine for the course (and tbh probably DL) → currently using VSCode with remote environment in Paperspace. Seems to work pretty well now not dealing with setup issues and hoping I can focus now on learning vs. installing dependencies haha.

For anyone else who is interested, it’s super easy - just go here: Remote Jupyter Kernel | Paperspace



I am also using a MacBook Pro with Apple M1 Pro Chip, and I still cannot find out a solution to make that working properly. Every time I am trying to change the device to mps, I get no error but whenever I run a cell after having changed the device, I get the following message from Jupyterlab: "Kernel Restarting: The kernel for <jupyter_notebook_name> appears to have died. It will restart automatically.

Do you have any information about that? Any link to share that could be useful? I tried to gather as much information as possible until now but still unable to make things working.

Hello, everyone, my first post here :wave:. I got the course setup to work quite nicely on my M1, let me summarize what worked for me as of October 2023 (this setup is pip only, no conda / no mamba):

  • install Python from the official website
  • use pip and virtualenv to create a hermetic environment for the project
  • install pytorch from the official website using pip, then the rest of the packages needed

This seems to work pretty much out of the box and with GPU acceleration (which was added in pytorch ~1 year ago), save for the need to set PYTORCH_ENABLE_MPS_FALLBACK=1 when starting jupyter.

I wrote down full notes on this setup on my blog, check them out if anyone wants more detail.

PS This course is fantastic, thank you to Jeremy and the entire fastai community :clap: !

1 Like

From what I currently read in the docs, is not supported on Mac ?
I tried running fastai in a jupyter notebook locally on my Macbook Pro M1 but it didn’t find the module. (even though I installed it with pip/mamba)

I haven’t tried Igor’s solution yet…

Can you link to the docs you mention? It seems to be working for me.

hi, if you go to, under the header “Installing”, it says: "You can install fastai on your own machines with conda (highly recommended), as long as you’re running Linux or Windows (NB: Mac is not supported). "

Thanks for these, I am just trying with start with a M1 Pro 16GB MBP. So far I have used on your blog:


On chapter 1 when you train the text classifier with IMDB data it runs of memory, even if you decrease the batch size. It seems w/o PYTORCH_MPS_HIGH_WATERMARK_RATIO the python process will stop by the time it reaches around 30+GB memory even if it’s using the swap. With that flag it keeps on growing to 60+GB however there is actually less swap/memory pressure. It is weird but it seems to be keeping up, hope I don’t encounter other issues as I progress through the chapters. Slower compared to google collab T4 GPU.

Another observation I see is. With a batch size of 32 (default is 64) of the above IMDB cell. M1 Pro 16 GPU 16 GB ram seems to be the sweet spot, you get good utilization of the GPU as seen asitop (GPU wattage/usage). The memory pressure is also not too bad (green and orange, very little red), 64 batch size just swaps (lots of red and pegged in orange) too much so the CPU keep on running instead of the GPU as seen on asitop. I get about 14 mins per epoch on the M1 w/ batch size 32, while 7 mins per epoch on the T4 GPU with default batch size 64.