<style>
.present {
text-align: left;
}
</style>
###### tags: `Helpful Tutorials`
# Common Mod6 Problems (& Their Solutions)
---
## Docker engine starting forever on WSL
1. Close Docker Desktop app
2. Stop WSL
`(wsl --shutdown)`
3. Unregister the docker-desktop distro (which contains binaries, but no data)
`wsl --unregister docker-desktop`
4. Restart Docker Desktop app
## WSL2 update hangs forever
If virtualization not enabled:
1. Enter BIOS
2. Click troubleshoot->advanced options->UEFI firmware settings->restart
4. Find and enter CPU configuration
5. Security tab->virtualization->enabled (or SVM mode)
7. Save changes and reset/reboot
If virtualization enabled already and it's still taking forever:
- Run `npx npkill` and delete all unnecessary node_modules
- Run `wsl --set-version Ubuntu 2` again
## Problems with Psycopg on M1 Macs (even after Rosetta setup)
A lot of M1 mac students with this issue had a preexisting Python install.
Before reinstalling Python or Postgres, try setting this env var in terminal:
```SYSTEM_VERSION_COMPAT=1```
That sets the macOS version to 10.16 instead of 11.0. Try to install psychopg2-binary again.
The steps below have them reinstall Python, Pyenv, and Pipenv.
1. Enter pipenv shell
1. `file $(which python)`
1. If it says arm64, there are remnants of arm64 architecture from python install and we need to continue the reinstall steps below
2. Open `.zshrc`
1. Comment out `pyenv init`
3. Open `.zprofile`
1. Comment out `pyenv init`
4. Restart terminal
5. `rm -rf $(pyenv root)`
6. `brew uninstall pyenv`
1. Error is fine, can ignore it
7. `which python`
1. Should be `/usr/bin/python`
8. `which brew`
1. Should be `/usr/local/bin/brew`
9. `curl https://pyenv.run | bash`
10. Uncomment the `pyenv init` in `.zshrc` and `.profile`
11. Restart terminal
12. `pyenv install 3.9.4`
13. `pyenv global 3.9.4`
14. Restart terminal
15. Check python version with `python —version`
16. `pip install pipenv`
17. `pipenv shell`
- `file $(which python)` should now say i386 or something like that
They also might need to install the greenlet package in their venv:
18. `pipenv install greenlet`
1. Or `greenlet = “*”` in Pipfile
## Postbird cannot connect to Postgres even though Postgres is running
If they are running WSL, they might need to just restart it with `wsl --shutdown`.
This might also be Postbird trying to force an update. To do so, run: `brew postgresql-upgrade-database`
## Postgres "connection refused"
1. `brew services restart postgresql`
2. `brew postgresql-upgrade-database`
## Postbird ECONNREFUSED after WSL update
For some reason that Leah does not understand, after the WSL update the default port 5432 for postgres is messed up.
To fix this:
1. Open the `postgresql.conf` file
2. On WSL, this usually lives here: `/etc/postgresql/12/main/postgresql.conf`
3. This doesn't happen on Mac, but just in case, this file usually lives here: `/usr/local/var/postgres/postgresql.conf`
3. Uncomment the line that says `port=5432`
4. Change this line to `port=5433`
5. Restart postgres with `sudo service postgresql restart`
Then connect postbird via port 5433!
## Pip issue when installing pipenv and pytest: Could not find a version that satisfies the requirement pipenv (from versions: none)
Solution to fix the issue:
1. install pipenv
```pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pipenv```
2. install pytest
```pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pytest```
## xcrun: error: invalid active developer path
Usually the student just needs to install the XCode command line tools:
`xcode-select --install`
They might also need to run:
`xcode-select --reset`
## M1 users have compiler-related build failures when installing Python
Refer to [this Stack Overflow solution](https://stackoverflow.com/questions/51551557/pyenv-build-failed-installing-python-on-macos).
## M1 users have trouble with some Docker images (mysql, elasticsearch, etc.)
Have the student run `docker container run` with the flag `--platform linux/x86_64`
## ERRNO 13 for Windows users trying to run `pipenv install`
Have the student put the line `export PATH=$(echo $PATH | sed -e "s@:/mnt/c/Windows/system32/config/systemprofile/AppData/Local/Microsoft/WindowsApps@@")` in their .bashrc file. This will remove that path from their PATH variable (double check that is the exact path in their error output).
## greenlet install issues on MacOS
This is due to incompatibility with Python 3.9.6. `pipenv install <packages> --python 3.9.4` Should be utilized to make sure 3.9.4 is being used. It's also a good idea to have the student remove 3.9.6 from their pyenv as well (`pyenv uninstall 3.9.6`).
## `cannot import name soft_unicode from markup_safe`
Newer versions of flask should fix the issue. Make sure the student is using the latest version of flask (at this moment 2.2.2)