Installation and setup¶
Following you find guidelines for the installation process for different operation systems.
Linux¶
Having Python 3 installed¶
As oemof is designed as a Python package it is mandatory to have Python 3 installed. It is highly recommended to use a virtual environment. See this tutorial for more help or see the sections below. If you already have a Python 3 environment you can install oemof using pip:
pip install oemof
If you do not yet have pip installed in your python environment, see section Additional Python packages below for further help.
Using Linux repositories to install Python¶
Most Linux distributions will have Python 3 in their repository. Use the specific software management to install it. If you are using Ubuntu/Debian try executing the following code in your terminal:
sudo apt-get install python3
You can also download different versions of Python via https://www.python.org/downloads/.
Using Virtualenv (community driven)¶
Skip the steps you have already done. Check your architecture first (32/64 bit).
Install virtualenv using the package management of your Linux distribution, pip install or install it from source (see virtualenv documentation)
Open terminal to create and activate a virtual environment by typing:
virtualenv -p /usr/bin/python3 your_env_name source your_env_name/bin/activateIn terminal type:
pip install oemof
Install a Solver if you want to use solph and execute the solph examples (See Run examples to check the installation ) to check if the installation of the solver and oemof was successful
Warning: If you have an older version of virtualenv you should update pip pip install --upgrade pip
.
Using Anaconda¶
Skip the steps you have already done. Check your architecture first (32/64 bit).
Download latest Anaconda for Python 3.x (64 or 32 bit)
Install Anaconda
Open terminal to create and activate a virtual environment by typing:
conda create -n yourenvname python=3.4 source activate yourenvnameIn terminal type:
pip install oemof
Install a Solver if you want to use solph and execute the solph examples (See Run examples to check the installation ) to check if the installation of the solver and oemof was successful
Solver¶
In order to use solph you need to install a solver. There are various commercial and open-source solvers that can be used with oemof.
There are two common OpenSource solvers available (CBC, GLPK), while oemof recommends CBC (Coin-or branch and cut). But sometimes its worth comparing the results of different solvers.
To install the solvers have a look at the package repository of your Linux distribution or search for precompiled packages. GLPK and CBC ares available at Debian, Feodora, Ubuntu and others.
Check the solver installation by executing the test_installation example (see Run examples to check the installation ).
To learn how to install (other) solvers (Gurobi, Cplex...) have a look at the pyomo solver notes.
Additional Python packages¶
To be able to install additional Python packages an installer program is needed. The preferred installer is pip which is included by default in the installation of Python 3.4 and later versions. To install pip for earlier Python versions on Debian/Ubuntu try executing the following code in your terminal or use the software management of you Linux distribution:
sudo apt-get install python3-pip
For further information refer to https://packaging.python.org/en/latest/installing/#install-pip-setuptools-and-wheel.
In order to install a package using pip execute the following and substitute package_name by the desired package (e.g. virtualenv):
pip3 install package_name
For further information on how to install Python modules check out https://docs.python.org/3/installing/index.html.
Windows¶
If you have Python 3 installed¶
As oemof is designed as a Phyton-module it is mandatory to have Python 3 installed. If you already have a working Python 3 environment you can install oemof by using pip. Run the following code in the command window of your python environment:
pip install oemof
If pip is not part of your python environment, see section Additional Python packages below for further help or use WinPython/Anaconda (see below).
Using WinPython (community driven)¶
Skip the steps you have already done. Check your architecture first (32/64 bit)
- Download latest WinPython for Python 3.x (64 or 32 bit)
- Install WinPython
- Open the ‘WinPython Command Prompt’ and type:
pip install oemof
- Install a Windows Solver if you want to use solph and execute the solph examples (See Run examples to check the installation ) to check if the installation of the solver and oemof was successful
Using Anaconda¶
Skip the steps you have already done. Check your architecture first (32/64 bit)
Download latest Anaconda for Python 3.x (64 or 32 bit)
Install Anaconda
Open ‘Anaconda Prompt’ to create and activate a virtual environment by typing:
conda create -n yourenvname python=3.4 activate yourenvnameIt is recommended to use python 3.4. Some users reported that oemof does not work with Windows + Anaconda + Python 3.5
In ‘Anaconda Prompt’ type:
pip install oemof
Install a Windows Solver if you want to use solph and execute the solph examples (See Run examples to check the installation ) to check if the installation of the solver and oemof was successful
Windows Solver¶
In order to use solph you need to install a solver. There are various commercial and open-source solvers that can be used with oemof.
You do not have to install both solvers. Oemof recommends the CBC (Coin-or branch and cut) solver. But sometimes its worth comparing the results of different solvers (e.g. GLPK).
- Downloaded CBC from here (64 or 32 bit)
- Download GLPK from here (64/32 bit)
- Unpacked CBC/GLPK to any folder (e.g. C:/Users/Somebody/my_programs)
- Add the path of the executable files of both solvers to the PATH variable using this tutorial
- Restart Windows
Check the solver installation by executing the test_installation example (see Run examples to check the installation ).
For commercial solvers (Gurobi, Cplex...) have a look at the pyomo solver notes.
Additional Python packages¶
To be able to install additional Python packages an installer program is needed. The preferred installer is pip which is included in the winpython download. If you do not have pip installed see here: https://packaging.python.org/en/latest/installing/#install-pip-setuptools-and-wheel.
In order to install a package using pip execute the following and substitute package_name by the desired package:
pip install package_name
For further information on how to install Python modules check out https://docs.python.org/3/installing/. Using pip all necessary packages are installed automatically. Have a look at the setup.py to see all requirements.
Mac OSX¶
Installation guidelines for Mac OS are still incomplete and not tested. As we do not have Mac users we could not test the following approaches, but they should work. If you are a Mac user please help us to improve this installation guide. Have look at the installation guide of Linux or Windows to get an idea what to do.
You can download python here: https://www.python.org/downloads/mac-osx/. For information on the installation process and on how to install python packages see here: https://docs.python.org/3/using/mac.html.
Virtualenv: http://sourabhbajaj.com/mac-setup/Python/README.html
Anaconda: https://www.continuum.io/downloads#osx
You have to install a solver if you want to use solph and execute the solph examples (See Run examples to check the installation ) to check if the installation of the solver and oemof was successful.
CBC-solver: https://projects.coin-or.org/Cbc
GLPK-solver: http://arnab-deka.com/posts/2010/02/installing-glpk-on-a-mac/
Run examples to check the installation¶
Run the examples to check the installation. From the command-line (or Anaconda Prompt / WinPython Command Prompt) execute:
oemof_examples <name-of-example> [-s <name-of-solver>]
You can choose from the list of examples
- test_installation
- storage_investment (solph)
- simple_dispatch (solph)
- csv_reader_investment (solph)
- flexible_modelling (solph)
- csv_reader_dispatch (solph)
Test the installation and the installed solver:
oemof_examples test_installation
Execute an example with different solver (default: ‘cbc’).
oemof_examples simple_least_costs
oemof_examples simple_least_costs -s glpk
If you want to run solph examples you need to have a solver installed (recommended: cbc), see the “Solver” or “Windows Solver” section. To get more information about the solph examples see the “Solph Examples” section.