Installation¶
Note that pygeostat requires Python 3.6+. Pygeostat will likely require modification to work with any other version of python. Pygeostat is also strongly dependent on the suite of curated python packages provided with the Anaconda Python distribution. It is highly recommended to install this prior to pygeostat installation.
Full Installation Guide and Test Notebook¶
A full installation guide and test case is provided in the pygeostat_installation.zip
file,
which is available on the Pygeostat Knowledge Base page at
https://ccgsrv.geostats.ualberta.ca/ccgkb/doku.php?id=software:indexes:pygeostat
It is strongly recommended that new users follow the step-by-step instructions that are available in the PDF within this zip file, before applying the test notebook. Though similar instructions are provided below, the instructions in this PDF are more more explicit.
Python Installation¶
The Anaconda distribution by Continuum Analytics: https://www.continuum.io/downloads is recommended
as it includes all dependencies for pygeostat. If unfamiliar with Python and virtual environments,
then accepting the defaults of registering with the system and installing to the path are
recommended. All distributed .whl
pygeostat versions are compiled targeting a 64-bit machine
with an Anaconda Python 3.6+.
pygeostat Installation¶
The easiest way to install pygeostat is to download the .whl
file satisfying the specifications
of your machine and python installataion (e.g., at present this is only a 64-bit machine with
Python 3.6+). At this point it is assumed that a Anaconda Python distribution with Python 3.6+ is
installed. After downloading the .whl
, pygeostat is installed by opening a command prompt in the
folder containing the .whl
, and executing the following command:
> pip install pygeostat-<ver>-py36-none-any.whl
where ver
refers to the current version of pygeostat under consideration.
From Source¶
For Windows¶
The easiest way to install pygeostat is to follow the .whl
method provided above. To build from
source, download the desired version of pygeostat from the CCG Knowledge Base at
https://ccgsrv.geostats.ualberta.ca/ccgkb/doku.php
Extract the zip file, then from a command prompt:
> cd pygeostat
> python setup.py install -buildfortran
The -buildfortran
flag requires a relatively recent (>0.503) version of pygeostat. This flag
ensures that all required components are compiled. The setup script installs pygeostat into your
Python 3.6+ site-packages directory. You are ready to start using pygeostat!
Warning
This assumes that an Anaconda Python distribution is installed. It should work without one, but
upon first import of pygeostat a number of errors will be thrown for missing packages. These
dependencies can be resolved by conda update <package>
, but it is highly recommended to use
the Anaconda Installer referenced above.
For Linux¶
Warning
Compiling pygeostat for linux is not currently tested or supported.
Compile Fortran under a linux environment, such as cygwin with:
$ make
Alternatively from the Windows command prompt:
$ cd fortran
$ compile_fortransubs.bat
$ cd ..
Then install pygeostat with:
$ python setup.py install
You are ready to start using pygeostat!
Dependencies¶
Anaconda Packages¶
Anaconda provides the major dependencies of pygeostat:
- NumPy+SciPy - Python math libraries - http://www.scipy.org/
- Pandas - a Python data analysis library - http://pandas.pydata.org/
- Matplotlib - a Python plotting library - http://matplotlib.org/
Pyperclip¶
A package that facilitates the copying of python-created strings to the clipboard:
> pip install pyperclip
Optional Dependencies¶
Seaborn¶
A Python visualization library - http://stanford.edu/~mwaskom/software/seaborn/. Seaborn isn’t packaged with the Anaconda installer but is available by using the command:
> conda install seaborn
Using R from Python¶
Consider:
- rpy2 - a Python library providing a low-level interface to R from Python - http://rpy.sourceforge.net/
- Matrix - a R library - https://stat.ethz.ch/R-manual/R-devel/library/base/html/matrix.html
To allow interfacing between Python and R, rpy2 is required. Currently, only the utility gs.nearpd() uses rpy2 which also requires the R library “Matrix” to be installed through R. Installing rpy2 can be temperamental. The following installation instructions for rpy2 should do the trick:
- Download the rpy2 wheel file (e.g., rpy2-2.6.0-cp34-none-win_amd64) from: http://www.lfd.uci.edu/~gohlke/pythonlibs/#rpy2
- From the command prompt, install the wheel file by using the command
>>> pip install rpy2-2.6.0-cp34-none-win_amd64.whl
- Add the path to the folder containing R.dll to the environment variable PATH (e.g., C:Program FilesRR-3.1.2/bini386)
- Add an environment variable R_HOME pointing to R (e.g., C:Program FilesRR-3.1.2)
- Add an environment variable R_USER that is your windows user name
For Developers¶
Compiling Documentation¶
Requires:
Sphinx - Python documentation generator:
> conda install sphinx
Sphinx readthedocs theme - theme for Sphinx:
> conda install sphinx_rtd_theme
See other packages for documentation guidelines and build instructions.
F2PY¶
Compiling the Fortran module source requires:
mingw - Fortran and C compilers, from either:
conda install mingw
- http://mingw-w64.org/, and add
bin
to pathf2py - included with numpy - https://docs.scipy.org/doc/numpy-dev/f2py/
See the fortran documentation for instructions.