Skip to content

Commit

Permalink
docker: set ESMFMKFILE env var for import xesmf since esmf-8.4.0
Browse files Browse the repository at this point in the history
See conda-forge/esmf-feedstock#91

Fix the following error:
```
  import xesmf as xe
  from xclim.subset import subset_bbox  # For subsetting
  from xclim.testing import open_dataset  # For opening xclim's
a

  #  A colormap with grey where the data is missing
  cmap = copy.copy(plt.cm.get_cmap("viridis"))
  cmap.set_bad("lightgray")

  Traceback:

-------------------------------------------------------------------
  KeyError                                  Traceback (most
all last)
  File
da/envs/birdy/lib/python3.8/site-packages/esmpy/interface/loadESMF.py:26
       25 try:
  ---> 26     esmfmk = os.environ["ESMFMKFILE"]
       27 except:

  File /opt/conda/envs/birdy/lib/python3.8/os.py:675, in
.__getitem__(self, key)
      673 except KeyError:
      674     # raise KeyError with the original key value
  --> 675     raise KeyError(key) from None
      676 return self.decodevalue(value)

  KeyError: 'ESMFMKFILE'
```
  • Loading branch information
tlvu committed Feb 21, 2023
1 parent 126df72 commit 88ad07d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ RUN wget https://raw.githubusercontent.com/jupyter/docker-stacks/$DOCKER_STACKS_
# For jupyter-panel-proxy launcher.
ENV BOKEH_ALLOW_WS_ORIGIN "*"

# For import xesmf since esmf-8.4.0, see
# https://github.com/conda-forge/esmf-feedstock/issues/91
ENV ESMFMKFILE="/opt/conda/envs/birdy/lib/esmf.mk"

# problem running start-notebook.sh when being root
# the jupyter/base-notebook image also do not default to root user so we do the same here
USER jenkins
Expand Down
12 changes: 7 additions & 5 deletions docker/Dockerfile.testing
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# For testing quickly without having to do a full rebuild.

FROM pavics/workflow-tests:220728
FROM pavics/workflow-tests:230217

USER root
ENV ESMFMKFILE="/opt/conda/envs/birdy/lib/esmf.mk"

#USER root

# Use 'update' for existing and 'install' for new package.
# Keep same channel ordering to not revert anything.
RUN umask 0000 \
&& mamba install -c conda-forge -c cdat -c bokeh -c plotly -c pyston -c pyviz/label/dev -c defaults -n birdy geopy
#RUN umask 0000 \
# && mamba install -c conda-forge -c cdat -c bokeh -c plotly -c pyston -c pyviz/label/dev -c defaults -n birdy geopy
# && pip uninstall -y ravenpy \
# && mamba install -c conda-forge -c cdat -c bokeh -c plotly -c defaults -n birdy ravenpy aiohttp

Expand All @@ -20,4 +22,4 @@ RUN umask 0000 \
#RUN umask 0000 \
# && pip install https://github.com/CSHS-CWRA/RavenPy/archive/refs/heads/master.zip

USER jenkins
#USER jenkins

0 comments on commit 88ad07d

Please sign in to comment.