Maybe time has come to remove Cygwin to free up space or to start over. Cygwin does not support an uninstall program but can be done manually.
- Open command prompt with administrator privilages
- Type takeown /r /d y /f cygwin64
- Type lcacls cygwin64 /t /grant everyone:f
- Type rmdir /s /q cygwi64
- Regedit and delete HKEY_CURRENT_USER_Software_Cygwin
- Regedit and delete HKEY_LOCAL_MACHINE_Software_Cygwin
- Delete shortcut on desktop
Download latest setup-x86_64 and run it. Do not install everything! Only start by installing ‘gcc-core’, ‘make’, ‘openssl’ ‘openssh’, ‘vim’ and ‘python3.8’. Also, include the ‘python3.8-crypto’ file which will save you a lot of pain when adding packages with pip3 which rely on cryptography package. It is quite easy to go down a rat hole when a dependency fails and you get disheartened when a lot of red messages appear on screen. There are times you need to use the Cygwin setup program to install specific packages.
Open Cygwin terminal and type python should start python 3.8 shell.
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