Skip to content

Commit a9d8f59

Browse files
authored
Add instructions to install on apple silicon (#335)
1 parent 57ece43 commit a9d8f59

File tree

1 file changed

+56
-26
lines changed

1 file changed

+56
-26
lines changed

doc/source/user_guide/install_pysteps.rst

Lines changed: 56 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -45,45 +45,78 @@ Other optional dependencies include:
4545
But, if you want to contribute to pysteps or edit the package, you need to install
4646
pysteps in development mode: :ref:`Contributing to pysteps <contributor_guidelines>`.
4747

48-
Anaconda install (recommended)
49-
------------------------------
50-
51-
Conda is an open-source package management system and environment management
52-
system that runs on Windows, macOS, and Linux.
53-
Conda quickly installs, runs, and updates packages and their dependencies.
48+
Install with conda/mamba (recommended)
49+
--------------------------------------
50+
51+
`Conda <https://docs.conda.io/>`_ is an open-source package management system and environment
52+
management system that runs on Windows, macOS, and Linux.
53+
`Mamba <https://mamba.readthedocs.io/>`_ is a drop-in replacement for conda offering
54+
better performances and more reliable environment
55+
solutions. Mamba quickly installs, runs, and updates packages and their dependencies.
5456
It also allows you to easily create, save, load, or switch between different
5557
environments on your local computer.
5658

57-
Since version 1.0, pysteps is available in conda-forge, a community-driven
58-
package repository for anaconda.
59-
60-
There are two installation alternatives using anaconda: install pysteps in a
61-
pre-existing environment or install it new environment.
62-
63-
New environment
64-
~~~~~~~~~~~~~~~
59+
Since version 1.0, pysteps is available on `conda-forge <https://conda-forge.org/>`_,
60+
a community-driven package repository for conda packages.
6561

66-
In a terminal, to create a new conda environment and install pysteps, run::
62+
To install pysteps with mamba in a new environment, run in a terminal::
6763

68-
$ conda create -n pysteps
69-
$ source activate pysteps
64+
mamba create -n pysteps python=3.10
65+
mamba activate pysteps
7066

71-
This will create and activate the new python environment. The next step is to
72-
add the conda-forge channel where the pysteps package is located::
67+
This will create and activate the new python environment called 'pysteps' using python 3.10.
68+
The next step is to add the conda-forge channel where the pysteps package is located::
7369

74-
$ conda config --env --prepend channels conda-forge
70+
conda config --env --prepend channels conda-forge
7571

7672
Let's set this channel as the priority one::
7773

78-
$ conda config --env --set channel_priority strict
74+
conda config --env --set channel_priority strict
7975

8076
The latter step is not strictly necessary but is recommended since
81-
the conda-forge and the default Anaconda channels are not 100% compatible.
77+
the conda-forge and the default conda channels are not 100% compatible.
8278

8379
Finally, to install pysteps and all its dependencies run::
8480

85-
$ conda install pysteps
81+
mamba install pysteps
82+
83+
Install pysteps on Apple Silicon Macs
84+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
85+
86+
On conda-forge, pysteps is currently compiled for Mac computers with Intel processors (osx-64).
87+
However, thanks to `Rosetta 2 <https://support.apple.com/en-us/HT211861>`_ it is
88+
possible to install the same package on a Mac computers with an Apple Silicon processor
89+
(arm-64).
90+
91+
First, make sure that Rosetta 2 is installed::
92+
93+
softwareupdate --install-rosetta
94+
95+
Use mamba to create a new environment called 'pysteps' for intel packages with python 3.10::
96+
97+
CONDA_SUBDIR=osx-64 mamba create -n pysteps python=3.10
98+
mamba activate pysteps
99+
100+
Make sure that conda/mamba commands in this environment use intel packages::
86101

102+
conda config --env --set subdir osx-64
103+
104+
Verify that the correct platform is being used::
105+
106+
python -c "import platform;print(platform.machine())" # Should print "x86_64"
107+
108+
Finally, run the same pysteps install instructions as given above::
109+
110+
conda config --env --prepend channels conda-forge
111+
conda config --env --set channel_priority strict
112+
mamba install pysteps
113+
114+
We can now verify that pysteps loads correctly::
115+
116+
python -c "import pysteps"
117+
118+
Note that the first time that pysteps is imported will typically take longer, as Rosetta 2
119+
needs to translate the binary code for the Apple Silicon processor.
87120

88121
Install from source
89122
-------------------
@@ -93,8 +126,6 @@ to adhere to the `PEP517 standards <https://www.python.org/dev/peps/pep-0517/>`_
93126
Using ``pip`` instead of ``setup.py`` guarantees that all the package dependencies
94127
are properly handled during the installation process.
95128

96-
.. _install_osx_users:
97-
98129
OSX users: gcc compiler
99130
~~~~~~~~~~~~~~~~~~~~~~~
100131

@@ -134,7 +165,6 @@ the homebrew installation. For example::
134165
export CC=/usr/local/Cellar/gcc/8.3.0/bin/gcc-8
135166
export CXX=/usr/local/Cellar/gcc/8.3.0/bin/g++-8
136167

137-
138168
Then, you can continue with the normal installation procedure described next.
139169

140170
Installation using pip

0 commit comments

Comments
 (0)