PhreeqPy - Python Tools for PHREEQC

Introduction

PhreeqPy is Open Source software and provides Python tools to work with PHREEQC.

Currently it provides access to the new IPhreeqc interface without the need to run a COM server and therefore also works on non-Windows systems. IPhreeqc is described in more detail in this publication.

Please let us know what you do with PhreeqPy or if things do not work as expected. There is a mailing list for PhreeqPy. Please subscribe to get your questions about PhreeqPy answered.

Download latest version of this documentation as PDF

License: BSD

Installation

Pythons (tested): Python 2.6, 2.7, 3.3, 3.4, 3.5, 3.6, 3.8, 3.7, 3.9 PyPy

Pythons (untested but should work since using ctypes): IronPython, Jython 2.7

Platforms: Unix/Posix and Windows

PyPI package name: phreeqpy

Installation with pip:

pip install -U phreeqpy

You need an IPhreeqc shared libray for your operating system. PhreeqPy comes with shared libraries for 32-bit Windows, 32-bit Linux and 64-bit Mac OS X. There is no 64-bit Windows distributed with PhreeqPy. Please install the Windows COM 64-bit module of IPhreeqc and use phreeqpy.iphreeqc.phreeqc_com as phreeqc_mod instead of import phreeqpy.iphreeqc.phreeqc_dll as phreeqc_mod as shown in the example. If you use Anaconda or Miniconda make sure to:

conda install pywin32

before you install PhreeqPy.

You may download an appropriate library from here: https://www.usgs.gov/software/phreeqc-version-3

For example for Linux:

wget https://water.usgs.gov/water-resources/software/PHREEQC/iphreeqc-3.7.1-15876.tar.gz
tar -xzvf iphreeqc-3.7.1-15876
cd iphreeqc-3.7.1-15876
./configure
make
make check
sudo make install

Then either use the full path to the shared libray when making an instance of phreeqc_dll.IPhreeqc

phreeqc = phreeqpy.iphreeqc.phreeqc_dll.IPhreeqc('/full/path/to/libiphreeqc.so')

or copy the shared object into phreeqpy/iphreeqc replacing the existing one. For example:

sudo cp /usr/local/lib/libiphreeqc.so  /path/to/site-packages/phreeqpy/iphreeqc/libiphreeqc.so.0.0.0

Benchmark Test Comparing PhreeqPy to External Processes, COM and C++

This publication demonstrates how PhreeqPy can be used for reactive transport modeling.

Müller M., Parkhurst D.L., Charlton S.R. (2011) Programming PHREEQC Calculations with C++ and Python - A Comparative Study , In: Maxwell R., Poeter E., Hill M., Zheng C. (2011) MODFLOW and More 2011 - Integrated Hydrological Modeling, Proceedings, pp. 632 - 636.