Recompile scipy and sklearn to prevent numpy importerror

This commit is contained in:
Stefan Verhoeven 2020-02-23 17:43:39 +01:00
parent ff22cb2a22
commit 18d68ae22e
3 changed files with 10 additions and 2 deletions

View File

@ -66,6 +66,7 @@ RUN useradd -m -d /home/cartodb -s /bin/bash cartodb && \
postgresql-12-plproxy \
postgresql-12-postgis-3 \
postgresql-12-postgis-3-scripts \
postgresql-12-mysql-fdw \
postgis \
liblwgeom-2.4-0 \
ca-certificates \
@ -115,6 +116,7 @@ RUN useradd -m -d /home/cartodb -s /bin/bash cartodb && \
liblapack-dev \
gfortran \
--no-install-recommends && \
apt-get upgrade -y -q && \
rm -rf /var/lib/apt/lists/*
RUN git config --global user.email you@example.com
@ -166,8 +168,9 @@ RUN cd / && \
pip3 install --no-cache-dir scipy && \
make install && \
# Numpy gets upgraded after scikit-learn is installed
# `import sklearn` fails with `RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa` and `ImportError: numpy.core.multiarray failed to import`
# make sure scikit-learn is compatible with currently installed numpy, by reinstalling
pip3 install --force-reinstall --no-cache-dir scikit-learn==0.17.0 && \
pip3 install --force-reinstall --no-cache-dir scipy==0.17.0 scikit-learn==0.17.0 && \
cd ..
# Initialize template postgis db
@ -196,7 +199,7 @@ RUN git clone --recursive git://github.com/CartoDB/cartodb.git && \
git checkout $CARTODB_VERSION && \
# Install cartodb extension
cd lib/sql && \
PGUSER=postgres make install && \
PGUSER=postgres make all install && \
service postgresql start && /bin/su postgres -c \
/tmp/cartodb_pgsql.sh && service postgresql stop && \
cd - && \

View File

@ -36,3 +36,6 @@ bundle exec rake cartodb:db:configure_geocoder_extension_for_non_org_users[$SUB
# Enable sync tables
echo "UPDATE users SET sync_tables_enabled=true WHERE username='${SUBDOMAIN}'" | psql -U postgres -t carto_db_development
# Set import limit to 200Mb and 4M rows
bundle exec rake cartodb:set_custom_limits_for_user[$SUBDOMAIN,209715200,4000000,5]

View File

@ -8,6 +8,8 @@ bundle exec rake cartodb:db:set_unlimited_table_quota["${USERNAME}"]
bundle exec rake cartodb:db:create_new_organization_with_owner ORGANIZATION_NAME="${ORGANIZATION_NAME}" USERNAME="${USERNAME}" ORGANIZATION_SEATS=100 ORGANIZATION_QUOTA=102400 ORGANIZATION_DISPLAY_NAME="${ORGANIZATION_NAME}"
bundle exec rake cartodb:db:set_organization_quota[$ORGANIZATION_NAME,5000]
bundle exec rake cartodb:db:configure_geocoder_extension_for_organizations[$ORGANIZATION_NAME]
# Set import limit to 200Mb and 4M rows
bundle exec rake cartodb:set_custom_limits_for_user[$ORGANIZATION_NAME,209715200,4000000,5]
# Enable sync tables
echo "UPDATE users SET sync_tables_enabled=true WHERE username='${USERNAME}'" | psql -U postgres -t carto_db_development