Skip to content

Commit 650e61b

Browse files
authoredDec 31, 2022
Update the instructions to run on Google Colab (#45)
1 parent d96f5a7 commit 650e61b

File tree

2 files changed

+30
-18
lines changed

2 files changed

+30
-18
lines changed
 

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Run it online by clicking on one of the badges below:
1313
- [![Binder](https://mybinder.org/badge_logo.svg)](https://ovh.mybinder.org/v2/gh/GenericMappingTools/try-gmt/master?urlpath=lab/tree/landing-page.ipynb) hosted at https://ovh.mybinder.org/
1414
- [![Binder](https://mybinder.org/badge_logo.svg)](https://gesis.mybinder.org/v2/gh/GenericMappingTools/try-gmt/master?urlpath=lab/tree/landing-page.ipynb) hosted at https://gesis.mybinder.org/
1515
- [![Binder](https://mybinder.org/badge_logo.svg)](https://turing.mybinder.org/v2/gh/GenericMappingTools/try-gmt/master?urlpath=lab/tree/landing-page.ipynb) hosted at https://turing.mybinder.org/
16-
- [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GenericMappingTools/try-gmt/blob/master/landing-page.ipynb) hosted by [Google Colab](https://colab.research.google.com/) (Currently broken, see https://github.com/GenericMappingTools/try-gmt/issues/17. Need to log in to your Google account).
16+
- [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GenericMappingTools/try-gmt/blob/master/landing-page.ipynb) hosted by [Google Colab](https://colab.research.google.com/) (Need to log in to your Google account).
1717

1818
## Installed packages
1919

‎python-demo.ipynb

+29-17
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,17 @@
3232
},
3333
{
3434
"cell_type": "markdown",
35-
"metadata": {},
35+
"metadata": {
36+
"tags": []
37+
},
3638
"source": [
37-
"## Note for Google Colab users\n",
39+
"## Google Colab users: Follow these instructions before your start!\n",
40+
"\n",
41+
"**Google Colab** doesn't have PyGMT and its dependencies installed. You need to follow the instructions below to install them.\n",
3842
"\n",
39-
"Google Colab doesn't have PyGMT and its dependencies installed. You need to run the following commands to install them once.\n",
43+
"First, we need to install conda on Google Colab. The installation process is greatly simplified using the [condacolab](https://github.com/conda-incubator/condacolab) package.\n",
4044
"\n",
41-
"Be patient! The installation may take a few minutes."
45+
"*After condacolab finishes the installation, it will restart the Python kernel for changes to be applied. This happens automatically. Thus, you will see a message saying \"Your session crashed for an unknown reason\". You can safely ignore this message!*"
4246
]
4347
},
4448
{
@@ -47,17 +51,25 @@
4751
"metadata": {},
4852
"outputs": [],
4953
"source": [
50-
"!wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh\n",
51-
"!chmod +x Miniconda3-latest-Linux-x86_64.sh\n",
52-
"!bash ./Miniconda3-latest-Linux-x86_64.sh -bfp /usr/local\n",
53-
"!conda update conda -y -q\n",
54-
"!conda config --prepend channels conda-forge\n",
55-
"!conda install -q -y --prefix /usr/local python=3.7 pygmt\n",
56-
"\n",
57-
"import sys\n",
58-
"import os\n",
59-
"sys.path.append('/usr/local/lib/python3.7/site-packages')\n",
60-
"os.environ[\"GMT_LIBRARY_PATH\"]=\"/usr/local/lib\""
54+
"!pip install -q condacolab\n",
55+
"import condacolab\n",
56+
"condacolab.install()"
57+
]
58+
},
59+
{
60+
"cell_type": "markdown",
61+
"metadata": {},
62+
"source": [
63+
"Now we can install PyGMT and its dependencies using a single command. The installation may take a few minutes:"
64+
]
65+
},
66+
{
67+
"cell_type": "code",
68+
"execution_count": null,
69+
"metadata": {},
70+
"outputs": [],
71+
"source": [
72+
"!mamba install pygmt"
6173
]
6274
},
6375
{
@@ -231,7 +243,7 @@
231243
],
232244
"metadata": {
233245
"kernelspec": {
234-
"display_name": "Python 3",
246+
"display_name": "Python 3 (ipykernel)",
235247
"language": "python",
236248
"name": "python3"
237249
},
@@ -245,7 +257,7 @@
245257
"name": "python",
246258
"nbconvert_exporter": "python",
247259
"pygments_lexer": "ipython3",
248-
"version": "3.8.5"
260+
"version": "3.9.15"
249261
}
250262
},
251263
"nbformat": 4,

0 commit comments

Comments
 (0)