Skip to content

Commit

Permalink
Fix build due to numpy (#1430)
Browse files Browse the repository at this point in the history
numpy 2.0 and greater is causing issues with handful of packages
  • Loading branch information
calderjo authored Oct 2, 2024
1 parent d6f04b1 commit 4e22769
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
10 changes: 7 additions & 3 deletions Dockerfile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ ADD patches/keras_internal.py \
# b/350573866: xgboost v2.1.0 breaks learntools
RUN apt-get install -y libfreetype6-dev && \
apt-get install -y libglib2.0-0 libxext6 libsm6 libxrender1 libfontconfig1 --fix-missing && \
rm -rf /opt/conda/lib/python3.10/site-packages/numpy* && \
pip install "numpy==1.26.4" && \
pip install gensim \
textblob \
wordcloud \
Expand Down Expand Up @@ -425,8 +427,7 @@ RUN pip install bleach \
webencodings \
widgetsnbextension \
# Require pyarrow newer than https://github.com/advisories/GHSA-5wvp-7f3h-6wmm
{{ if eq .Accelerator "gpu" }} pyarrow {{ else }} "pyarrow>=14.0.1" {{ end }} \
fastai
{{ if eq .Accelerator "gpu" }} pyarrow {{ else }} "pyarrow>=14.0.1" {{ end }}

RUN python -m spacy download en_core_web_sm && python -m spacy download en_core_web_lg && \
apt-get update && apt-get install -y ffmpeg && \
Expand Down Expand Up @@ -470,7 +471,8 @@ RUN pip install wandb \
Rtree \
accelerate && \
apt-get -y install libspatialindex-dev && \
rm -rf /opt/conda/lib/python3.10/site-packages/numpy* && \
# b/370860329: newer versions are not capable with current tensorflow
rm -rf /opt/conda/lib/python3.10/site-packages/numpy* && \
pip install "numpy==1.26.4" && \
pip install pytorch-ignite \
qgrid \
Expand Down Expand Up @@ -501,6 +503,8 @@ RUN pip install wandb \
timm \
torchinfo && \
pip install git+https://github.com/facebookresearch/segment-anything.git && \
# b/370860329: newer versions are not capable with current tensorflow
pip install --no-dependencies fastai fastdownload && \
# b/343971718: remove duplicate aiohttp installs, and reinstall it
rm -rf /opt/conda/lib/python3.10/site-packages/aiohttp* && \
mamba install --force-reinstall -y aiohttp && \
Expand Down
7 changes: 7 additions & 0 deletions tests/test_fastai.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
from fastai.tabular.all import *

class TestFastAI(unittest.TestCase):
# Basic import
def test_basic(self):
import fastai
import fastcore
import fastprogress
import fastdownload

def test_has_version(self):
self.assertGreater(len(fastai.__version__), 2)

Expand Down
8 changes: 7 additions & 1 deletion tests/test_numpy.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import unittest

from distutils.version import StrictVersion

import numpy as np
from numpy.distutils.system_info import get_info

class TestNumpy(unittest.TestCase):
class TestNumpy(unittest.TestCase):
def test_version(self):
# b/370860329: newer versions are not capable with current tensorflow
self.assertEqual(StrictVersion(np.__version__), StrictVersion("1.26.4"))

def test_array(self):
array = np.array([1, 3])

Expand Down

0 comments on commit 4e22769

Please sign in to comment.