The PyGChem package can be installed either as a conda package or from source.
Note: currently, this alternative is only available for:
The easiest way to install PyGChem is to first get the free Anaconda distribution. There are two options:
Download the installer corresponding to your platform and follow the installation steps. Administrator privileges are not required. Note that it is a completely independent Python installation, it will not conflict with any version of Python already installed on your system.
Make sure that the Anaconda or Miniconda install location has been added to your PATH (it should be the case, unless you have explicitly chosen not to add it). The following command (Linux, OSX) will add it to you PATH, if needed:
export PATH=/$HOME/anaconda/bin:$PATH
If you wish to use Anaconda or Miniconda as your default Python installation, you should add the install location to your .bashrc
or .profile
(it should be already there by default).
The next step (optional but recommended) is to create a new virtual environment where PyGChem and all its dependencies will be installed:
conda create -n pygchem_py27 python=2.7
Virtual environments allow you to have multiple versions of Python and/or libraries installed on your system and easily switch between them.
You can then activate the new created virtual environment:
source activate pygchem_py27
The last step is to install PyGChem and all its dependencies into the activated virtual environment. Simply run the following command:
conda install -c https://conda.binstar.org/benbovy pygchem
To check if PyGChem has been successfully installed, try importing it:
python -c "import pygchem; import iris"
NOTE: The installed package (more specifically, some of its dependencies) may not work for OSX versions earlier than 10.9. If you use one of these systems and if importing the modules fails, try re-installing the following packages from Christoph Keller's repository:
conda install -f -c https://conda.binstar.org/christophkeller pygchem iris biggus cartopy udunits2 proj4
The PyGChem's source is available here: https://github.com/benbovy/PyGChem. If you have git installed on your system, you can download the source with the following command:
git clone https://github.com/benbovy/PyGChem.git
After having installed all the dependencies listed below, you can install PyGChem by running the commands:
cd PyCGhem
git checkout <version_number>
python setup.py install
<version_number>
is a specific release (e.g., '0.2.0', '0.3.0dev'). The master branch (default) contains the actual state of the code (may be unstable).
If you wish to contribute to the development of PyGChem, an in-place install can be useful. You can perform an in-place build by entering:
python setup.py develop
It will add the current source directory to the Python sys.path
so you don't have to re-install the package each time you modify the source.
The following external packages or libraries are required before installing and running PyGChem:
Python 2.7+ (http://www.python.org/)
Numpy 1.6+ (http://numpy.scipy.org/)
netcdf4-python 0.9.9+ (http://netcdf4-python.googlecode.com/)
Iris 1.7+ (http://scitools.org.uk/iris)
setuptools 0.6c11 (http://pypi.python.org/pypi/setuptools/)
The following packages are optional:
Most of these libraries can be installed using your platform-specific package manager or from several (free) Python scientific distributions: