forked from NCAR/pyngl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathINSTALL
341 lines (238 loc) · 12.5 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
======================================================================
The latest version of this document can be found at:
http://www.pyngl.ucar.edu/Download/build_pyngl_from_src.shtml
======================================================================
How to build PyNGL from source code
We highly recommend installing PyNGL via conda-forge if
possible. Building PyNGL requires building lots of external software
packages which is not trivial for people who are not comfortable with
UNIX and various build systems.
PyNGL can only be built on UNIX systems. It has been successfully
built on systems running Linux (32 and 64-bit), MacOSX, and
Windows/Cygwin (32 bit only).
This document covers what external software packages you need for PyNGL
and how to build them, and then finally how to build PyNGL.
------------------------------------------------------------------------
*Table of Contents*
* Compilers needed to build PyNGL <#CompilersNeeded>
* Set environment variables for compilers <#SetCompilerEnvVars>
(helpful, not required)
* Download and build required external software <#BuildRequiredSoftware>
o NCL <#NCL>
o X11 development libraries <#X11DevLibs>
o cairo <#cairo>
+ libpng <#PNG>
+ pkg-config <#pkgconfig>
+ FreeType <#freetype>
+ pixman <#pixman>
+ expat <#expat>
+ ZLIB <#ZLIB>
* Download the source code for PyNGL <#GetPyNGLSourceCode>
* Set PyNGL-specific environment variables if necessary <#SetPyNGLEnvVars>
* Execute the 'setup.py' script <#RunSetup>
* Test PyNGL <#TestPyNGL>
* How to get help <#Help>
------------------------------------------------------------------------
<CompilersNeeded>
*Compilers needed to build PyNGL*
You need a Fortran compiler and an ANSI C compiler to build PyNGL. We
use gcc/gfortran on Linux and Mac OSX systems.
------------------------------------------------------------------------
<SetCompilerEnvVars>
*Set up compiler environment variables for external software*
Most of the external software packages that PyNGL depends on are
configured using a "configure" script. These "configure" scripts
recognize a number of standard environment variables that allow you to
set compilers and compile options.
Decide what compilers and compile options you want to use, and then set
the following environment variables as appropriate:
Environ. var. Description Example
*CC* C compiler bash/ksh: export CC=gcc
csh/tcsh: setenv CC gcc
*CFLAGS* C compile flags bash/ksh: export CFLAGS='-O -ansi -fPIC'
csh/tcsh: setenv CFLAGS '-O -ansi -fPIC'
*FC* Fortran compiler bash/ksh: export FC=gfortran
csh/tcsh: setenv FC gfortran
*FFLAGS* Fortran compile flags bash/ksh: export FFLAGS='-fPIC'
csh/tcsh: setenv FFLAGS '-fPIC'
*F90* Fortran 90 compiler bash/ksh: export FC=gfortran
csh/tcsh: setenv FC gfortran
*F90FLAGS* Fortran 90 compile flags bash/ksh: export F90FLAGS='-fPIC'
csh/tcsh: setenv F90FLAGS '-fPIC'
*CXX* C++ compiler bash/ksh: export CXX=g++
csh/tcsh: setenv CXX g++
*CXXFLAGS* C++ compile flags bash/ksh: export CXXFLAGS='-O -ansi -fPIC'
csh/tcsh: setenv CXXFLAGS '-O -ansi -fPIC'
*CPPFLAGS* preproc. compile flags bash/ksh: export CPPFLAGS='-DNDEBUG'
csh/tcsh: setenv CXXFLAGS '-DNDEBUG'
------------------------------------------------------------------------
<BuildRequiredSoftware>
*Download and build non-optional software*
Once you download and install any external software to use with PyNGL,
you must comply with the license of that software, regardless of PyNGL's
source code license.
Please check your system to see if any of these packages are already
installed, before you start building them from scratch. You can also
use Linux or Mac package managers like yum, apt-get, or conda to
install many of these packages.
For software that you download and build from source code yourself, we
will use "/usr/local/pyngl-1.5.0/external_software" as the parent
directory example for where we install all the additional software
required.
List of external software to install:
* NCL <http://www.ncl.ucar.edu>
Download version 6.3.0 or later.
See the full instructions <http://www.ncl.ucar.edu/Download/> for
building NCL from either source code or binary. NCL is a difficult
package to build, so we recommend downloading a precompiled binary
if possible. Don't fret if you can't get the code in
$NCARG/ni/src/ncl to build; it is not needed by PyNGL.
Make sure the NCARG_ROOT environment variable is set to the root
directory of where this software was installed.
* X11 library
You must have the X11 library (libX11.a, libX11.so) installed on
your system.
This library is usually installed as part of an X developer's
package, and will reside in a directory like /usr/X11R6/lib,
/usr/X11R6/lib64, opt/local/lib (for MacOS systems).
*cairo software*
Cairo support was optional in PyNGL 1.4.0 and earlier. This
is no longer the case for PyNGL 1.5.0. We have converted to
cairo display in order to get additional features like
transparency and automatic use of named colors.
o *libpng <http://www.libpng.org/pub/png/libpng.html>*
Download version 1.2.52 or later (not 1.4.x or 1.5.x)
Once you have the libpng source code, you can build and
install it with:
./configure --with-pic --prefix=/usr/local/pyngl-1.5.0/external_software
make all install
o pkg-config <http://pkgconfig.freedesktop.org/releases/> -
Download version 0.28 or later.
Once you have the pkg-config source code, you can build and
install it with:
./configure --prefix=/usr/local/pyngl-1.5.0/external_software
make all install
Make sure that the location of pkg-config is on your
search path and library path. For example, if you
installed pkg-config to
"/usr/local/pyngl-1.5.0/external_software", then you also
need to do the following:
From tcsh or csh:
setenv PKG_CONFIG_PATH /usr/local/pyngl-1.5.0/external_software/lib/pkgconfig
set path=(/usr/local/pyngl-1.5.0/external_software/bin $path)
From ksh or bash:
export PKG_CONFIG_PATH=/usr/local/pyngl-1.5.0/external_software/lib/pkgconfig
export PATH=/usr/local/pyngl-1.5.0/external_software/bin:$PATH
o FreeType <http://freetype.sourceforge.net/index2.html> -
Download version 2.5.5 or later.
Once you have the FreeType source code, you can build and
install it with:
./configure --prefix=/usr/local/pyngl-1.5.0/external_software
make all install
o pixman <http://cairographics.org/releases/> - Download
version 0.32.6 or later.
Once you have the pixman source code, you can build and
install it with:
Mac systems:
./configure --prefix=/usr/local --disable-openmp --disable-arm-iwmmxt \
--disable-dependency-tracking
make all install
Linux, Cygwin, others:
./configure --prefix=/usr/local/pyngl-1.5.0/external_software
make all install
o cairo <http://cairographics.org/releases/> - Download
version 1.12.18 or later.
You can't build cairo until you have installed FreeType,
pixman, and pkg-config.
Make sure the "pkg-config" you built is on your search
path. For example, if you installed it to
/usr/local/pyngl-1.5.0/external_software, then
/usr/local/pyngl-1.5.0/external_software/bin needs to be
in your search path.
From tcsh or csh:
setenv PATH /usr/local/pyngl-1.5.0/external_software/bin:$PATH
which pkg-config
From ksh or bash:
export PATH=/usr/local/pyngl-1.5.0/external_software/bin:$PATH
which pkg-config
Once you have the cairo source code, you can build and
install it with:
Mac systems:
./configure --prefix=/usr/local --enable-quartz-font=no --enable-quartz=no \
--enable-shared=no --enable-static=yes
Linux, Cygwin, others:
./configure --prefix=/usr/local/pyngl-1.5.0/external_software
make all install
o zlib <http://www.zlib.net/> - needed for cairo support
Download version 1.2.8 or later. (May already be on your system):
Once you have the zlib source code, you can build and
install it with:
./configure --prefix=/usr/local/pyngl-1.5.0/external_software
make all install
------------------------------------------------------------------------
<GetPyNGLSourceCode>
*Download the source code for PyNGL*
Accessing, downloading, and/or using PyNGL implies acceptance of the
PyNGL source code license.
To download the PyNGL source code, follow the instructions at the URL:
* http://www.pyngl.ucar.edu/Download/ *
The source code you download will be a single compressed tar file called
something like "PyNGL-1.5.0.tar.gz". Move this file to a temporary
directory where you have plenty of disk space (around 250 megabytes to
hold all of the source code, object files, binaries, and so on). Then,
uncompress and untar the file as follows:
gunzip PyNGL-1.5.0.tar.gz
tar -xvf PyNGL-1.5.0.tar
The above steps will create a directory called "PyNGL-1.5.0".
------------------------------------------------------------------------
<SetPyNGLEnvVars>
*Set PyNGL-specific environment variables if necessary*
To build PyNGL, at a minimum, you must set the NCARG_ROOT environment
variable to the root directory of where NCL was installed.
You may need to set additional environment variables to help the PyNGL
source find necessary external software:
PNG_PREFIX
ZLIB_PREFIX
CAIRO_PREFIX
FREETYPE_PREFIX
You only need to set one of these if the paths are all the same.
Finally, you may need to help the PyNGL installation find the location
of any system Fortran libraries needed to resolve symbols between C and
Fortran code. For example, "-lgfortran" is needed if you built the
software with gfortran, or "-lg2c" if g77 was used, and "-lf95" for g95.
Use F2CLIBS to indicate the library name (don't include the "-l", and
F2CLIBS_PREFIX to point to the location. For example:
setenv F2CLIBS gfortran
setenv F2CLIBS_PREFIX /usr/local/pyngl-1.5.0/external_software/lib
or
export F2CLIBS=gfortran
export F2CLIBS_PREFIX=/usr/local/pyngl-1.5.0/external_software/lib
------------------------------------------------------------------------
<RunSetup>
*Execute the 'setup.py' script*
Type:
python setup.py install
to build and install PyNGL.
------------------------------------------------------------------------
<TestSetup>
*Test PyNGL*
You can quickly test PyNGL by running python and importing Ngl:
import Ngl
For more extensive PyNGL tests, you can run any one of the examples in
the PyNGL gallery <https://www.pyngl.ucar.edu/Examples/gallery.shtml>,
which also reside in
PYTHON_PREFIX/lib/pythonx.y/site-packages/PyNGL/examples.
Note that some of these examples depend on PyNIO, and will not run
unless you install PyNIO, or use another package to read in the data
files.
Note that if the output file contains multiple frames and you are
sending the output to an X11 window, you need to click on the window
with your left mouse button to advance the next frame. Or, you can
position your mouse over the window and hit <RETURN>.
------------------------------------------------------------------------
<Help>
*How to get help*
If you have problems, send email to pyngl-talk@ucar.edu. You must
subscribe before you can post to it:
<http://mailman.ucar.edu/mailman/listinfo/pyngl-talk>
------------------------------------------------------------------------