Cygwin Virtualenv

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:

  1. Check which pip to use for the Python version you use.
  2. pip3 install virtualenv
  3. mkdir PythonApp
  4. cd PythonApp
  5. virtualenv PythonAppVenv
  6. Check new environment folder PythonAppVenv created in PythonApp folder
  7. Activate the virtual environment by typing source PythonAppVenv/bin/activate
  8. (PythonAppVenv) should appear on the left side of the name prompt
  9. Check list of packages is different to normal list with pip3 list
  10. Install a new package and it will only add it to the virtual environment
  11. Check the PythonAppVenv lib/python3.8/site-packages folder or type pip3 list
  12. Once you are finished, you deactivate the virtual environment using the command deactivate

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s