Wednesday, December 28, 2016

Installing Python3, NumPy, SciPy and MatPlotLib under Cygwin on Windows 7

I had a working Cygwin environment with Python 2.7 installed, but I needed to install Python3, NumPy, SciPy, and MatPlotLib, which brought about a whole slew of issues.  I had to scour the web for the following solutions, but I was not able to find a single

I'm a command line junky, so I had already installed apt-cyg.  The following will outline the steps I had to do to get the packages identified above installed.

Install Python3

Installing Python3 is easy enough.
$ apt-cyg install python3
Now, before we attempt to install NumPy, SciPy, and MatPlotLib, we need to install a bunch of other dependencies, if they aren't already installed.  These include python3-setuptools, liblapack-devel, libopenblas, gcc-fortran, gcc-g++, python-gtk2, and libfreetype-devel.
$ apt-cyg install python3-setuptools liblapack-devel libopenblas gcc-fortran gcc-g++ python-gtk2 libfreetype-devel
Next, we need to create a symbolic link of /usr/include/locale.h to /usr/include/xlocale.h:
$ ln -s /usr/include/locale.h /usr/include/xlocale.h
Finally, we need to install pip and upgrade it.  Note, if you haven't updated your PATH environment variable the following command may not work until you do that or open a new Cygwin terminal.
$ python3 -m pip install --upgrade pip
Now we should be ready to install NumPy, SciPy, and MatPlotLib using pip.

Install NumPy, SciPy, and MatPlotLib

$ pip install numpy$ pip install scipy$ pip install matplotlib
 That should be it.