Skip to content

Commit 04e3b5f

Browse files
committed
Update Mac Installation docs in light of conda-numpy/pip-galpy conflict issue
1 parent 3be12ec commit 04e3b5f

File tree

1 file changed

+35
-17
lines changed

1 file changed

+35
-17
lines changed

doc/source/installation.rst

+35-17
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,15 @@ TL;DR
2121

2222
.. tab-item:: Mac
2323

24-
The recommended way to install is using ``pip``::
24+
The recommended way to install in non-``conda`` environments (e.g., ``venv``) is using ``pip``::
2525

2626
python -m pip install --only-binary galpy galpy
2727

28-
This should install a fully-working version of galpy for Python versions >=3.8. If this fails, please open an `issue <https://github.com/jobovy/galpy/issues/new?assignees=&labels=&template=bug_report.md&title=>`__ on the ``galpy`` GitHub page, making sure to specify your platform and Python version. Then read on at :ref:`detailed_installation` to learn how to install ``galpy`` when the above fails.
28+
If you are using ``conda``, especially if you used it to install ``numpy``, the recommended way to install is using ``conda``::
29+
30+
conda install -c conda-forge gsl galpy
31+
32+
These should install a fully-working version of galpy for Python versions >=3.8. If this fails, please open an `issue <https://github.com/jobovy/galpy/issues/new?assignees=&labels=&template=bug_report.md&title=>`__ on the ``galpy`` GitHub page, making sure to specify your platform and Python version. Then read on at :ref:`detailed_installation` to learn how to install ``galpy`` when the above fails.
2933

3034
.. tab-item:: Windows
3135

@@ -140,25 +144,41 @@ If you are reading this, either the simple installation instructions at the top
140144

141145
python -m pip install --only-binary galpy galpy
142146

143-
Alternatively, you can install both the GSL and ``galpy`` using ``conda``::
147+
However, if you are using ``conda`` and, particularly, if you used it to install
148+
``numpy``, issues can arise with multiple OpenMP runtimes and the best way to
149+
avoid those is to install using ``conda``::
144150

145151
conda install -c conda-forge gsl galpy
146152

147-
To compile ``galpy`` from source, you will first need to install the GSL. The
148-
easiest way to do this is using `Homebrew <http://brew.sh/>`__ as::
153+
To compile ``galpy`` from source, you will first need to install the GSL and OpenMP.
154+
The easiest way to do this is using `Homebrew <http://brew.sh/>`__ as::
149155

150-
brew install gsl
156+
brew install gsl libomp
151157

152-
Alternatively, you can use ``conda`` to install the GSL and use ``conda`` to
153-
manage your Python environment. Install the GSL in your preferred environment
154-
with::
158+
Note that in order not to conflict with other OpenMP installations, the
159+
``Homebrew`` version of ``libomp`` is "keg-only" and you have to set the
160+
environment variables to use it. You can do this by running::
155161

156-
conda install -c conda-forge gsl
162+
export CFLAGS=-I$(brew --prefix)/include -I/usr/local/opt/libomp/include
163+
export LDFLAGS=-L$(brew --prefix)/lib -L/usr/local/opt/libomp/lib
164+
export LD_LIBRARY_PATH=$(brew --prefix)/lib:/usr/local/opt/libomp/lib
157165

158-
Once you have installed the GSL, compile ``galpy`` from source using::
166+
Note that the exact paths may vary depending on your system (run
167+
``brew info libomp`` to get the correct paths).
168+
169+
Alternatively, you can use ``conda`` to install the GSL and OpenMP and use
170+
``conda`` to manage your Python environment. Install the GSL and OpenMP in your
171+
preferred environment with::
172+
173+
conda install -c conda-forge gsl llvm-openmp
174+
175+
Then set the path and relevant environment variables using::
159176

160177
export CFLAGS="$CFLAGS -I`gsl-config --prefix`/include"
161178
export LDFLAGS="$LDFLAGS -L`gsl-config --prefix`/lib"
179+
180+
Once you have installed the GSL and OpenMP, compile ``galpy`` from source using::
181+
162182
python -m pip install --no-binary galpy galpy
163183

164184
The commands in this section so far all install the latest release. If you want
@@ -175,8 +195,8 @@ If you are reading this, either the simple installation instructions at the top
175195
workflows that should always be using the latest version of ``galpy``
176196
(e.g., to test your code against the latest development version).
177197

178-
If this doesn't work, follow the steps above to install the GSL, define the
179-
relevant environment variables, and then install from source using::
198+
If this doesn't work, follow the steps above to install the GSL and OpenMP,
199+
define the relevant environment variables, and then install from source using::
180200

181201
python -m pip install git+https://github.com/jobovy/galpy.git#egg=galpy
182202

@@ -259,11 +279,9 @@ and then clone it to your local machine::
259279

260280
git clone git@github.com:YOUR_GITHUB_USERNAME/galpy.git
261281

262-
Then, install the GSL as described in the relevant :ref:`detailed_installation`
263-
section above. Once you have installed the GSL, compile ``galpy`` from source::
282+
Then, install the GSL and OpenMP as described in the relevant :ref:`detailed_installation`
283+
section above. Then compile ``galpy`` from source::
264284

265-
export CFLAGS="$CFLAGS -I`gsl-config --prefix`/include"
266-
export LDFLAGS="$LDFLAGS -L`gsl-config --prefix`/lib"
267285
python -m pip install -e .
268286

269287
Whenever you change the C code, you have to re-run the last command. Note that

0 commit comments

Comments
 (0)