Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jurgen-lentz committed Dec 8, 2024
1 parent 177d1c2 commit 94680c3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 103 deletions.
103 changes: 6 additions & 97 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,111 +34,20 @@ python3.9 -m venv venv
source venv/bin/activate
```

## Installing SCIPOptSuite from the binary distribution

The SCIPOptSuite can either be installed from the binary distribution or it can be build and installed manually from source. If you want to compile the SCIPOptSuite from source, please skip to the next section.

To install a binary distribution of the SCIPOptSuite, navigate to the [download page](https://scipopt.org/index.php#download) and select at least version 8.0.0 and your operating system. After the installation, please check that you can run `scip` and `gcg` from the command line.

Next, skip to the instructions to install PySCIPOpt.

## Compiling SCIPOptSuite from source

To install the SCIPOptSuite from source, you need to [install SCIP and GCG using CMake](https://scipopt.org/doc/html/md_INSTALL.php#CMAKE). The Makefile system is not compatible with PyGCGOpt and PySCIPOpt!

As an example, from the root directory of the source distribution of the SCIPOptSuite, you can run the following commands to build and install locally:
```
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DSHARED=on -DCMAKE_INSTALL_PREFIX=./install -DGCG_DEV_BUILD=ON -DZIMPL=OFF -DIPOPT=OFF -DPAPILO=OFF
make -j4 && make install
```

If SCIP and GCG are not installed in the global path, you need to specify the install location using the environment variable `SCIPOPTDIR` before you can install PySCIPOpt and PyGCGOpt:

- On Linux and macOS:\
`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` and `libgcg.so` (for Linux) and a subdirectory `include` that
contains the corresponding header files:

SCIPOPTDIR
> lib
> libscip.so ...
> libgcg.so ...
> include
> scip
> gcg
> lpi
> nlpi
> ...

If GCG is installed in a different location than SCIP (this is *not* the default), you can specify the GCG install directory with the `GCGOPTDIR` environment variable.

To make the shared libraries available at runtime for PySCIPOpt and PyGCGOpt, you need to add them to the corresponding environment variables:
- On Linux:
`export LD_LIBRARY_PATH=<path_to_install_dir>/lib`
- On macOS:
`export DYLD_FALLBACK_LIBRARY_PATH=<path_to_install_dir>/lib`
- On Windows:
`set PATH=%PATH%;<path_to_install_dir>\bin`


## Installing PySCIPOpt from PyPI

To install PySCIPOpt using pip, run the following:
```
pip install PySCIPOpt>=4.0.0
```


## Installing PySCIPOpt from source

For detailed instructions, please read the [installation instructions of PySCIPOpt](https://github.com/scipopt/PySCIPOpt/blob/master/INSTALL.md#building-everything-from-source).

In short, you can install PySCIPOpt from source with `pip`. For that, run the following command:
```
pip install <path/to/PySCIPOpt>
```

## Installing PyGCGOpt from PyPI

Simply run the folloing to install PyGCGOpt with `pip`:
Simply run the following to install PyGCGOpt (and its requirement PySCIPOpt) with `pip`:
```
pip install PySCIPOpt
pip install PyGCGOpt
```

## Install PyGCGOpt from source
-------------------------------

First, install the requirements for building PyGCGOpt:
```
pip install -r requirements.txt
```

Furthermore, you need to have the Python development files installed on your system (error message "Python.h not found"):
```
sudo apt-get install python3-dev # for Python 3, on Linux
```

Then, compile and install PyGCGOpt:
```
pip install .
```

In case the compiler cannot find SCIP or GCG header files, please make sure that you installed the SCIPOptSuite globally or that you set the `SCIPOPTDIR` environment variable (see above).

### Building with debug information

To use debug information in PyGCGOpt you need to build it like this:
The following table summarizes which versions of PyGCGOpt and PySCIPOpt are compatible:

python -m pip install --install-option="--debug" .
| PySCIPOpt | PyGCGOpt |
|----|----|
| 5.2.1 | 0.4.0 |

Be aware that you will need the **debug library** of the SCIPOptSuite for this to work
(`cmake .. -DCMAKE_BUILD_TYPE=Debug`).

## Testing new installation

Expand Down
12 changes: 6 additions & 6 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Sphinx
sphinx_copybutton
furo
myst-parser
nbsphinx
jupyter
Sphinx==4.3.1
sphinx_copybutton==0.4.0
furo==2021.11.23
myst-parser==0.15.2
nbsphinx==0.8.7
jupyter==1.0.0

0 comments on commit 94680c3

Please sign in to comment.