2.0.0b10
catchment modelling framework
|
This is the simplest way to install cmf on Windows. It shows one path, that should be suitable for most computers with a Windows system. Alternatives are listed below
Open the WinPython Command Prompt and type
pip install cmf
Just get the shapely binary from:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely
and install it with the pacakge manager of your python distribution. Eg. use the Winpython Control Panel for winpython.
To compile cmf2 you need the following installed on your computer:
Open a Visual Studio Development Command Prompt and make sure the right python installation is in the path (eg. python -VV). Navigate to the cmf source code. It is a good idea to create a virtual environment (venv) for the compilation
Check if nmake is in the path, if you get an error message you are not using the Visual Studio Development Command Prompt or you have not installed the Build Tools properly
nmake /?
Install the requirements
pip install -r requirements.txt
Install cmake
pip install cmake
Installing and compiling CMF takes some time. The easiest way is to just install cmf from the source directory using pip install. In case of problems, it is better to compile CMF step by step (see below)
pip install . -v
The -v
stands for verbose, to give more output
Compiling and installing of cmf consists of the following steps
tools\install_solvers.bat
The source code for the solvers is downloaded to build\extern
, the built libraries are stored in the lib
directory
tools\install_cmf_core.bat
There are a couple of test executables build together with cmf. These executables can be found in the directory bin
. The static library is together with the solver libraries in lib\lib
python setup.py build_ext
If the C++ API has been changed, build the wrapper interface newly with
python setup.py build_ext swig
python setup.py build_py
python setup.py install
Do not fire up a python command prompt and import cmf in the source directory. This will fail.
Either change the directory first or run the cmf tests with
tools\test.bat
This will take care of the necessary directory change
You can distribute your compiled version to other Windows users by building a binary wheel.
python setup.py bdist_wheel
or
pip wheel .
The .whl file is in the dist
directory and can be easily shared between computers.
The .whl is ony suitable for the same Python version, architecture (x64/x86) and operating system (Windows). If you are distributing a compiled version of CMF, it is required by the licence to give the receivers of the binary package access to the source that has been used to compile the binary. In case of an unchanged CMF a link to the CMF code repository is sufficient. If you have made changes to the source code, you are responsible to provide the receiver with your source code, which inherits the GNU Public Licence from CMF.
Just follow the instructions for installing CMF on Linux