03 March 2013

353. Cygwin with octave and gnuplot on windows XP.

Here's my fourth Windows XP post.

Again, the goal is primarily to get Gnuplot and Octave working on Windows, together with sed, gawk and other tools for data processing. In this post that's done using cygwin on windows XP.

This is (in my opinion) a better alternative to installing the native gnuplot and octave packages (posts 350, 351, 352), especially as Octave in post 350 takes well over a minute to start, but only a few seconds through cygwin.

1. Download http://cygwin.com/setup.exe and run it. Set it to install from the internet, with c:\cygwin as the root directory. Pick a mirror which is reasonably close (e.g. mirror.aarnet.edu.au in Australia).

2. You're now asked to select packages.
Select octave (search for octave, click on 'skip' to change it to the version number), octave-forgegnuplot, xinit and xorg-server

3. Cygwin will calculate dependencies. cat, gawk, sed etc. are part of the base package and don't need to be explicitly selected.

I got a single error during installation, but it doesn't seem to have caused any obvious issues:
Package: libpango1.0_0 pango1.0.sh exit code 1
4. Launch Programs/Cygwin-X/XWin server.
Unblock if necessary.

Do
echo $DISPLAY
:0
to make sure that all is well. Run gnuplot and do e.g. 'plot x w lines' to make sure that all is working. Best thing? Octave only takes a few seconds to start... You may have to load packages in octave manually (e.g. 'pkg load all')



Links to this post:
http://blog.csdn.net/lllcfr1/article/details/8657143

7 comments:

  1. I tried your instructions and got stuck at point 2.

    ReplyDelete
    Replies
    1. In what sense are you stuck? What is not working?

      Delete
  2. Thank you, this was very helpful. I'm new to cygwin and I omitted xinit and xorg-server when I originally installed octave.

    I was wondering what editor would you recommend I try for writing script files in cygwin?

    ReplyDelete
    Replies
    1. If you're new to the whole *NIX thing, nano is a simple editor which is easy to get started with.

      vim (or vi) has a bit steeper learning curve, but is surprisingly powerful. It's especially useful if you're going to be processing data. Another reason to learn it is that it's available on just about any imaginable NIX system (and stripped down ones, like busybox).

      Emacs is also powerful, but I've never really warmed to it. It feels...bloated and un-unix like ('do one thing, and do it well').

      Gedit, which is a bit more like notepad but more powerful, is another option. It's using X though.

      Delete
  3. Thank you. I'll try out vim. I like a good challenge.

    I was just about to ask how you opened multiple instances of XWin, but I ended up finding a couple of ways to do it on my own so I'll post them here in case someone else finds it useful.

    within a cygwin terminal type 'startxwin -- :1' substituting any number for the 1

    or within an existing XWin instance type 'xterm &'

    These are probably obvious solutions for the initiated, but it took me awhile to figure it out.

    ReplyDelete
    Replies
    1. Good choice :)
      There's a text file called VIM tutor, which teaches you how to use vim by navigating through it.
      Download it from here: http://www2.geog.ucl.ac.uk/~plewis/teaching/unix/vimtutor

      Note, don't read it online and try to learn -- download the file, open it in vim and it will make sense, however silly it may seem.

      Delete
    2. You can see here for a .vimrc example: http://verahill.blogspot.com.au/2012/05/vim-weird-pasting-behaviour.html

      Delete