@@ -14,34 +14,64 @@ Installing
14
14
<https://forum.generic-mapping-tools.org/c/questions/pygmt-q-a> `__.
15
15
16
16
17
+ Quickstart
18
+ ----------
19
+
20
+ The fastest way to install PyGMT is with the
21
+ `conda <https://docs.conda.io/projects/conda/en/latest/user-guide/index.html >`__
22
+ package manager which takes care of setting up a virtual environment, as well
23
+ as the installation of GMT and all the dependencies PyGMT depends on::
24
+
25
+ conda create --name pygmt --channel conda-forge pygmt
26
+
27
+ To activate the virtual environment, you can do::
28
+
29
+ conda activate pygmt
30
+
31
+ After this, check that everything works by running the following in a Python
32
+ interpreter (e.g. in a Jupyter notebook)::
33
+
34
+ import pygmt
35
+ pygmt.show_versions()
36
+
37
+ You are now ready to make you first figure!
38
+ Start by looking at the tutorials on our sidebar, good luck!
39
+
40
+ .. note ::
41
+
42
+ The sections below provide more detailed, step by step instructions to
43
+ installing and testing PyGMT for those who may have a slightly different
44
+ setup.
45
+
17
46
Which Python?
18
47
-------------
19
48
20
- You'll need **Python 3.7 or greater ** to run PyGMT. Old Python versions may
21
- work, but there is no guarantee that PyGMT will work as expected with old versions .
49
+ PyGMT is tested to run on **Python 3.7 or greater **. Older Python versions may
50
+ work, but there is no guarantee that PyGMT will behave as expected.
22
51
23
- We recommend using the `Anaconda <https://www.anaconda.com/distribution >`__ Python
24
- distribution to ensure you have all dependencies installed and the `` conda ``
25
- package manager available.
52
+ We recommend using the `Anaconda <https://www.anaconda.com/distribution >`__
53
+ Python distribution to ensure you have all dependencies installed and the
54
+ `` conda `` package manager available.
26
55
Installing Anaconda does not require administrative rights to your computer and
27
56
doesn't interfere with any other Python installations in your system.
28
57
29
58
30
59
Which GMT?
31
60
----------
32
61
33
- PyGMT requires Generic Mapping Tools (GMT) version 6 as a minimum, which is the latest
34
- released version that can be found at
62
+ PyGMT requires Generic Mapping Tools (GMT) version 6 as a minimum, which is the
63
+ latest released version that can be found at
35
64
the `GMT official site <https://www.generic-mapping-tools.org >`__.
36
- We need the latest GMT (>=6.1.1) since there are many changes being made to GMT itself in
37
- response to the development of PyGMT, mainly the new
65
+ We need the latest GMT (>=6.1.1) since there are many changes being made to GMT
66
+ itself in response to the development of PyGMT, mainly the new
38
67
`modern execution mode <https://docs.generic-mapping-tools.org/latest/cookbook/introduction.html#modern-and-classic-mode >`__.
39
68
40
- Compiled conda packages of GMT for Linux, macOS and Windows are provided through
41
- `conda-forge <https://anaconda.org/conda-forge/gmt >`__.
69
+ Compiled conda packages of GMT for Linux, macOS and Windows are provided
70
+ through `conda-forge <https://anaconda.org/conda-forge/gmt >`__.
42
71
Advanced users can also
43
72
`build GMT from source <https://github.com/GenericMappingTools/gmt/blob/master/BUILDING.md >`__
44
- instead, which is not so recommended but we would love to get feedback from anyone who tries.
73
+ instead, which is not so recommended but we would love to get feedback from
74
+ anyone who tries.
45
75
46
76
We recommend following the instructions further on to install GMT 6.
47
77
@@ -58,61 +88,97 @@ PyGMT requires the following libraries:
58
88
59
89
The following are optional (but recommended) dependencies:
60
90
61
- * `IPython <https://ipython.org/ >`__: For embedding the figures in Jupyter notebooks.
91
+ * `IPython <https://ipython.org/ >`__: For embedding the figures in Jupyter
92
+ notebooks.
62
93
63
94
64
95
Installing GMT and other dependencies
65
96
-------------------------------------
66
97
67
- Before installing PyGMT, we must install GMT itself along with the other dependencies.
68
- The easiest way to do this is using the ``conda `` package manager.
98
+ Before installing PyGMT, we must install GMT itself along with the other
99
+ dependencies. The easiest way to do this is via the ``conda `` package manager.
69
100
We recommend working in an isolated
70
101
`conda environment <https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html >`__
71
- to avoid issues with competing versions of its dependencies.
102
+ to avoid issues with conflicting versions of dependencies.
72
103
73
104
First, we must configure conda to get packages from the
74
105
`conda-forge channel <https://conda-forge.org/ >`__::
75
106
76
107
conda config --prepend channels conda-forge
77
108
78
- Now we can create a new conda environment with Python and all our dependencies installed
79
- (we'll call it ``pygmt `` but you can change it to whatever you want)::
109
+ Now we can create a new conda environment with Python and all our dependencies
110
+ installed (we'll call it ``pygmt `` but feel free to change it to whatever you
111
+ want)::
80
112
81
113
conda create --name pygmt python=3.9 pip numpy pandas xarray netcdf4 packaging gmt
82
114
83
- Activate the environment by running::
115
+ Activate the environment by running the following (** do not forget this step! **) ::
84
116
85
117
conda activate pygmt
86
118
87
- From now on, all commands will take place inside the conda virtual environment and won't
88
- affect your default installation.
119
+ From now on, all commands will take place inside the conda virtual environment
120
+ called 'pygmt' and won't affect your default 'base' installation.
89
121
90
122
91
123
Installing PyGMT
92
124
----------------
93
125
94
- Now that you have GMT installed and your conda environment activated, you can
95
- use ``conda `` to install the latest release of PyGMT from `conda-forge <https://anaconda.org/conda-forge/pygmt >`__::
126
+ Now that you have GMT installed and your conda virtual environment activated,
127
+ you can install PyGMT using any of the following methods:
128
+
129
+ Using conda (recommended)
130
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
131
+
132
+ This installs the latest stable release of PyGMT from
133
+ `conda-forge <https://anaconda.org/conda-forge/pygmt >`__::
96
134
97
135
conda install pygmt
98
136
99
- or use ``pip `` to install from `PyPI <https://pypi.org/project/pygmt >`__::
137
+ Using pip
138
+ ~~~~~~~~~
139
+
140
+ This installs the latest stable release from
141
+ `PyPI <https://pypi.org/project/pygmt >`__::
100
142
101
143
pip install pygmt
102
144
103
- Alternatively, you can install the development version from the GitHub repository::
145
+ Alternatively, you can install the latest development version from
146
+ `TestPyPI <https://test.pypi.org/project/pygmt >`__::
147
+
148
+ pip install --pre --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple pygmt
104
149
105
- pip install https://github.com/GenericMappingTools/pygmt/archive/master.zip
150
+ or from PyGMT's `GitHub repository <https://github.com/GenericMappingTools/pygmt >`__
151
+ (slower as it downloads the whole archive)::
106
152
107
- This will allow you to use the ``pygmt `` library from Python.
153
+ pip install git+https://github.com/GenericMappingTools/pygmt.git#egg=pygmt
154
+
155
+ Any of the above methods (conda/pip) should allow you to use the ``pygmt ``
156
+ library from Python.
108
157
109
158
110
159
Testing your install
111
160
--------------------
112
161
162
+ Quick check
163
+ ~~~~~~~~~~~
164
+
165
+ To ensure that PyGMT and its depedencies are installed correctly, run the
166
+ following in your Python interpreter::
167
+
168
+ import pygmt
169
+ pygmt.show_versions()
170
+
171
+ Or run this in the command line::
172
+
173
+ python -c "import pygmt; pygmt.show_versions()"
174
+
175
+
176
+ Full test (optional)
177
+ ~~~~~~~~~~~~~~~~~~~~
178
+
113
179
PyGMT ships with a full test suite.
114
- You can run our tests after you install it but you will need a few extra dependencies as
115
- well (be sure to have your conda env activated)::
180
+ You can run our tests after you install it but you will need a few extra
181
+ dependencies as well (be sure to have your conda environment activated)::
116
182
117
183
conda install pytest pytest-mpl ipython
118
184
@@ -132,9 +198,9 @@ This can happen if you have multiple versions of GMT installed.
132
198
133
199
You can tell PyGMT exactly where to look for ``libgmt `` by setting the
134
200
``GMT_LIBRARY_PATH `` environment variable.
135
- This should be set to the directory where ``libgmt.so ``, ``libgmt.dylib `` or `` gmt.dll ``
136
- can be found for Linux, macOS and Windows respectively.
137
- e.g. in a terminal run::
201
+ This should be set to the directory where ``libgmt.so ``, ``libgmt.dylib `` or
202
+ `` gmt.dll `` can be found for Linux, macOS and Windows respectively.
203
+ e.g. on a command line, run::
138
204
139
205
# Linux/macOS
140
206
export GMT_LIBRARY_PATH=$HOME/anaconda3/envs/pygmt/lib
0 commit comments