Post Ubuntu VirtualMachine OS Upgrade
-
Any third-party applications you have previously installed may need to be reinstalled. Libraries these applications depend on have been upgraded and your applicaiton may need to be upgraded too.
-
Python virtual environments will generally need to be re-installed. The steps involved are - assuming you are already in the root directory of your project, and the virtual environment is installed in a dedicated subdirectory,
venv
:-
record the packages in the environment
$ source venv/bin/activate (venv) $ pip freeze > frozen_requirements.txt (venv) $ deactivate
-
remove the directory tree containing the environment If you had installed your virtual environment in a dedicated directory venv,
$ rm -rf venv/
Or, if your virtual environment is not in a dedicated directory, so you can see directories
bin
,lib
,share
,include
in your root project directory$ rm -rf bin lib include share
-
create a new virtual environment with the version of python you want to use
$ python3 -m venv venv (venv) $ source venv/bin/activate
-
re-install the packages recorded in your
frozen_requirements.txt
file:(venv) $ pip install -r frozen_requirements.txt
-
References
python_anywhere - rebuilding virtual environments
Changes to that documentation:
-
with python3 on your system, and no system
python
command: use the commandpython3 -m venv <venv_name> source <venv_name>/bin/activate