From 18d68ae22e27186ff84a36be8869ad5dcd89ef0c Mon Sep 17 00:00:00 2001 From: Stefan Verhoeven Date: Sun, 23 Feb 2020 17:43:39 +0100 Subject: [PATCH] Recompile scipy and sklearn to prevent numpy importerror --- Dockerfile | 7 +++++-- create_dev_user | 3 +++ setup_organization.sh | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index fa63fc1..ecee846 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 - && \ diff --git a/create_dev_user b/create_dev_user index 411a56d..04d656a 100755 --- a/create_dev_user +++ b/create_dev_user @@ -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] diff --git a/setup_organization.sh b/setup_organization.sh index 849b12b..8d1b30d 100644 --- a/setup_organization.sh +++ b/setup_organization.sh @@ -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