PySCIPOpt requires a working installation of the SCIP Optimization Suite. Please, make sure that your SCIP installation works!
Note that the latest PySCIPOpt version is usually only compatible with the latest major release of the SCIP Optimization Suite. The following table summarizes which version of PySCIPOpt is required for a given SCIP version:
| SCIP | PySCIPOpt |
|---|---|
| 7.0 | 3.x |
| 6.0 | 2.x |
| 5.0 | 1.4, 1.3 |
| 4.0 | 1.2, 1.1 |
| 3.2 | 1.0 |
If SCIP is not installed in the global path
you need to specify the install location using the environment variable
SCIPOPTDIR:
- on Linux and OS X:
export SCIPOPTDIR=<path_to_install_dir> - on Windows:
set SCIPOPTDIR=<path_to_install_dir>(cmd, Cmder, WSL)
$Env:SCIPOPTDIR = "<path_to_install_dir>"(powershell)
SCIPOPTDIR needs to have a subdirectory lib that contains the
library, e.g. libscip.so (for Linux) and a subdirectory include that
contains the corresponding header files:
SCIPOPTDIR
> lib
> libscip.so ...
> include
> scip
> lpi
> nlpi
> ...
If you are not using the installer packages, you need to install the SCIP Optimization Suite using CMake. The Makefile system is not compatible with PySCIPOpt!
On Windows it is highly recommended to use the Anaconda Python Platform.
python -m pip install pyscipopt
On Windows you may need to ensure that the scip library can be found
at runtime by adjusting your PATH environment variable:
- on Windows:
set PATH=%PATH%;%SCIPOPTDIR%\bin
On Linux and OS X this is encoded in the generated PySCIPOpt library and therefore not necessary.
Recommended is to install in a virtual environment (e.g. python3 -m venv <DIR_PATH>).
Please note that a globally installed version of PySCIPOpt on your machine might lead to problems.
After setting up and activating your virtual environment (source <DIR_PATH>/bin/activate) make sure you have Cython installed, at least version 0.21
pip install cython
Note you will also need the wheel package, which usually is already installed:
pip install wheel
Furthermore, you need to have the Python development files installed on your system (error message "Python.h not found"):
sudo apt-get install python-dev # for Python 2, on Linux
sudo apt-get install python3-dev # for Python 3, on Linux
After setting up SCIPOPTDIR as specified above install pyscipopt
export SCIPOPTDIR=/path/to/scip/install/dir
python -m pip install [-e] .
For recompiling the source in the current directory . use
python -m pip install --compile .
To use debug information in PySCIPOpt you need to build it like this:
python -m pip install --install-option="--debug" .
Be aware that you will need the debug library of the SCIP
Optimization Suite for this to work
(cmake .. -DCMAKE_BUILD_TYPE=Debug).
To test your brand-new installation of PySCIPOpt you need pytest on your system.
pip install pytest
Here is the complete installation procedure.
Tests can be run in the PySCIPOpt directory with: :
py.test # all the available tests
py.test tests/test_name.py # a specific tests/test_name.py (Unix)
Ideally, the status of your tests must be passed or skipped. Running
tests with pytest creates the __pycache__ directory in tests and,
occasionally, a model file in the working directory. They can be
removed harmlessly.
-
readline:
libreadline.so.6: undefined symbol: PCThis is a readline/ncurses compatibility issue that can be fixed like this (when usingconda):conda install -c conda-forge readline=6.2