Skip to content

Commit 32ec12a

Browse files
authored
Update Installing_Python_and_Python_Packages.rst
1 parent 5d8535f commit 32ec12a

1 file changed

Lines changed: 134 additions & 64 deletions

File tree

doc/Installing_Python_and_Python_Packages.rst

Lines changed: 134 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Our Python tutorial is compatible with Python 3. It relies on several packages
99
Why Python?
1010
-----------
1111

12-
`Python <https://www.python.org/>`_ is an easy to learn, open source programming language. In addition to the standard language library, there are thousands of free third-party modules (code libraries) available on the `Python Package Index <https://pypi.org/>`_ (PyPI). Unlike commerical numerical computing environments like Matlab and IDL, Python is free for everyone to use. In addition, Python code can be run on just any platform whether Windows, Linux, or OS X.
12+
`Python <https://www.python.org/>`_ is an easy to learn open source programming language. In addition to the standard language library, there are thousands of free third-party modules (code libraries) available on code repositories such as `Python Package Index <https://pypi.org/>`_ (PyPI), `_Conda <https://anaconda.org/anaconda/repo>`_ and `Conda Forge <https://conda-forge.org/feedstock-outputs/>`_. Unlike commerical numerical computing environments like Matlab and IDL, Python is free for everyone to use. In addition, Python code can be run on multiple platforms such as Windows, Linux, and OS X.
1313

1414
Here are some links to help you learn more about Python.
1515

@@ -22,19 +22,14 @@ Here are some links to help you learn more about Python.
2222

2323
.. _in-Installing:
2424

25-
Installing Python and the Anaconda Distribution
25+
Installing Python
2626
-----------------------------------------------
2727

28-
Python
29-
^^^^^^
30-
The latest installers for Python for many platforms can be found on the `Python website <https://www.python.org/downloads/release/python-2714/>`_.
31-
28+
There are several ways of installing Python on your machine. You can install compiled binaries directly from the `Python website <https://www.python.org/downloads/release/python-2714/>`_, or one can install via a package manager such as Anaconda or Miniconda. I personally find the Anaconda or Miniconda route to be simplest.
3229

3330
Anaconda
3431
^^^^^^^^
35-
Python code can be written in any text editor and run from the command line. Third-party modules can be manually installed from the command line using the `pip`_ package manager.
36-
37-
Python code can also be written and executed in an interactive environment (integrated development environment, IDE) similar to the Matlab console. For scientific computing, the `Anaconda`_ Python distribution is quite convenient because it comes with a `large collection`_ of useful modules, a good open source IDE, `Spyder`_., and the ability to open and execute `Jupyter Notebooks`_
32+
For scientific computing, the `Anaconda`_ Python distribution is quite convenient because it comes with a `large collection`_ of useful modules, a good open source IDE, `Spyder`_., and the ability to open and execute `Jupyter Notebooks`_
3833

3934
The latest installers for the Anaconda Distribution can be found on the `Anaconda website`_
4035

@@ -49,57 +44,12 @@ The latest installers for the Anaconda Distribution can be found on the `Anacond
4944

5045
.. _in-libraries:
5146

52-
Installing Required Python Packages
53-
-----------------------------------
54-
55-
After installing Anaconda the following packages must be installed:
56-
*netcdf4*, *cartopy*, *pyresample*, *xarray*, *xmitgcm*, *xgcm*
57-
58-
59-
Below are two **options** or installing these packages. PICK ONE!
60-
61-
62-
Option 1: *Conda*
63-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
64-
.. attention::
65-
Conda is recommended because it automatically installs the GEOS (Geometry Engine, Open Source) library which is needed to make projection plots.
66-
67-
68-
.. code-block:: bash
69-
70-
conda install geos
71-
conda install -c conda-forge cmocean
72-
conda install -c conda-forge pyresample
73-
conda install -c conda-forge xarray dask netCDF4 bottleneck
74-
conda install -c conda-forge xmitgcm
75-
conda install -c conda-forge xgcm
76-
conda install -c conda-forge cartopy pyepsg
77-
78-
79-
Option 2: *pip* alone (not recommended)
80-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
81-
82-
.. DANGER::
83-
The Python module Cartopy requires the GEOS (Geometry Engine, Open Source) library. Instructions for installing this library can be found on the `geos website`_. Some users have reported difficulties installing GEOS libraries on their platforms. For that reason, we recommend using Conda (Option 1).
84-
85-
86-
.. code-block:: bash
87-
88-
pip install netcdf4
89-
pip install pyresample
90-
pip install cartopy
91-
pip install xarray
92-
[SEE NOTE!] pip install xmitgcm
93-
pip install xgcm
94-
pip install cmocean
9547

9648

97-
98-
9949
Downloading the *ecco_v4_py* Python Package
10050
-------------------------------------------
10151

102-
The *ecco_v4_py* package is a library of routines that are helpful for analyzing the ECCO v4 state estimate. It is stored on the `github repository`_
52+
The *ecco_v4_py* package is a library of routines that are helpful for analyzing the ECCO the Version 4 state estimate. The latest version can always be found on our `github repository`_
10353

10454

10555
Below are three **options** or installing the *ecco_v4_py* Python package.
@@ -129,7 +79,7 @@ To use `git` to clone into the project simply run the following commands
12979
13080
Option 2: Download the repository using git (not recommended)
13181
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
132-
This method gets you the source code but if you make changes it is harder to share those changes with the community.
82+
This method gets you the source code but if you make changes it is harder to share those changes with the community. Use this method if you don't have access to git.
13383

13484
.. code-block:: bash
13585
@@ -139,21 +89,141 @@ This method gets you the source code but if you make changes it is harder to sha
13989
> unzip master.zip
14090
> rm master.zip
14191
142-
Of course you may want to use this method if you don't have access to git.
14392
144-
Option 3: Use the *pip* Python package tool (not recommended)
145-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146-
If you use *pip* to install the *ecco_v4_py* package the source code will be installed in your Python library directory from https://pypi.org/project/ecco-v4-py/. This method is OK if you don't plan to look at or modify the library code.
93+
94+
Option 3: Use the *pip* Python package tool (not at all recommended)
95+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
96+
If you use *pip* to install the *ecco_v4_py* package the source code will be installed in your Python library directory from https://pypi.org/project/ecco-v4-py/. This method is OK if you don't plan to look at or modify the library code, but what fun would that be? Also, YMMV with respect to installing dependencies.
14797

14898
.. code-block:: bash
14999
150100
pip install ecco_v4_py
101+
102+
103+
151104
105+
Installing Required Python Packages
106+
-----------------------------------
152107

153-
Using the *ecco_v4_py* Python Package in your programs
154-
------------------------------------------------------
108+
The following additional packages must be installed
109+
110+
.. code-block:: bash
155111
156-
If you use Options 1 or 2 to download the *ecco_v4_py* source code then you must tell Python the location of the files before Python can it. This is easy, you just you just have to remember to do it at the top of all of your programs!
112+
- aiohttp
113+
- codecov
114+
- cartopy>=0.18.0
115+
- cmocean
116+
- dask
117+
- docrep
118+
- fsspec
119+
- future
120+
- geos
121+
- matplotlib
122+
- netcdf4
123+
- numpy
124+
- pathlib
125+
- proj
126+
- pytest
127+
- python=3.8
128+
- pytest-cov
129+
- pyresample
130+
- scipy
131+
- xarray
132+
- xgcm>=0.5.0
133+
- xmitgcm>=0.5.1
134+
135+
Below are several **options** or installing these packages. PICK ONE!
136+
137+
138+
Option 1: *Conda*
139+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
140+
.. attention::
141+
Conda is recommended because it automatically installs the GEOS (Geometry Engine, Open Source) library which is needed to make projection plots.
142+
143+
To simply install all required dependencies using conda, create a new conda environment using the ECCOv4-py environment YAML.
144+
145+
146+
.. code-block:: bash
147+
148+
cd your_ECCOv4_py_directory/
149+
conda env create --name ECCOv4_py --file ci/environment-py38.yml
150+
151+
To activate the conda environment with the required dependencies call:
152+
153+
.. code-block:: bash
154+
155+
conda activate ECCOv4_py
156+
157+
158+
Alternatively, one can install the dependencies one at a time into an existing conda environment:
159+
160+
.. code-block:: bash
161+
162+
conda activate yourExistingCondaEnvironment
163+
164+
conda install -c conda-forge aiohttp
165+
conda install -c conda-forge codecov
166+
conda install -c conda-forge cartopy
167+
conda install -c conda-forge cmocean
168+
conda install -c conda-forge dask
169+
conda install -c conda-forge docrep
170+
conda install -c conda-forge fsspec
171+
conda install -c conda-forge future
172+
conda install -c conda-forge geos
173+
conda install -c conda-forge matplotlib
174+
conda install -c conda-forge netcdf4
175+
conda install -c conda-forge numpy
176+
conda install -c conda-forge pathlib
177+
conda install -c conda-forge proj
178+
conda install -c conda-forge pytest
179+
conda install -c conda-forge pytest-cov
180+
conda install -c conda-forge pyresample
181+
conda install -c conda-forge scipy
182+
conda install -c conda-forge xarray
183+
conda install -c conda-forge xgcm
184+
conda install -c conda-forge xmitgcm
185+
186+
187+
Option 2: *pip* alone (not recommended)
188+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
189+
190+
.. DANGER::
191+
The Python module Cartopy requires the GEOS (Geometry Engine, Open Source) library. Instructions for installing this library can be found on the `geos website`_. Some users have reported difficulties installing GEOS libraries on their platforms. For that reason, we recommend using Conda (Option 1).
192+
193+
To install geos, following instructions here:
194+
https://pygeos.readthedocs.io/en/latest/installation.html
195+
196+
197+
.. code-block:: bash
198+
199+
pip install geos
200+
pip install aiohttp
201+
pip install codecov
202+
pip install cmocean
203+
pip install dask
204+
pip install docrep
205+
pip install fsspec
206+
pip install future
207+
pip install matplotlib
208+
pip install netcdf4
209+
pip install numpy
210+
pip install pathlib
211+
pip install pytest
212+
pip install pytest-cov
213+
pip install pyresample
214+
pip install scipy
215+
pip install xarray
216+
pip install xgcm
217+
pip install xmitgcm
218+
pip install proj
219+
pip install cartopy
220+
221+
222+
223+
224+
225+
Using the *ecco_v4_py* in your programs
226+
------------------------------------------------------
157227

158228
Assuming you downloaded the *ecco_v4_py* routines to ``/home/username/ECCOv4-py`` then simply add these three lines to the top of your Python programs (or Jupyter Notebooks)
159229

@@ -164,7 +234,7 @@ Assuming you downloaded the *ecco_v4_py* routines to ``/home/username/ECCOv4-py`
164234
import ecco_v4_py as ecco
165235
166236
167-
If you used Method 3 (pip install) then the *ecco_v4_py* library will be automatically installed and will be ready to import into your Python program via the following commands:
237+
If you you installed the package using pip then the *ecco_v4_py* library will be automatically installed and will be ready to import into your Python program via the following commands:
168238

169239
.. code-block:: python
170240

0 commit comments

Comments
 (0)