[2021] Fixing Common Notebooks Errors on Windows 10

OSError: [WinError 126] The specified module could not be found. Error loading “c:\users\admin\desktop\fastbook\venv36\lib\site-packages\torch\lib\caffe2_detectron_ops_gpu.dll” or one of its dependencies.

BrokenPipeError: [Errno 32] Broken pipe

TypeError: blank() got an unexpected keyword argument ‘disable’

UnicodeEncodeError: ‘charmap’ codec can’t encode characters in position 70924-70950: character maps to <undefined>

DLL load failed: The paging file is too small for this operation to complete*

NameError: name ‘log_args’ is not defined

I experienced a half dozen errors while using a virtual environment to complete the 01_intro and 02_production notebook files in the fastbook library on Windows 10. The errors were related to parallel computing issues, version conflicts, encoding errors, and memory issues. I troubleshot each error individually but they could’ve been avoided altogether by having the right installation instructions.

The following instructions create a virtual environment, install the fastbook requirements in the virtual environment, and install the virtual environment in the list of available kernels in Jupyter Notebook.

  1. git clone --recursive https://github.com/fastai/fastbook.git
  2. cd fastbook
  3. python -m pip install virtualenv
  4. python -m virtualenv venv
  5. venv\scripts\activate
  6. python -m pip install torch==1.7.1 --find-links https://download.pytorch.org/whl/torch_stable.html --no-cache-dir
  7. python -m pip install torchvision==0.8.2 --find-links https://download.pytorch.org/whl/torch_stable.html --no-cache-dir
  8. python -m pip install --upgrade fastai==2.2.7 --no-cache-dir
  9. python -m pip install --upgrade fastbook --no-cache-dir
  10. python -m pip install graphviz --no-cache-dir
  11. venv\scripts\python -m ipykernel install --name "fastai-pytorch" --display-name "FastAI (PyTorch)"

The instructions assume that your programming environment is already set up. It’s much easier to use cloud services like Gradient by Paperspace, Collaboratory by Google, or Kernels by Kaggle. However, if you’re going to set up your own programming environment then you can reference the following articles:

Linux:

  1. Install and Manage Multiple Python Versions
  2. Install the NVIDIA CUDA Driver, Toolkit, cuDNN, and TensorRT
  3. Install the Jupyter Notebook Server
  4. Install Virtual Environments in Jupyter Notebook
  5. Install the Python Environment for AI and Machine Learning

WSL2:

  1. Install Windows Subsystem for Linux 2
  2. Install and Manage Multiple Python Versions
  3. Install the NVIDIA CUDA Driver, Toolkit, cuDNN, and TensorRT
  4. Install the Jupyter Notebook Server
  5. Install Virtual Environments in Jupyter Notebook
  6. Install the Python Environment for AI and Machine Learning
  7. Install Ubuntu Desktop With a Graphical User Interface

Windows 10:

  1. Install and Manage Multiple Python Versions
  2. Install the NVIDIA CUDA Driver, Toolkit, cuDNN, and TensorRT
  3. Install the Jupyter Notebook Server
  4. Install Virtual Environments in Jupyter Notebook
  5. Install the Python Environment for AI and Machine Learning

MacOS:

  1. Install and Manage Multiple Python Versions
  2. Install the Jupyter Notebook Server
  3. Install Virtual Environments in Jupyter Notebook
  4. Install the Python Environment for AI and Machine Learning
1 Like