Over time the number of Python packages installed becomes too high to understand their dependencies on each other. I tried to add a package and changed my environment where I lost the list of previously installed packages. Rather than go into detail all I can say is that it was a lesson learnt.
Because it is sometimes difficult to fix an issue and is time consuming I wanted to create a virtual environment in Cygwin so I could develop new applications and not impact my normal day to day setup.
Here are the steps I used to create a virtual environment in Cygwin:
- Check which pip to use for the Python version you use.
- pip3 install virtualenv
- mkdir PythonApp
- cd PythonApp
- virtualenv PythonAppVenv
- Check new environment folder PythonAppVenv created in PythonApp folder
- Activate the virtual environment by typing source PythonAppVenv/bin/activate
- (PythonAppVenv) should appear on the left side of the name prompt
- Check list of packages is different to normal list with pip3 list
- Install a new package and it will only add it to the virtual environment
- Check the PythonAppVenv lib/python3.8/site-packages folder or type pip3 list
- Once you are finished, you deactivate the virtual environment using the command deactivate