Skip to content

Mac Installation Instructions

Bharat Medasani edited this page Jun 25, 2021 · 22 revisions

Mac installation instructions

Before installing simsopt, get openmpi either through HomeBrew or MacPorts. Then use a virtual environment either from conda or python3 venv.

Macports

  1. Install macports. The installation instructions can be found here.

  2. Install gcc. Here gcc9 is shown. To find out the available versions of gcc use port search gcc.

    sudo port install gcc9
  3. After installing gcc9, set it as default gcc. To find the installed versions of gcc use the command port select --list gcc. Since we have only gcc9,

    sudo port select --set gcc mp-gcc9
  4. Install openmpi.

    sudo port install openmpi-gcc9
    sudo port select --set mpi openmpi-gcc9-fortran
  5. (Optional) Install wget, if you want to download simsopt source code as a zip file

    sudo port install wget
    

Conda

Coming soon.

Python3 venv

Mac Catalina (10.15) comes with python 3.7, which can be accessed with python3 command.

  1. Create a virtual environment named simsopt_ve using venv module
    python3 -m venv <path_where_you_want_the_venv>/simsopt_ve
  2. Activate the virtual environment.
    source <path_where_you_want_the_venv>/simsopt_ve/bin/activate
    After activating the virtual environment, (simsopt_ve) should appear in front of the command prompt.
  3. To confirm that simsopt_ve is activated, run which python, which should point to <path_where_you_want_the_venv>/simsopt_ve/bin/python.

Install simsopt

  1. If using conda virtual environment, activate the virtual environment
    conda activate <your_ve>
  2. Install simsopt. It is advisable to install mpi4py also along with simsopt.
    1. If installing from pypi, it is very simple.
      pip install "simsopt[MPI]"
      
    2. For local install, get the source code either by downloading the zip file and unzip or via git. If using zip file
       wget https://github.com/hiddenSymmetries/simsopt/archive/refs/heads/master.zip
       unzip master.zip
       cd simsopt-master
    3. If you are cloning from github
      git clone [email protected]:hiddenSymmetries/simsopt.git
      cd simsopt
    4. For editable install (if you are a developer, you don't want to repeatedly reinstall simsopt after changing the source code), use the -e flag. Otherwise you can omit the -e flag.
      pip install -e ".[MPI]"

Notes

  1. If you are installing simsopt at multiple environments with different compilers or different versions of libraries, use --no-cache-dir option when running the pip command.
    pip install --no-cache-dir "simsopt[MPI]"