Installation

First install gfortran

Since COSMIC requires compilation of Fortran code, you’ll need a gfortran installation. Several options exist for installing gfortran including through homebrew or from source. If you have a gfortran installation that works with other code bases, chances are it will work with COSMIC too!

Have you recently upgrade to Apple silicon?

For users who have recently upgraded to an Apple silicon processor with ARM architecture, it is important that you ensure your Python architecture is ARM and not X86_64. This can be done by running the following command:

python -c "import platform; print(platform.architecture())"

If the output is (‘64bit’, ‘arm64’), then you are using the correct architecture. If the output is (‘64bit’, ‘x86_64’), then you are using the wrong architecture. To fix this, you can install the ARM version of Python by running the following command:

brew install python@3.10

If brew install doesn’t work, you can download the specific MacOS gfortran installers from this link, which is maintained by the gfortran team. Be sure to match the version of gfortran with the version of MacOS you are using.

brew install gcc
sudo apt-get install gfortran

Note

If you’re using a different package manager, you can search for gfortran in the package manager’s search bar.

Unfortunately, we do not support Windows installations due to issues with the gfortran compiler and libraries. We recommend using a Unix-based system to run COSMIC. If you are using Windows, you can try using the Windows Subsystem for Linux (WSL) to run COSMIC. You can find instructions on how to install WSL here and then follow the Unix installation instructions above.

…then install COSMIC

We recommend following the code below to create a conda environment for COSMIC. This will ensure that all dependencies are installed correctly. If you don’t have conda installed, you can download it from here.

conda create -n cosmic numpy h5py python=3.10
source activate cosmic
pip install cosmic-popsynth

Note

The largest hurdle for installation on MacOS is keeping your gfortran installation up to date with the linking libraries in Mac’s commandlinetools. When in doubt, reinstall your gfortran library then try reinstalling COSMIC.

conda create --name cosmic python=3.10 numpy h5py
source activate cosmic
pip install cosmic-popsynth

Unfortunately, we do not support Windows installations due to issues with the gfortran compiler and libraries. We recommend using a Unix-based system to run COSMIC. If you are using Windows, you can try using the Windows Subsystem for Linux (WSL) to run COSMIC. You can find instructions on how to install WSL here and then follow the Unix installation instructions above.

Using IPython and Jupyter with COSMIC

Please note that using the global instance of the conda jupyter-notebook or ipython will most likely fail when trying to use COSMIC. PLEASE explicitly install both into the COSMIC environment:

conda install jupyter ipython
pip install jupyter ipython