A package/module is missing

If you hit an error like “No module found”, “the xxxx is not installed”, you are not likely to be in the virtual environment. In Codespaces, we have two separate environment, base and venv . Each environment has its own set of software packages. The assignment is built on the venv environment. And you hit the “No module” error because you might be in the base environment. To solve this, activate the virtual environment named by typing the following line in the terminal:

source /home/vscode/venv/bin/activate

You can check if you are in the base environment or virtual environment through the prefix of your command line:

Screenshot 2024-01-25 at 4.17.14 PM.png

In the first line, I am still in the base environment. By typing the command above, you should see this (venv) before your username.

Failed to build Codespace

Sometimes, Codespaces fails to create a virtual machine (and you will see a pop up window saying “Running in Safe Mode”). This is likely due to an excessive amount of disk space being assigned to the Docker image caches. A simple solution is to rebuild Docker. Please refer to the step-by-step instructions provided here:

Rebuilding the container in a codespace - GitHub Docs