diff --git a/gitlab/functions.sh b/gitlab/functions.sh
index bfeb4e860d6d91ddda03de92238fbcca4f6bf08c..33b634fb7d0392440c5d2d8529b4167fdc1166b7 100644
--- a/gitlab/functions.sh
+++ b/gitlab/functions.sh
@@ -440,3 +440,8 @@ LANG="en_US.UTF-8"
 LC_ALL="${LANG}"
 export_env LANG
 export_env LC_ALL
+
+# Set up the location of matplotlibrc:
+# https://matplotlib.org/users/customizing.html#the-matplotlibrc-file
+MATPLOTLIBRC="_ci"
+export_env MATPLOTLIBRC
diff --git a/gitlab/install.sh b/gitlab/install.sh
index 78d4808614091c4da649c03c1d84f863980e2577..cbf16a77d146aa8084ddc179199858dbe772d678 100755
--- a/gitlab/install.sh
+++ b/gitlab/install.sh
@@ -61,6 +61,7 @@ get_script ${1} cacert.pem
 get_script ${1} functions.sh
 get_script ${1} conda_build_config.yaml
 get_script ${1} recipe_append.yaml
+get_script ${1} matplotlibrc
 get_exec ${1} before_build.sh
 for stage in "build" "deploy" "pypi"; do
   get_exec ${1} ${stage}.sh
diff --git a/gitlab/matplotlibrc b/gitlab/matplotlibrc
new file mode 100644
index 0000000000000000000000000000000000000000..ed5097572ae68680d0c9afdf510968e1c3d175d4
--- /dev/null
+++ b/gitlab/matplotlibrc
@@ -0,0 +1 @@
+backend      : agg