Skip to content

Commit 20b279b

Browse files
committed
Fix Kagglehub test and Remove multiple version matplotlib files (#1441)
fixing main build. - kagglehub login changes required updating our tests - latest matplotlib is needed by handful of package, but breaks learntools. i provided a workaround
1 parent 79a39aa commit 20b279b

File tree

2 files changed

+27
-22
lines changed

2 files changed

+27
-22
lines changed

Dockerfile.tmpl

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -167,28 +167,12 @@ RUN pip install jax[cpu] && \
167167
RUN export PATH=/usr/local/cuda/bin:$PATH && \
168168
export CUDA_ROOT=/usr/local/cuda && \
169169
pip install pycuda \
170-
pynvrtc \
170+
# TODO(379932879): pip resolver fails when not specified.
171+
pynvrtc==9.2 \
171172
pynvml && \
172173
/tmp/clean-layer.sh
173174
{{ end }}
174175

175-
# b/308525631: Pin Matplotlib until seaborn can be upgraded
176-
# to >0.13.0 (now it's stuck by a package conflict with ydata-profiling 4.5.1).
177-
RUN JAXVER=$(pip freeze | grep -e "^jax==") && \
178-
pip install --upgrade \
179-
"matplotlib<3.8.0" \
180-
# ipympl adds interactive widget support for matplotlib
181-
ipympl==0.7.0 \
182-
"seaborn==0.12.2" \
183-
pyupset \
184-
python-dateutil dask dask-expr igraph \
185-
pyyaml joblib geopy mne pyshp \
186-
pandas \
187-
polars \
188-
flax \
189-
"${JAXVER}" && \
190-
/tmp/clean-layer.sh
191-
192176
RUN apt-get update && \
193177
apt-get install -y default-jre && \
194178
/tmp/clean-layer.sh
@@ -542,11 +526,30 @@ ENV TESSERACT_PATH=/usr/bin/tesseract \
542526
# For Theano with MKL
543527
MKL_THREADING_LAYER=GNU
544528

529+
# b/308525631: Pin Matplotlib until seaborn can be upgraded
530+
# to >0.13.0 (now it's stuck by a package conflict with ydata-profiling 4.5.1).
531+
RUN JAXVER=$(pip freeze | grep -e "^jax==") && \
532+
pip install --upgrade \
533+
"matplotlib==3.7.5" \
534+
# ipympl adds interactive widget support for matplotlib
535+
ipympl==0.7.0 \
536+
"seaborn==0.12.2" \
537+
pyupset \
538+
python-dateutil dask dask-expr igraph \
539+
pyyaml joblib geopy mne pyshp \
540+
pandas \
541+
polars \
542+
flax \
543+
"${JAXVER}" && \
544+
/tmp/clean-layer.sh
545+
545546
# Temporary fixes and patches
546547
# Temporary patch for Dask getting downgraded, which breaks Keras
547548
RUN pip install --upgrade dask && \
548549
# Stop jupyter nbconvert trying to rewrite its folder hierarchy
549550
mkdir -p /root/.jupyter && touch /root/.jupyter/jupyter_nbconvert_config.py && touch /root/.jupyter/migrated && \
551+
# TODO(b/380921973): Ensure only matplotlib 3.7.5 files are present.
552+
rm -r /opt/conda/lib/python3.10/site-packages/matplotlib-3.9.2.dist-info/ && \
550553
mkdir -p /.jupyter && touch /.jupyter/jupyter_nbconvert_config.py && touch /.jupyter/migrated && \
551554
# Stop Matplotlib printing junk to the console on first load
552555
sed -i "s/^.*Matplotlib is building the font cache using fc-list.*$/# Warning removed by Kaggle/g" /opt/conda/lib/python3.10/site-packages/matplotlib/font_manager.py && \

tests/test_kagglehub.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ class TestKagglehub(unittest.TestCase):
88
def test_login(self):
99
with self.assertLogs('kagglehub', level='INFO') as l:
1010
with mock.patch("builtins.input") as mock_input:
11-
mock_input.side_effect = ["lastplacelarry", "some-key"]
12-
# Disabling credentials validation since network access is disabled in unittest.
13-
kagglehub.login(validate_credentials=False)
11+
with mock.patch("getpass.getpass") as mock_getpass:
12+
mock_input.side_effect = ["lastplacelarry"]
13+
mock_getpass.return_value = "some-key"
1414

15-
self.assertIn("credentials set", l.output[0])
15+
kagglehub.login(validate_credentials=False)
16+
17+
self.assertIn("credentials set", l.output[0])

0 commit comments

Comments
 (0)