Troubleshooting

WSL2 Installation Errors

The following is a common error faced after installation of WSL2: the WSL2 terminal appears and then quickly disappears. To sort out this issue, follow the steps on this link. Fix 1 and Fix 2 should do the job.

To check if hypervisualization is enabled, a key component for WSL2 workability, there are two ways.

Method 1: Check windows features

Go to Start menu and type to Turn windows features on or off. Check that the Virtual Machine Platform, Windows Hypervisor Platform, and Windows Subsystem for Linux have been checked.

Restarting may be necessary if the settings have just been applied.

Method 2: Task Manager

Go to Task Manager>Performance. Check if virtualization is enabled. If it is disabled, and WSL2 is still not working after turning windows features on/off adjustments, then tweaking BIOS settings may be necessary.

Task Manager

Changing BIOS Settings

Changing the BIOS settings will differ between laptop brands. Browse the internet to search how to enable virtualization for your laptop model through the BIOS route. For example, here is a link showing how to enable BIOS in a HP laptop.

Errors in VS Code

It is highly likely you will encounter this error when you are creating a virtual environment for the first time in a VS Code session opened through the WSL2 terminal.

halima@DESKTOP-0APVM6M:~/xprize$ python3 -m venv .venv
The virtual environment was not created successfully because ensurepip is not
available.  On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.

    apt install python3.10-venv

You may need to use sudo with that command.  After installing the python3-venv
package, recreate your virtual environment.

Failing command: /home/halima/xprize/.venv/bin/python3

To solve this, first install the python3-venv packages. You may have to use the sudo command for administrator priviledges. Use the sudo before apt... in case an error arises when running the below code.

apt install python3.10-venv

The following output of running the above code shows that the installation was partially successful. Here is the result showing some partial success.

E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
halima@DESKTOP-0APVM6M:~/xprize$ sudo apt install python3.10-venv
[sudo] password for halima: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package python3.10-venv is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'python3.10-venv' has no installation candidate

Thereafter, to sort these issues for once and for all, update the python3.10-venv package to avoid future errors.

sudo apt-get update

Once the python package has been updated, install the python3-venv package using this code. Insert the sudo prefix to do the installation with administrator priviledges.

sudo apt install python3.10-venv

Thereafter you can run the docker pull commands.

Errors in Docker

Sometimes, due to some mispelling or the model being unavailable, you may encounter the following error:

Error response from daemon: pull access denied for naturalstate/mammals, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

One way could be you try to login to docker using the docker login -u <username> and your Personal Access Token (PAT). Secondly, try running the docker pull command again. If the error shows up, the model is unavailable or its docker hub name has changed.

The following error may occur when keying in the docker run command.

usage: main.py [-h] --phase_nb PHASE_NB --acoustic_test_data
               ACOUSTIC_TEST_DATA [--tmp_prediction TMP_PREDICTION]
               [--birdnet_processed BIRDNET_PROCESSED]
               [--detections DETECTIONS] [--sensitivity SENSITIVITY]
               [--min_conf MIN_CONF] [--rtype RTYPE]
               [--remove_audio REMOVE_AUDIO] [--save_out_audio SAVE_OUT_AUDIO]
main.py: error: unrecognized arguments: --slist /app/slist

Related to the first error, this occurs when running a non-existent model. Try pulling the correct model and make tweaks where necessary, such as pwd() line to match the name of the correct model existent on docker hub.

Also related to login issues is the below error:

(.venv) njuguna@KDZ:~/xprize/ml_models/birdnet_amphReptiles$ docker pull naturalstate/birdnet_amph_reptiles:latest
Error response from daemon: Head "https://registry-1.docker.io/v2/naturalstate/birdnet_amph_reptiles/manifests/latest": Get "https://auth.docker.io/token?account=njugunameg&scope=repository%3Anaturalstate%2Fbirdnet_amph_reptiles%3Apull&service=registry.docker.io": net/http: TLS handshake timeout

The above occurs when trying to pull a model but one hasn’t signed in to Docker. This problem is relative. For some laptops, either because of the underlying settings or not, when one signs into Docker Desktop, no login in the terminal is required. For some other cases, even after login into the Docker Desktop, a terminal sign in is required. The solution for the above error is to sign in to Docker via the terminal like so: ``docker login -u `. Provide your password and everything should be okay.

Errors when running the model

Copying and pasting files in Windows environments results in some .Zone.Identifier files. See more about them here.

A zone identifier file

These files, though not always, the case, can prevent your model from running. It is strongly recommended you delete these files, especially when they appear in the data folder prior to executing the ML Classification. This is not to suggest when a model fails to run it is attributed to the presence of .Zone.Identifier files in the data folder, or any other folder for that matter. However, in our experimentation, some of the models, like the megadetector_species model ran into errors when these files were present.

Errors related to reading and writing to external drive

See Chapter 07 on how to read and write outputs to external drive using the ML Classifer.

When running the docker run command to read and write outputs to an external drive, the following error may aris.

docker run \
    --shm-size=10.24gb \
    -v /mnt/e/test_classifiers/birdnet_amphReptiles/data:/app/input \
    -v /mnt/e/test_classifiers/birdnet_amphReptiles/birdnet_processed:/app/birdnet_processed \
    -v /mnt/e/test_classifiers/birdnet_amphReptiles:/app/tmp_prediction \
    -v /mnt/e/test_classifiers/birdnet_amphReptiles/detections:/app/detections \
    -v /mnt/e/test_classifiers/birdnet_amphReptiles/species_list:/app/slist \
    naturalstate/birdnet_amph_reptiles:latest \
    --phase_nb 0 \
    --acoustic_test_data /app/input \
    --slist /app/slist
docker: error during connect: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.44/containers/a5f5c94e8f536ad3a31cbb891f925ae39edbebf9815bb69ac9f1a659d1b7f2b4/start": EOF.
ERRO[0000] error waiting for container: context canceled 


It could be the external disk isn’t present or Docker Desktop or Rancher-Desktop, depending on what you’re using hasn’t been started yet.

Errors related to reading and writing to an external drive

This error has currently occured in the Hp Omen 16 and not the Hp Envy where the classifiers have been extensively tested.

When unmounting the external drive, when remounting it, say you have downloaded data into the external drive from a different computer, running the classifiers on the same external drive after remounting produces this error:

docker: Error response from daemon: error while creating mount source path '/run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu/c665e2c57f08bc45164350a716556a92914422688fbe1b268fd70d719f83e0d3': mkdir /run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu/c665e2c57f08bc45164350a716556a92914422688fbe1b268fd70d719f83e0d3: file exists.

This error is also related:

docker: Error response from daemon: stating /mnt/d/test_classifiers/megadetector_test/md_processed: stat /mnt/d/test_classifiers/megadetector_test/md_processed: no such device.

This error is problematic to solve, and has also been recorded here.

Here is a workaround, but it is a bit annoying.

Step 1: Unmount the external drive

A fast approach is to eject your external drive. Otherwise, for a safe method, follow below.

Go to your cd /mnt folder on WSL2.

You can safely unmount your external drive using this code:

sudo umount /mnt/d

where d is the name of your external drive if D: is what it is labelled as on your Windows File explorer.

Step 2: Restart your laptop

This is necessary. Based on several experiments, even safely remounting and unmounting does not make the error go away.

Step 3: Open WSL2 and go to /mnt folder

This step is the most sensitive. However, once done well, it sorts 95% of the problem.

Use cd .. to go to your /mnt folder from the default Linux/Ubuntu home directory.

Once you get into your /mnt directory using cd /mnt, type ls and you should still see the d directory present. However, it is still unaccessible.

Type ls d and you will still see the folder test_classifiers which is where we are running our classifiers on.

Use the code sudo rm -r <folder-name> to delete the test_classifiers folder or the folder name which the ML classifiers is reading and writing on.

sudo rm -r test_classifiers

It will prompt you for a password. Enter it

Type ls again, the folder shouldn’t now be there.

Error in rewriting to folder

Now repeat the procedure of remounting your external drive.

In this case, our external drive still takes the letter D:.

Here is the process

Step 1. cd .. to your /mnt folder

Step 2. Get into /mnt folder.

Step 3. Create a new directory d using sudo mkdir d while within the /mnt folder. WSL2 may complain that the folder exists but that is okay.

Step 4. Now mount the folder d because our external drive is named as D: in the file explorer.

sudo mount -t drvfs d: /mnt/d

Now type ls d.

It should now list all the files within your external drive D: or any other letter that windows assigned to your external drive.

You can go inside the d mounted folder by typing cd d. Remember you can only go to the d folder while within the /mnt folder

You can list all the files within d using ls (so long as you are within d mounted folder).