Skip to content
silviana amethyst edited this page Mar 4, 2025 · 34 revisions

Ideal build process

From top level after cloning, just

pip install .

Ideally, this should work. But today is a day the name of which ends in a y, so you'll probably be unlucky. But who knows!?!??! Give it a try!!!

  • You should at least have things like boost, boost-python, eigen, cmake, gmp, mpfr, mpc installed before this will work, I don't think pip will install these dependencies for you.

I find the error messages from pip install . from top level rather unhelpful at this time, so probably a more step-by-step will be better.


Building from source step-by-step

These instructions assume you have CMake, a modern C++ compiler.

  • Bertini is developed on MacOS and Linux, these instructions have not been tested on Windows. That's a work in progress.
  • We're working on pre-built wheels to eliminate this whole building from source thing, but it's a work in progress.

Install dependencies, clone the repo

  1. Use a package manager to install relevant packages.

    • We recommend Conda because it has all of the packages in one spot with the right versions.
    • Homebrew on MacOS makes these things kinda easy, too.

    a. With conda: conda activate, conda install gmp mpfr mpc cmake boost eigen conda-forge::libboost-python numpy. Your system also needs the build-essential package, it is likely installed by default.

    b. With another packager manager: $PACKAGE_MANAGER install gmp mpfr mpc cmake boost eigen boost-python3 build-essential, pip install numpy. If you're using apt, then you need the *-dev or -dev-all versions of some of these packages.

  2. Clone and move in. git clone https://github.com/bertiniteam/b2, then cd b2.

Build and install the compiled core.

  1. mkdir build && cd build

  2. cmake .., adding -DCMAKE_PREFIX_PATH=$CONDA_PREFIX if using Conda

  3. make install, or maybe sudo make install if needed.

    a. If your computer can handle the heat, try instead make install -j x, where x = a number dictating how much resources are dedicated towards compiling. It makes compiling much faster. A modern 32GB Ram laptop can comfortably run -j 4. 3 is a good starting point. I use 8 on my M3 Macintosh.

ℹ️ If you just want the core software for use with C++, you can stop here. If you want to use Bertini2 with Python, keep going.

Build the compiled-from-C++ Python bindings

  1. cd b2/python_bindings

  2. Install eigenpy. From Conda, conda install conda-forge::eigenpy. From Homebrew, brew install eigenpy.

  3. mkdir build && cd build

  4. cmake .., again adding -DCMAKE_PREFIX_PATH=$CONDA_PREFIX if using Conda

  5. make install or sudo make install

    a. See note on previous make install step for parallel building

Install the pure-Python part of the package. Last step!

  1. cd b2/python

  2. pip install .