NCL > Download

Installing NCL under Windows/Cygwin/X

If you want to run NCL under Windows, you must first download and install Cygwin/X. Cygwin/X provides you with a UNIX shell and an X server from which you can then run NCL.

Here are some step-by-step instructions for getting NCL to run under Cygwin/X. Please read these instructions all the way through before starting the installation.

  1. Install Cygwin/X
  2. Run Cygwin/X
  3. Make sure you have a Cygwin home directory
  4. Download NCL
  5. Install NCL
  6. Set up your environment to run NCL
  7. Set up C-shell
  8. Set up DISPLAY environment variable
  9. Test NCL
  10. Trouble shooting problems

  1. Install Cygwin/X

    To download and install Cygwin/X, go to the URL:

    http://x.cygwin.com/
    Read the "Downloading and installing" paragraph, which tells you which installation file you need to download (setup.exe), and what to do with it. It is recommended that you look through the "Installing Cygwin/X" in the Cygwin/X User's Guide, as it has some nice diagrams showing you each step of the installation process.

    When you start the installation process (by downloading "setup.exe" and double-clicking on the file wherever you downloaded it), you will be asked where to install Cygwin. I highly recommend that you select the default options, unless you know what you are doing.

    You wil eventually be asked to select a mirror site from which to download the software. I have found that some mirrors work better than others, and you may have to try several before you get a successful installation. I recommend starting with a mirror that is close to your geographic location, so the download is hopefully quicker.

    Once you select a mirror site, you will be prompted for which packages to install. The packages have categories like "Shells", "Devel", "Graphics", etc. Clicking on the plus (+) sign next to each category name will expand or close the list of packages associated with that category. Some categories and their related packages that you should install as a minimum include:

    • Category "Devel": install "gcc", "gdb", and "make".

    • Category "Editors": [optional] some popular editors that you might want for editing your files include "emacs" and "vim".

    • Category "Graphics": [optional] install "ghostscript" for viewing PostScript files.

    • Category "Shells": at a minimum, install "bash", "sh-utils", and "tcsh".

    • Category "X11": install all of the required packages that the "Installing Cygwin/X" section mentions (see #15 where it lists all the "xorg-x11" packages and whether they are required or optional). In addition to the required packages, be sure to also install "xorg-x11-devel". As of November 28, 2005, the list of packages that we recommend are:

      • xorg-x11-base
      • xorg-x11-bin
      • xorg-x11-bin-dlls
      • xorg-x11-bin-lndir
      • xorg-x11-devel
      • xorg-x11-etc
      • xorg-x11-fenc
      • xorg-x11-fnts
      • xorg-x11-libs-data
      • X-start-menu-icons
      • X-startup-scripts
      • xorg-x11-xwin

    To select any of these packages for installation, just click on the little circular icon next to it until you get a version number. Make sure you select the latest version number, if there are multiple ones. Some of the other options will be things like "skip", "uninstall", and "keep", which you don't want to use the first time through.)

    If the installation is successful, then the last item may be a window asking if you want to create some icon shortcuts for your desktop. Answer "yes" to this question as it will provide you with a little "startxwin" icon under Windows that you can double-click to start up Cygwin/X.

    If the installation fails or hangs while trying to install the software, then reboot if necessary, and rerun the setup.exe file as you did before, only this time choose a different mirror site.

  2. Run Cygwin/X

    Once the installation of Cygwin/X is complete, you need to start Cygwin/X, which will provide a terminal window for you to type commands in. If you have have a "startxwin" icon on your desktop, then you can start Cygwin/X by double-clicking on this icon. Otherwise, read the section "Using Cygwin/X" on how to start it. If you are successful, a window will pop up which you will then use for most of the instructions that follow. Newer versions of Cygwin/X will show a little "X" icon on your task bar if the X server was started successfully.

    You must start X/Cygwin before proceeding to the next section.

    Tip: if you installed Cygwin/X to the suggested location, then the Cygwin/X files will be installed under various directories under "c:\cygwin", and a home directory will be created for you under a path like "c:\cygwin\home\".

  3. Make sure you have a Cygwin home directory

    Note: some users have reported that a home directory has not been set up for them by Cygwin. I read in several FAQs that if the name of your home directory has a space in it, it won't work. I found an FAQ on this topic at http://www-cdf.fnal.gov/~cplager/cygwin.html#tidbits:

    Cygwin doesn't like it if there is a space in your Windows username. If you have a space, do the following after installing Cygwin:
    • Edit /etc/passwd (using either emacs, vi, or even Windows Wordpad)
    • Find your entry (it will start with your windows username)
    • Take the space out of your username (1st entry) and your home directory (2nd to last entry).
    • Quit all Cygwin
    • Use Windows Explorer to rename your home directory (for example "C:\cygwin\home\cplager")

  4. Download NCL

    Now you are ready to download and install NCL. If you haven't already, go to the Earth System Grid web site and download the NCL binary that has the word "CYGWIN" in the name of the file.

    A good place to save this file is in the location "c:\cygwin\home\xxx", where xxx is the home directory the Cygwin/X installation set up for you.

  5. Install NCL

    Once you have the *.tar.gz file, decide where you want to install NCL. If you are new to UNIX and don't know where you want to put it, then I recommend installing NCL in the directory "/usr/local". I'll use this path in my example below, and I will assume that you saved the file to "c:\cygwin\home\xxx", using "JohnDoe" as an example for xxx, and "ncl-4.2.0.a031.CYGWIN1.3_PC.tar.gz" as the name of the file. (The name of the file may vary slightly, since the version number changes almost monthly.)

    From the Cygwin/X window that you opened earlier, type the following commands:

        mkdir /usr/local
        cd /usr/local
        gunzip /cygwin/home/JohnDoe/ncl-4.2.0.a031.CYGWIN1.3_PC.tar.gz
        tar -xvf /cygwin/home/JohnDoe/ncl-4.2.0.a031.CYGWIN1.3_PC.tar
    
    Note: the path "/usr/local" may already exist, in which case you'll get an error message when you type "mkdir /usr/local". This is okay, and you can safely ignore the message.

  6. Set up your environment to run NCL

    Every user of NCL needs to set their environment before they can use NCL. You can do this by opening your "c:\cygwin\home\xxx\.bashrc" file with your favorite editor and adding the lines:

        export NCARG_ROOT=/usr/local
        export PATH=/usr/local/bin:$PATH
    
    Make sure you add these lines after the last reference to PATH. If PATH already has "/usr/local/bin" as part of it, then you don't need to add the last two lines. If you plan to use the C-shell, then add the following lines to your "c:\cygwin\home\xxx\.cshrc" file:
        setenv NCARG_ROOT /usr/local
        setenv PATH /usr/local/bin:$PATH
    
        setenv NCARG_ROOT /usr/local
        set path=($path $NCARG_ROOT/bin)
    
    To make sure these changes take effect right away, you can "source" the files, or completely exit your Cygwin/X window and start it up again. Here's how to source the files:
        source .cshrc
    
  7. Set up C-shell

    If you plan to use the "ng4ex" script, then you'll need to make sure you have C-shell before you can run it.

    In the same Cygwin/X window, type:

       which csh
       which tcsh
    
    If it reports that csh cannot be found but that tcsh can, then type the following:
        ln -s /usr/bin/tcsh.exe /usr/bin/csh.exe
        csh
    
    This will put you into a C-shell environment. You only need to execute the "ln -s" command once, but the "csh" command you will need to execute any time you are not in C-shell.

    If the above "which" commands report that neither "tcsh" or "csh" can be found, thn you need to run "setup.exe" again, and make sure that you select the "tcsh" package (which falls under the "Shells" category) to be installed.

  8. Set up DISPLAY environment variable

    In order to run any X applications, including running NCL to display graphics to your screen, you may need to set up your environment by opening "c:\cygwin\home\xxx\.bashrc" in your favorite editor, and adding the following lines at the bottom:

        export DISPLAY=:0.0
    
    If you are using C-shell, then edit "c:\cygwin\home\xxx\.cshrc" and add the following line:
        setenv DISPLAY :0.0
    
    You should now be ready to run NCL.

  9. Test NCL

    To test your installation of NCL, type the following:

        cp $NCARG_ROOT/lib/ncarg/nclex/xyplot/xy04n.ncl .
        ncl xy04n.ncl
    
    A window with an XY plot should pop up. If you click anywhere in the window with your left mouse button, the window will go away.

    If you have problems, then please review the "trouble shooting section that follows.

  10. Trouble shooting problems

    If you are having problems running the test in the above section, then here are some trouble shooting tips:

    • If you get the error:
       warning:GKS:GOPWK: --X driver error: error opening display
      
      then this probably means that your DISPLAY environment variable is not set, or it is set incorrectly. Please type:
      printenv DISPLAY
      
      and make sure that it is set to what is discussed in the "Set up DISPLAY environment variable" section above.

    • If it appears your DISPLAY is set correctly, and yet "ng4ex" still doesn't work, then you might be running the commands from a Cygwin window, and not a Cygwin/X window. The distinction is important, and you need to be running "ng4ex" from a Cygwin/X Window. Please read the section "Run Cygwin/X" and make sure you follow these instructions and then run "ng4ex" from this window.

      You can tell if your Cygwin window is really a Cygwin/X window by the "X" icon that should appear in the upper left corner of the window.

    If you still have problems, then send email to ncl-talk@ucar.edu. You need to be a member in order to post.