How To Install Python Packages In Cygwin

by admin
  1. How To Install Python On Linux

How to install new packages on Cygwin? Ask Question 145. How can I get apt-get to install python packages for a different version of python? Python: python3; Shells: chere (for shell integration) X11: (Needed for cmake-gui) gnu-free-fonts; xinit; Additionally, I let Cygwin’s installer to auto-install additional required packages. These packages should be sufficient for compiling C/C++ code under Windows. If I want to install Python with cygwin, then do I have to install a completely separate version of Python in addition to my Windows installat. Install Cygwin Go to and download setup-x86_64.exe Run it Select ‘Install from Internet’ Choose root directory (default. Install the cygwin package, then run easy_install. Turns out the cygwin packages suffix with the version number in case you have python 2 and python 3 installed. – cxw Jun 7 '15 at 15:03. To be precise: In the setup window view 'Full' and in the Search window type python2-setuptools.

Active5 months ago

Is there a tool in the Cygwin package similar to apt-get on Debian or yum on redhat that allows me to install components from the command line?

12.9k21 gold badges85 silver badges171 bronze badges

9 Answers

There is no tool specifically in the 'setup.exe' installer that offers thefunctionality of apt-get. There is, however, a command-line package installerfor Cygwin that can be downloaded separately, but it is not entirely stable andrelies on workarounds.


Check out the issues tab for the project to see the known problems.


For a more convenient installer, you may want to useapt-cyg as your package manager. Its syntax similar toapt-get, which is a plus. For this, follow the abovesteps and then use Cygwin Bash for the following steps

Now that apt-cyg is installed. Here are few examples ofinstalling some packages

5,4834 gold badges34 silver badges38 bronze badges

Cygwin's setup accepts command-line arguments to install packages from the command-line.

e.g. setup-x86.exe -q -P packagename1,packagename2 to install packages without any GUI interaction ('unattended setup mode').

(Note that you need to use setup-x86.exe or setup-x86_64.exe as appropriate.)

See for the package list.

2,0781 gold badge12 silver badges22 bronze badges

There exist some scripts, which can be used as simple package managers for Cygwin. But it’s important to know, that they always will be quite limited, because of...ehm...Windows.

Installing or removing packages is fine, each package manager for Cygwin can do that. But updating is a pain since Windows doesn’t allow you to overwrite an executable, which is currently running. So you can’t update e.g. Cygwin DLL or any package which contains the currently running executable from the Cygwin itself. There is also this note on the Cygwin Installation page:

'The basic reason for not having a more full-featured package manager is that such a program would need full access to all of Cygwin’s POSIX functionality. That is, however, difficult to provide in a Cygwin-free environment, such as exists on first installation. Additionally, Windows does not easily allow overwriting of in-use executables so installing a new version of the Cygwin DLL while a package manager is using the DLL is problematic.'

Cygwin’s setup uses Windows registry to overwrite executables which are in useand this method requires a reboot of Windows. Therefore, it’s better to closeall Cygwin processes before updating packages, so you don’t have to rebootyour computer to actually apply the changes. Installation of a new packageshould be completely without any hassles. I don’t think any of package managersexcept of Cygwin’s setup.exe implements any method to overwrite files in use,so it would simply fail if it cannot overwrite them.


Update: the repository was disabled recently due to copyright issues (DMCA takedown). It looks like the owner of the repository issued the DMCA takedown on his own repository and created a new project called Sage (see bellow).

The best one for me. Simply because it’s one of the most recent. It doesn’t use Cygwin’s setup.exe, it rather re-implements, what setup.exe does. It works correctly for both platforms - x86 as well as x86_64. There are a lot of forks with more or less additional features. For example, the kou1okada fork is one of the improved versions, which is really great.

apt-cyg is just a shell script, there is no installation. Just download it (or clone the repository), make it executable and copy it somewhere to the PATH:

There is also bunch of forks with different features.


Another package manager implemented as a shell script. I didn't try it but it actually looks good.

It can search for packages in a repository, list packages in a category, check dependencies, list package files, and more. It has features which other package managers don't have.


Fork of abandoned original cyg-apt with improvements and bugfixes. It has quite a lot of features and it's implemented in Python. Installation is made using make.

Chocolatey’s cyg-get

If you used Chocolatey to install Cygwin, you can install the package cyg-get, which is actually a simple wrapper around Cygwin’s setup.exe written in PowerShell.

Cygwin’s setup.exe

It also has a command line mode. Moreover, it allows you to upgrade all installed packages at once (as apt-get upgrade does on Debian based Linux).

Example use:

You can create an alias for easier use, for example:

alias cyg-get='/cygdrive/d/path/to/cygwin/setup-x86_64.exe -q -P'

Then you can, for example, install Vim package with:

cyg-get vim

1,6282 gold badges19 silver badges35 bronze badges
Dawid Ferenczy RogožanDawid Ferenczy Rogožan
12.7k8 gold badges50 silver badges55 bronze badges

I wanted a solution for this similar to apt-get --print-uris, but unfortunately apt-cyg doesn't do this. The following is a solution that allowed me to download only the packages I needed, with their dependencies, and copy them to the target for installation. Here is a bash script that parses the output of apt-cyg into a list of URIs:

The above will print out the paths of the packages that need downloading, relative to the cygwin mirror root, omitting any packages that are already installed. To download them, I wrote the output to a file cygwin-packages-list and then used wget:

The installer can then be used to install from a local cache directory. Note that for this to work I needed to copy setup.ini from a previous cygwin package cache to the directory with the downloaded files (otherwise the installer doesn't know what's what).

4,2161 gold badge13 silver badges22 bronze badges

Old question, but still relevant. Here is what worked for me today (6/26/16).

From the bash shell:

Keith Thompson
202k28 gold badges311 silver badges502 bronze badges
Steve IsenbergSteve Isenberg

First, download installer at: (Windows 64bit), then:



Dawid Ferenczy's answer is pretty complete but after I tried almost all of his options I've found that the Chocolatey’s cyg-get was the best (at least the only one that I could get to work).

I was wanting to install wget, the steps was this:


1,6282 gold badges19 silver badges35 bronze badges
6,3052 gold badges43 silver badges53 bronze badges

Usually before installing a package one has to know its exact name:

Yordan GeorgievYordan Georgiev
2,9761 gold badge32 silver badges46 bronze badges

Not the answer you're looking for? Browse other questions tagged command-linecygwin or ask your own question.

Active1 year, 9 months ago

I'm trying to install Matplotlib 1.0.1 version on latest Cygwin. In the processing, there is a weird fork error cannot be solved. I googled similar questions and found that it might be solved by manually running gcc/g++ with matplotlib : But it doesn't work under 1.0.1 version. Does anybody encounter the same problem?

3,2831 gold badge25 silver badges45 bronze badges

How To Install Python On Linux


3 Answers

Here are instructions for how to install matplotlib 1.1.0 on Cygwin

Matplotlib is a popular python library for generating plot graphics. It works with cygwin win32 but some non-intuitive steps are required.

Install cygwin:

I am using cygwin with setup 2.7.3

Install python through cygwin:

This document describes installing python and matplot with cygwin. For most windows users and cygwin users, normally you would use the external python executable. I tend to prefer all of my script oriented applications running through cygwin including python.

In the cygwin setup.exe installer, install:

  • The freetype libs, python-gtk, python-tk, libpng
  • gcc

Download matplotlib from sourceforge:

I am using the latest version matplotlib-1.1.0 as of 1/2012.

Download and extract the matplotlib tarball

Issues with standard python install and cygwin:

The typical 'python install' will not work with cygwin. You need to modify a configuration file and run some other additional commands.

In the root directory of the expanded matplotlib directory, copy the setup.cfg.template configuration file to setup.cfg. Edit setup.cfg.

Around line 70 in the file is a commented line, uncomment the line such that you have:

Run install and watch it fail

Try running 'python install'

It should fail with an error like the following:


Exit cygwin and close all cygwin instances including the one you are working with. You won't be using the typical cygwin prompt for the next command.

In windows explorer, open the cmd.exe or windows command

You will need to run rebaseall. First, shut down any long running processes like sshd, close all Cygwin prompts and so on.

Type the following commands:

And you should get several lines of output.

Run install and watch it succeed

Try running 'python install' command again in the matplotlib directory

Running Example Program:

Brion FinlayBrion Finlay

These steps taken from worked for me:

  1. Run Cygwin setup: (For some reason the original command posted in the source link did not work for me)
  2. install packages: (most of these you may already have)

    • pkg-config
    • ghostscript
    • libfreetype-devel
    • libpng-devel
    • libgtk2.0-devel
    • gcc-g++
    • git
    • openbox
    • python3-numpy
    • python3-pyqt5
    • python3-devel
  3. Then from Cygwin Terminal:

easy_install-3.6 pippip install --upgrade sixpip install matplotlib

  1. Then tested from python console:

import matplotlibmatplotlib.__version__


Installation worked for me as described by Felix above.But to use matplotlib you need to start the Xserver from Cygwin first:

and then start your script.

Felix KastnerFelix Kastner

Not the answer you're looking for? Browse other questions tagged pythoncygwinmatplotlib or ask your own question.