I’ve been trying to run the fastbook notebooks in a codespace, but I’ve been running into a few issues. I’m going to document them here as I solve the issues manually.

I created a codespace from fastai/fastbook and then opened 02_production.ipynb.

  • The first problem was that I could not run the notebook in vscode as there was no python interpreter
  • This was solved by installing the vscode extension for notebooks by clicking on extensions and installing Python.
  • Choose the kernel Python 3.10.4. Do not choose the venv kernel.
  • Then I needed Jupyter notebook support, so I installed the extensio Jupyter.
  • Then in the first cell import fastbook failed with ModuleNotFoundError: No module named 'fastbook'
  • So then I click the hamburger menu and selected View/Teminal and ran pip install fastbook
  • Fastbook installs lots of libraries that you will need including pytorch. This took a while to run. Now Bing search is not working. I guess this is why Jeremy started to use Duck Duck Go.
  • There is a solution at this link.
  • Finally got my key. Inserted my key into `key = os.environ.get(‘AZURE_SEARCH_KEY’, ‘ThisIsNotMyKey’)’
  • Hooray! now I have 150 bear images.
  • Needed to change the line bear_types = 'grizzly','black','teddy' to bear_types = [ 'grizzly','black','teddys' ] do it is a python list.
  • Had to delete the bears folder to refresh bear data.
  • After running the code we should have three folders inside bears. They are black, grizzly, and teddy.

This is too freaking hard

My next solution is to add a devcontainer folder to fastbook so that I can run the notebooks in a docker container.

I just copied the devcontainer folder from fast/ai/course22 to fastbook. I then opened the folder in vscode and clicked on the green button to open the folder in a container. I then opened the 02_production.ipynb notebook and ran the first cell. It worked! I now have 150 bear images.

One issue:

  • I had to install the Jupyter extension in VS Code.

Happy DevContainering,

Brian

Lovell Portrait