Installation Instructions¶
Starting with version 3.0, HydPy is available on the Python Package Index. With Python 3.8, 3.9, 3.10, or 3.11 on your computer and having access to the internet, you only have to type:
pip install hydpy
into your command-line tool to install the latest version of HydPy on your computer. pip then installs necessary site packages like numpy on the fly.
For 64 bit Windows, the Python Package Index provides so-called “wheels”, which include pre-compiled binaries and simplify installing a lot. On Linux systems, you have to install “from source” at the moment, as explained below.
Starting with version 4.0, HydPy also comes as an installer for Windows, including Python itself and all required and optional dependencies. You may find it useful if you are new to Python and want to check out HydPy before installing a complete Python distribution or if you are afraid to mess up your current Python installation (but then you should probably prefer to work in a virtual environment). Additionally, the closedness of the installer might be preferable when coupling HydPy to other software systems such as Kalypso or Delft-FEWS. See releases for the latest version of the HydPy installer.
Selecting a Python distribution¶
Using HydPy requires installing Python 3.8, 3.9, 3.10, or 3.11 first. You should favour the latest Python version unless you plan to use other libraries still only available for earlier versions. Alternatively, consider installing a more comprehensive Python distribution like Anaconda, already containing many scientific and mathematical tools.
Note that these Python distributions do not include the most powerful integrated development environments. For simple tasks, the lightweight IDE IDLE of the original Python distribution might be sufficient. Anaconda also comes with Spyder, which helps structure medium-sized projects. On the other hand, external IDEs like PyCharm offer significantly more comfort, so the initial installation and configuration effort required should quickly pay for itself.
Selecting a HydPy distribution¶
If you want to contribute to the development of HydPy or implement new models, please see the Development section. If you want to apply HydPy only, you should start with a stable version available under releases.
You are probably interested in using the latest version of HydPy, which has the highest version number. HydPy’s version numbers consist of three separate digits. In “X.Y.Z.”, “X” is the major number. There can be substantial differences between HydPy versions with different major numbers, possibly resulting in incompatibility issues with interfacing systems. “Y” is the minor revision number, indicating some improvements, but no potentially problematic changes, e. g. the implementation of additional models. “Z” is the revision number, indicating some necessary corrections to the framework or its implemented models. You should make sure to select the highest revision number available, meaning you should prefer using “X.Y.1” over “X.Y.0”.
Each release is available in different compressed archives, corresponding to different environments. Currently, we distribute pre-compiled binaries for 64-bit Windows only (see above). You have to build binaries yourself for all other operating systems and Python versions yourself. Principally, this should be simple, but Windows users might need to install the suitable compiler first (see below). Download and uncompress the source code archive in an arbitrary folder and open the command line interface within the uncompressed hydpy folder. Then write the following commands:
python prepare_build.py
python -m build
python -m pip install hydpy --no-index --find-links dist
The first command auto-generates some additional source files. The second command uses the original and the autogenerated sources to build a compressed source distribution and a wheel distribution in a folder named “dist”. The wheel distribution contains the content of the source distribution plus pre-compiled binaries for your specific system and Python version. The third command installs the wheel into the currently active site-packages folder. After that, you are ready to go.
Selecting a C Compiler¶
You only need to care about selecting a C compiler if no pre-compiled binaries are available for your system or if you want to implement new models into the HydPy framework. Also, Linux users should have no trouble, as the GNU Compiler Collection is ready for use on standard Linux distributions. Unfortunately, Windows does not include compilers by default. Search the Windows Compilers page on selecting and installing the correct compiler.
After installing the required compiler on Windows, you might eventually have to deal with the unable to find vcvarsall.bat problem. vcvarsall is a batch file Python needs to control the installed Visual Studio compiler. Find this file on your system and set a new system variable pointing to its path. A quick search on the internet should provide you with the required information.