Without using a virtualenv, every time you use pip, your python environment will mix and match cygwin packages with pip packages. This will cause enormous issues when you try to install more and more pips.
Install absolute bare minimum: python2 & python3, devel version for both, and virtualenv for both.
python python3 python-devel python3-devel python-virtualenv python3-virtualenv
ALL other packages will be done through the virtual environment.
Here are scripts, in Windows old school command line (cmd.exe and .bat files) and also cygwin shell (bash).
Automated Setup Option 1: Using Cygwin shell
Install wget from cygwin.
And then, in the cygwin shell:
wget https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg -O /bin/apt-cyg chmod a+x /bin/apt-cyg /bin/apt-cyg --version apt-cyg update apt-cyg install diffutils git bash bash-completion openssh sshpass zstd rsync zip apt-cyg install cygwin64-gcc-core cygwin64-gcc-g++ gcc-fortran make automake alternatives ca-certificates zlib0 apt-cyg install python python3 python-devel python3-devel python-virtualenv python3-virtualenv apt-cyg install make automake gcc-core gcc-g++ zlib zlib-devel libffi-devel openssl-devel /usr/bin/python3 -m venv ~/my_virtual_env source ~/my_virtual_env/bin/activate
Use as follows:
~/my_virtual_env/bin/python -m pip install -r requirements.txt ~/my_virtual_env/bin/python scripy.py
Option 2: Using Windows cmd.exe shell
*** Very important when using cmd.exe and .bat files. You must re-set the PATH when starting the cmd, after source command, and for future uses.
Install wget from cygwin.
In the cmd.exe Windows shell, or .bat file:
SET ROOTDIR=C:/cygwin set PATH=%ROOTDIR%/bin;%CD%;%PATH% %ROOTDIR%/bin/bash.exe -c 'wget https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg -O /bin/apt-cyg' %ROOTDIR%/bin/bash.exe -c 'chmod a+x /bin/apt-cyg' %ROOTDIR%/bin/bash.exe -c "apt-cyg install python python3 python-devel python3-devel python-virtualenv python3-virtualenv" %ROOTDIR%/bin/bash.exe -c "apt-cyg install make automake gcc-core gcc-g++ zlib zlib-devel libffi-devel openssl-devel" SET ROOTDIR=C:/cygwin set PATH=%ROOTDIR%/bin;%CD%;%PATH% %ROOTDIR%/bin/bash.exe -c "/usr/bin/python3 -m venv ~/my_virtual_env" %ROOTDIR%/bin/bash.exe -c "source ~/my_virtual_env/bin/activate"
In subsequent .bat files, you must set the PATH first.
SET ROOTDIR=C:/cygwin set PATH=%ROOTDIR%/bin;%CD%;%PATH% %ROOTDIR%/bin/bash.exe -c "/home/"%USERNAME%"/my_virtual_env/bin/python -m pip install -r ~/some_project/requirements.txt"
Looks like tutorial is outdated now 🙂