Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use tabs for different OSs in installation page #556

Merged
merged 1 commit into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.mathjax','sphinx.ext.ifconfig',
'sphinx.ext.linkcode',"sphinxext.opengraph"]
'sphinx.ext.linkcode',"sphinxext.opengraph","sphinx_design"]

# from disnake via:
# https://twitter.com/readthedocs/status/1541830907082022913?s=20&t=eJ293FfjILT7sIxEyz834w
Expand Down
301 changes: 168 additions & 133 deletions doc/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,35 @@ Installation
TL;DR
------

If you are on a **Linux or Mac** system, the recommended way to install is using ``pip``::
.. tab-set::
:class: platform-selector-tabset

python -m pip install --only-binary galpy galpy
.. tab-item:: Linux

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.
The recommended way to install is using ``pip``::

If you are on a **Windows** system, the recommended way to install is using ``conda``::
python -m pip install --only-binary galpy galpy

conda install -c conda-forge gsl galpy
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.

Note that on Windows it is necessary to explicitly install the GNU Scientific Library (GSL) in this way.
.. tab-item:: Mac

For more info on installation options, jump to the detailed instructions below:
The recommended way to install is using ``pip``::

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

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.

.. tab-item:: Windows

The recommended way to install is using ``conda``::

conda install -c conda-forge gsl galpy

Note that on Windows it is necessary to explicitly install the GNU Scientific Library (GSL) in this way.

For more info on installation options, jump to the detailed instructions below: :ref:`detailed_installation`

* :ref:`detailed_installation_mac`
* :ref:`detailed_installation_linux`
* :ref:`detailed_installation_win`

.. _deps_installation:

Expand Down Expand Up @@ -59,188 +71,182 @@ If you are reading this, either the simple installation instructions at the top
install the GSL from the ``anaconda`` channel, it will often not work with
``galpy``. In an ``environment.yml`` file, use ``- conda-forge::gsl``.

.. _detailed_installation_mac:
.. tab-set::
:class: platform-selector-tabset

Mac installation
++++++++++++++++
.. tab-item:: Linux

As discussed in the :ref:`tldr_installation` section above, the simplest and
quickest way to install the latest ``galpy`` release on a Mac is to use
``pip``::
As discussed in the :ref:`tldr_installation` section above, the simplest and
quickest way to install the latest ``galpy`` release on Linux is to use
``pip``::

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

Alternatively, you can install both the GSL and ``galpy`` using ``conda``::
Alternatively, you can install both the GSL and ``galpy`` using ``conda``::

conda install -c conda-forge gsl galpy
conda install -c conda-forge gsl galpy

To compile ``galpy`` from source, you will first need to install the GSL. The
easiest way to do this is using `Homebrew <http://brew.sh/>`__ as::
To compile ``galpy`` from source, you will first need to install the GSL. The
easiest way to do this is using your package manager. On Linux distributions
with ``apt-get``, do::

brew install gsl --universal
apt-get install libgsl0-dev

Alternatively, you can use ``conda`` to install the GSL and use ``conda`` to
manage your Python environment. Install the GSL in your preferred environment
with::
or on distros with ``yum``, do::

conda install -c conda-forge gsl

Once you have installed the GSL, compile ``galpy`` from source using::
yum install gsl-devel

export CFLAGS="$CFLAGS -I`gsl-config --prefix`/include"
export LDFLAGS="$LDFLAGS -L`gsl-config --prefix`/lib"
python -m pip install --no-binary galpy galpy
Alternatively, you can use ``conda`` to install the GSL and use ``conda`` to
manage your Python environment. Install the GSL in your preferred environment
with::

The commands in this section so far all install the latest release. If you want
to install the latest bleeding-edge version, you have two options. If the
installion in the :ref:`tldr_installation` works for you, you can download a
binary wheel for the latest ``main`` branch version on GitHub, which is
available `here <http://www.galpy.org.s3-website.us-east-2.amazonaws.com/list.html>`__.
To install these wheels, download the relevant version for your operating
system and Python version and do::
conda install -c conda-forge gsl

python -m pip install WHEEL_FILE.whl
Once you have installed the GSL, compile ``galpy`` from source using::

These wheels have stable ``...latest...`` names, so you can embed them in
workflows that should always be using the latest version of ``galpy``
(e.g., to test your code against the latest development version).
export CFLAGS="$CFLAGS -I`gsl-config --prefix`/include"
export LDFLAGS="$LDFLAGS -L`gsl-config --prefix`/lib"
python -m pip install --no-binary galpy galpy

If this doesn't work, follow the steps above to install the GSL, define the
relevant environment variables, and then install from source using::
The commands in this section so far all install the latest release. If you want
to install the latest bleeding-edge version, you have two options. If the
installion in the :ref:`tldr_installation` works for you, you can download a
binary wheel for the latest ``main`` branch version on GitHub, which is available
`here <http://www.galpy.org.s3-website.us-east-2.amazonaws.com/list.html>`__.
To install these wheels, download the relevant version for your operating system
and Python version and do::

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

You can also download the source code or clone the repository, navigate to the
top-level directory, and install using::
These wheels have stable ``...latest...`` names, so you can embed them in
workflows that should always be using the latest version of ``galpy``
(e.g., to test your code against the latest development version).

python -m pip install .
If this doesn't work, follow the steps above to install the GSL, define the
relevant environment variables, and then install from source using::

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

Linux installation
++++++++++++++++++
You can also download the source code or clone the repository, navigate to the
top-level directory, and install using::

As discussed in the :ref:`tldr_installation` section above, the simplest and
quickest way to install the latest ``galpy`` release on Linux is to use
``pip``::
python -m pip install .

python -m pip install --only-binary galpy galpy
.. tab-item:: Mac

Alternatively, you can install both the GSL and ``galpy`` using ``conda``::
As discussed in the :ref:`tldr_installation` section above, the simplest and
quickest way to install the latest ``galpy`` release on a Mac is to use
``pip``::

conda install -c conda-forge gsl galpy
python -m pip install --only-binary galpy galpy

To compile ``galpy`` from source, you will first need to install the GSL. The
easiest way to do this is using your package manager. On Linux distributions
with ``apt-get``, do::
Alternatively, you can install both the GSL and ``galpy`` using ``conda``::

apt-get install libgsl0-dev

or on distros with ``yum``, do::
conda install -c conda-forge gsl galpy

yum install gsl-devel
To compile ``galpy`` from source, you will first need to install the GSL. The
easiest way to do this is using `Homebrew <http://brew.sh/>`__ as::

Alternatively, you can use ``conda`` to install the GSL and use ``conda`` to
manage your Python environment. Install the GSL in your preferred environment
with::
brew install gsl --universal

conda install -c conda-forge gsl
Alternatively, you can use ``conda`` to install the GSL and use ``conda`` to
manage your Python environment. Install the GSL in your preferred environment
with::

Once you have installed the GSL, compile ``galpy`` from source using::
conda install -c conda-forge gsl

export CFLAGS="$CFLAGS -I`gsl-config --prefix`/include"
export LDFLAGS="$LDFLAGS -L`gsl-config --prefix`/lib"
python -m pip install --no-binary galpy galpy
Once you have installed the GSL, compile ``galpy`` from source using::

The commands in this section so far all install the latest release. If you want
to install the latest bleeding-edge version, you have two options. If the
installion in the :ref:`tldr_installation` works for you, you can download a
binary wheel for the latest ``main`` branch version on GitHub, which is available
`here <http://www.galpy.org.s3-website.us-east-2.amazonaws.com/list.html>`__.
To install these wheels, download the relevant version for your operating system
and Python version and do::
export CFLAGS="$CFLAGS -I`gsl-config --prefix`/include"
export LDFLAGS="$LDFLAGS -L`gsl-config --prefix`/lib"
python -m pip install --no-binary galpy galpy

python -m pip install WHEEL_FILE.whl
The commands in this section so far all install the latest release. If you want
to install the latest bleeding-edge version, you have two options. If the
installion in the :ref:`tldr_installation` works for you, you can download a
binary wheel for the latest ``main`` branch version on GitHub, which is
available `here <http://www.galpy.org.s3-website.us-east-2.amazonaws.com/list.html>`__.
To install these wheels, download the relevant version for your operating
system and Python version and do::

These wheels have stable ``...latest...`` names, so you can embed them in
workflows that should always be using the latest version of ``galpy``
(e.g., to test your code against the latest development version).
python -m pip install WHEEL_FILE.whl

If this doesn't work, follow the steps above to install the GSL, define the
relevant environment variables, and then install from source using::
These wheels have stable ``...latest...`` names, so you can embed them in
workflows that should always be using the latest version of ``galpy``
(e.g., to test your code against the latest development version).

python -m pip install git+https://github.com/jobovy/galpy.git#egg=galpy
If this doesn't work, follow the steps above to install the GSL, define the
relevant environment variables, and then install from source using::

You can also download the source code or clone the repository, navigate to the
top-level directory, and install using::
python -m pip install git+https://github.com/jobovy/galpy.git#egg=galpy

python -m pip install .
You can also download the source code or clone the repository, navigate to the
top-level directory, and install using::

.. _detailed_installation_win:
python -m pip install .

Windows installation
++++++++++++++++++++
.. tab-item:: Windows

As discussed in the :ref:`tldr_installation` section above, the simplest and
quickest way to install the latest ``galpy`` release on Windows is to use
``conda``::
As discussed in the :ref:`tldr_installation` section above, the simplest and
quickest way to install the latest ``galpy`` release on Windows is to use
``conda``::

conda install -c conda-forge gsl galpy
conda install -c conda-forge gsl galpy

If you want to install the latest bleeding-edge version, you have to install
the GSL first as. In an existing ``conda`` environment, do::
If you want to install the latest bleeding-edge version, you have to install
the GSL first as. In an existing ``conda`` environment, do::

conda install -c conda-forge gsl
conda install -c conda-forge gsl

while if you don't want to use ``conda`` to manage your Python environment, you
can do::
while if you don't want to use ``conda`` to manage your Python environment, you
can do::

conda create -n gsl conda-forge::gsl
conda activate gsl
conda create -n gsl conda-forge::gsl
conda activate gsl

Either way, then set the path and relevant environment variables using::
Either way, then set the path and relevant environment variables using::

set PATH=%PATH%;"$CONDA_PREFIX\\Library\\bin"
set INCLUDE=%CONDA_PREFIX%\Library\include;%INCLUDE%
set LIB=%CONDA_PREFIX%\Library\lib;%LIB%
set LIBPATH=%CONDA_PREFIX%\Library\lib;%LIBPATH%
set PATH=%PATH%;"$CONDA_PREFIX\\Library\\bin"
set INCLUDE=%CONDA_PREFIX%\Library\include;%INCLUDE%
set LIB=%CONDA_PREFIX%\Library\lib;%LIB%
set LIBPATH=%CONDA_PREFIX%\Library\lib;%LIBPATH%

in the ``CMD`` shell or::
in the ``CMD`` shell or::

$env:Path+="$env:CONDA_PREFIX\Library\bin"
$env:INCLUDE="$env:CONDA_PREFIX\Library\include"
$env:LIB="$env:CONDA_PREFIX\Library\lib"
$env:LIBPATH="$env:CONDA_PREFIX\Library\lib"
$env:Path+="$env:CONDA_PREFIX\Library\bin"
$env:INCLUDE="$env:CONDA_PREFIX\Library\include"
$env:LIB="$env:CONDA_PREFIX\Library\lib"
$env:LIBPATH="$env:CONDA_PREFIX\Library\lib"

if you are using ``PowerShell``. Note that you have to execute these commands
from the ``conda`` environment such that the ``CONDA_PREFIX`` variable is set.
To compile with OpenMP on Windows, you have to also install Intel OpenMP via::
if you are using ``PowerShell``. Note that you have to execute these commands
from the ``conda`` environment such that the ``CONDA_PREFIX`` variable is set.
To compile with OpenMP on Windows, you have to also install Intel OpenMP via::

conda install -c anaconda intel-openmp
conda install -c anaconda intel-openmp

Then you can deactivate the conda environment (but you don't have to!).
Then you can deactivate the conda environment (but you don't have to!).

With the GSL set up, you can then download a binary wheel for the latest
``main`` branch version on GitHub, which is available
`here <http://www.galpy.org.s3-website.us-east-2.amazonaws.com/list.html>`__.
To install these wheels, download the relevant version for your operating
system and Python version and do::
With the GSL set up, you can then download a binary wheel for the latest
``main`` branch version on GitHub, which is available
`here <http://www.galpy.org.s3-website.us-east-2.amazonaws.com/list.html>`__.
To install these wheels, download the relevant version for your operating
system and Python version and do::

python -m pip install WHEEL_FILE.whl
python -m pip install WHEEL_FILE.whl

You can also compile from source using::
You can also compile from source using::

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

or you can download the source code or clone the repository, navigate to the
top-level directory, and install using::
or you can download the source code or clone the repository, navigate to the
top-level directory, and install using::

python -m pip install .
python -m pip install .

Whenever you run ``galpy``, you have to adjust the ``PATH`` variable as above.
These wheels have stable ``...latest...`` names, so you can embed them in
workflows that should always be using the latest version of ``galpy``
(e.g., to test your code against the latest development version).
Whenever you run ``galpy``, you have to adjust the ``PATH`` variable as above.
These wheels have stable ``...latest...`` names, so you can embed them in
workflows that should always be using the latest version of ``galpy``
(e.g., to test your code against the latest development version).

.. _dev_installation:

Expand Down Expand Up @@ -621,3 +627,32 @@ at ``$HOME/.galpyrc``. If you want to change any of the settings (for
example, you want Quantity output), you can edit this file. The
default configuration file can also be found :download:`here
<examples/galpyrc>`.


.. raw:: html

<script type="text/javascript">
var platform = "linux";
if (navigator.userAgent.indexOf("Win") !== -1) {
platform = "windows";
}
if (navigator.userAgent.indexOf("Mac") !== -1) {
platform = "mac";
}
$(document).ready(function(){
let platformSelectorTabsets= document.querySelectorAll('.platform-selector-tabset');
let all_tab_nodes, input_nodes, tab_label_nodes, correct_label, hash, correct_input;
for (let i = 0; i < platformSelectorTabsets.length; i++) {
all_tab_nodes = platformSelectorTabsets[i].children;
input_nodes = [...all_tab_nodes].filter(
child => child.nodeName === "INPUT");
tab_label_nodes = [...all_tab_nodes].filter(
child => child.nodeName === "LABEL");
correct_label = tab_label_nodes.filter(
label => label.textContent.trim().toLowerCase() === platform)[0];
hash = correct_label.getAttribute('for');
correct_input = input_nodes.filter(node => node.id === hash)[0];
correct_input.checked = true;
}
});
</script>
Loading