Skip to content

Instantly share code, notes, and snippets.

@syrte
Last active November 18, 2021 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save syrte/8a5a44e3b97b254a0ea48eac1aabbc0f to your computer and use it in GitHub Desktop.
Save syrte/8a5a44e3b97b254a0ea48eac1aabbc0f to your computer and use it in GitHub Desktop.
Manual installation of agama in a plain conda enviroment
# create env and install dependency
conda create -n agama python=3.8 numpy gsl glpk eigen cvxopt
conda activate agama
# download files
cd $HOME/src
wget https://github.com/GalacticDynamics-Oxford/Agama/archive/master.zip -O agama.zip
wget https://github.com/GalacticDynamics-Oxford/unsio/archive/master.zip -O unsio.zip
wget https://github.com/cvxopt/cvxopt/archive/master.zip -O cvxopt.zip
unzip agama.zip
unzip unsio.zip
unzip cvxopt.zip
mv Agama-master agama
mv unsio-master unsio
mv cvxopt-master cvxopt
# compile unsio
cd unsio
make
cd ..
# check the enviroment path
echo $CONDA_PREFIX
python -c "import numpy as np; print(np.get_include())"
python -c "import sysconfig as sc; print(sc.get_paths()['include'])"
# create makefile
cat <<EOF >agama/Makefile.local
# ---------------------------------------------------
# Makefile.local
FC = gfortran
LINK = \$(CXX)
# optional: -std=c++11
CXXFLAGS += -fPIC -fopenmp -Wall -O2 -march=native
COMPILE_FLAGS += -I\$(CONDA_PREFIX)/include/
LINK_FLAGS += -L\$(CONDA_PREFIX)/lib -lgsl -lgslcblas
COMPILE_FLAGS += -DHAVE_PYTHON -I\$(CONDA_PREFIX)/include/python3.8 -I\$(CONDA_PREFIX)/lib/python3.8/site-packages/numpy/core/include
LINK_FLAGS += -L\$(CONDA_PREFIX)/lib -lpython3.8
COMPILE_FLAGS += -DHAVE_EIGEN -I\$(CONDA_PREFIX)/include/eigen3
COMPILE_FLAGS += -DHAVE_CVXOPT -I\$(HOME)/src/cvxopt/src/C
COMPILE_FLAGS += -DHAVE_UNSIO -I\$(HOME)/src/unsio/unsio
LINK_FLAGS += -L\$(HOME)/src/unsio -lunsio -lnemo
LINK_FLAGS += -Wl,-rpath,\$(CONDA_PREFIX)/lib
EXE_FLAGS += -Wl,-rpath,\$(CONDA_PREFIX)/lib # necessary for compling exe
# ---------------------------------------------------
EOF
# make and test
cd agama
make # note: do not use parallel make
make test
@syrte
Copy link
Author

syrte commented Nov 18, 2021

Then one may install other useful python packages afterwards

conda install ipython jupyter jupyterlab numpy scipy numba pandas astropy scikit-learn sympy cython matplotlib seaborn h5py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment