You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The trouble with this is that it can lead to problems in the future. The `analysis3` module
47
+
This is sufficient in certain cases, for instance, quickly testing user code, or when long-term
48
+
reproducibility is not necessary. The downside with this approach is that it can lead to problems in the future. First of all, everything will be installed in your `/home` directory, which has a small quota and can easily be filled by local `pip` installations. Another consideration is that the `analysis3` module
48
49
is updated to every 3 months as new environments are released. For example, if you load `conda/analysis3` today,
49
50
you'll get the `conda/analysis3-24.01` environment. If you were to load the same module a couple of months from
50
51
now, you'll get the `conda/analysis3-24.04` environment. Our policies around updating the conda environments
51
52
can be found [here](https://climate-cms.org/cms-wiki/services/services-conda.html). As time goes on, your
52
53
locally installed package will get further and further out of date, and could potentially conflict with newer
53
-
packages installed in updated analysis environments.
54
+
packages installed in updated analysis environments.
54
55
55
-
This is one of the most common issues we see come into our helpdesk. A user will open a JupyterLab session in ARE
56
-
and an important package like `dask` or `xarray` will fail to import due to a conflict in the user's local
57
-
environment. In fact, in our advice to users, we recommend the following Advanced Settings for ARE environments:
56
+
In our advice to users, we recommend the following Advanced Settings for ARE environments:
Note the `PYTHONNOUSERSITE=1` environment variable. This will have the effect of preventing anything installed with `pip install --user` from loading at all.
60
+
Note the `PYTHONNOUSERSITE=1` environment variable. This will have the effect of preventing anything installed with `pip install --user` from loading at all. This setting also works in the terminal and can be used as a first step to diagnosing any issues with python package imports.
62
61
63
62
## Virtual environments
64
-
Instead, we recommend creating a [virtual environment](https://docs.python.org/3/library/venv.html). A virtual environment is a self-contained Python
63
+
What we recommend is creating a [virtual environment](https://docs.python.org/3/library/venv.html). A virtual environment is a self-contained Python
65
64
environment built on top of an existing Python installation. The self-contained
66
65
nature of a virtual environment means that any issues due to conflicting
67
66
dependencies can be avoided entirely. Being able to base the environment on top of
@@ -96,12 +95,21 @@ at the time of its creation, so it avoids the out-of-date dependencies issue men
change the path in the [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) line to the path to the `python` symlink in the virtual environment:
105
113
```
106
114
#!/home/563/dr4292/xwmb_venv/bin/python3
107
115
@@ -170,9 +178,7 @@ While CMS tries to make the `hh5` conda analysis environments as comprehensive a
170
178
always install the packages you need. By creating a virtual environment using the `conda/analysis3`
171
179
environment as your base,
172
180
its possible to add in packages CMS can't install, without having the overhead of maintaining
173
-
your own large conda environment. Furthermore, using a virtual environment avoids the
174
-
headaches associated with installing software using `pip install --user` as anything
175
-
installed will be pinned to a specific conda environment. Virtual environments are simple to
181
+
your own large conda environment. Furthermore, using a virtual environment is more stable and easier to maintain and reuse than installing software using `pip install --user`. Virtual environments are simple to
176
182
install, and simple to delete and re-create as necessary. Virtual environments can also be seamlessly integrated into
177
183
ARE JupyterLab sessions, allowing you to use it anywhere you would use an `analysis3` conda environment.
0 commit comments