openfaas / openfaas.github.io

Primary website / landing-page for the project
https://www.openfaas.com
MIT License
57 stars 45 forks source link

Problem with dependencies (pydatascience template) #226

Closed IsmaelGSerrano closed 3 years ago

IsmaelGSerrano commented 3 years ago

What would you like to let us know?

I have a problem with dependencies.

function folder:

hello-python
├── handler.py
├── __init__.py
├── requirements.txt

This is my configuration file:

version: 1.0
provider:
  name: openfaas
  gateway: **********************************:8080
functions:
  hello-python:
    lang: pydatascience
    handler: ./hello-python
    image: ******/hello-python:latest

handler.py:

import numpy as np

def handle(req):
    """handle a request to the function
    Args:
        req (str): request body
    """

    return "Hi, you said: {}. Random number = {}".format(str(req),
                                                         np.random.random_sample(10))

requirements.txt:

numpy==1.12.1 

This is the build output:

Sending build context to Docker daemon  29.18kB
Step 1/32 : ARG watchdog_version=0.7.7
Step 2/32 : FROM openfaas/of-watchdog:${watchdog_version} as watchdog
 ---> d0f9fd4de119
Step 3/32 : FROM python:3-slim
 ---> e7d894e42148
Step 4/32 : COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
 ---> Using cache
 ---> d3e6f7dfcc50
Step 5/32 : RUN chmod +x /usr/bin/fwatchdog
 ---> Using cache
 ---> 27acb15b3107
Step 6/32 : ARG ADDITIONAL_PACKAGE
 ---> Using cache
 ---> b6618e8f77e3
Step 7/32 : ARG CHANNEL=conda-forge
 ---> Using cache
 ---> 2856a23d64e5
Step 8/32 : RUN addgroup app && adduser app --system --ingroup app     && mkdir -p /opt/conda && chown -R app /opt/conda     && chown -R app /root && chmod -R go+rX /root
 ---> Using cache
 ---> 58bb93776ac5
Step 9/32 : ENV HOME /home/app
 ---> Using cache
 ---> 219a008180d2
Step 10/32 : ENV PATH=$HOME/conda/bin:$PATH
 ---> Using cache
 ---> 2e6517b80eef
Step 11/32 : RUN apt-get update     && apt-get -y install curl bzip2 ${ADDITIONAL_PACKAGE}     && curl -sSL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /tmp/miniconda.sh     && chown app /tmp/miniconda.sh     && apt-get -qq -y remove curl     && apt-get -qq -y autoremove     && apt-get autoclean     && rm -rf /var/lib/apt/lists/* /var/log/dpkg.log
 ---> Using cache
 ---> ebcdf42d6fb0
Step 12/32 : WORKDIR /home/app/
 ---> Using cache
 ---> 6ea72bdd4378
Step 13/32 : USER app
 ---> Using cache
 ---> eb0793ac9453
Step 14/32 : RUN bash /tmp/miniconda.sh -bfp $HOME/conda     && conda install -y python=3     && conda update conda     && conda clean --all --yes     && rm -rf /tmp/miniconda.sh
 ---> Using cache
 ---> 01ded33f6751
Step 15/32 : RUN conda install -c ${CHANNEL} flask-basicauth
 ---> Using cache
 ---> 7df7c5178748
Step 16/32 : COPY requirements.txt   .
 ---> Using cache
 ---> 15b3c4e4f502
Step 17/32 : RUN conda install --file requirements.txt -c ${CHANNEL}
 ---> Using cache
 ---> 3b7bd90b3151
Step 18/32 : COPY index.py           .
 ---> Using cache
 ---> 673572dd6162
Step 19/32 : RUN mkdir -p function
 ---> Using cache
 ---> a7045f57e050
Step 20/32 : RUN touch ./function/__init__.py
 ---> Using cache
 ---> 79ec4a25d0a4
Step 21/32 : WORKDIR /home/app/function/
 ---> Using cache
 ---> c09c94fcc804
Step 22/32 : COPY function/requirements.txt .
 ---> 2a8a80f71f19
Step 23/32 : RUN conda install --file requirements.txt -c ${CHANNEL}
 ---> Running in 2449155a7526
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve.
Solving environment: ...working... failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve.
Solving environment: ...working... done

## Package Plan ##

  environment location: /home/app/conda

  added / updated specs:
    - numpy==1.12.1

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    _libgcc_mutex-0.1          |      conda_forge           3 KB  conda-forge
    _openmp_mutex-4.5          |            1_gnu          22 KB  conda-forge
    blas-1.1                   |         openblas           1 KB  conda-forge
    brotlipy-0.7.0             |py36h8f6f2f9_1001         341 KB  conda-forge
    c-ares-1.17.1              |       h36c2ea0_0         111 KB  conda-forge
    certifi-2020.12.5          |   py36h5fab9bb_1         143 KB  conda-forge
    cffi-1.14.5                |   py36hc120d54_0         225 KB  conda-forge
    chardet-3.0.4              |py36h9880bd3_1008         194 KB  conda-forge
    conda-4.10.1               |   py36h5fab9bb_0         3.1 MB  conda-forge
    conda-package-handling-1.7.3|   py36h8f6f2f9_0         916 KB  conda-forge
    cryptography-3.4.7         |   py36hb60f036_0         1.1 MB  conda-forge
    gevent-21.1.2              |   py36h8f6f2f9_0         1.7 MB  conda-forge
    greenlet-0.4.17            |   py36h8f6f2f9_2          23 KB  conda-forge
    importlib-metadata-3.10.1  |   py36h5fab9bb_0          26 KB  conda-forge
    ipykernel-5.1.3            |   py36h5ca1d4c_0         159 KB  conda-forge
    ipython-7.11.1             |   py36h5ca1d4c_0         1.1 MB  conda-forge
    jedi-0.15.2                |           py36_0         759 KB  conda-forge
    jupyter_core-4.7.1         |   py36h5fab9bb_0          72 KB  conda-forge
    kiwisolver-1.1.0           |   py36hdb11119_1          86 KB  conda-forge
    libblas-3.8.0              |      17_openblas          11 KB  conda-forge
    libcblas-3.8.0             |      17_openblas          11 KB  conda-forge
    libev-4.33                 |       h516909a_1         104 KB  conda-forge
    libgcc-ng-9.3.0            |      h2828fa1_19         7.8 MB  conda-forge
    libgomp-9.3.0              |      h2828fa1_19         376 KB  conda-forge
    liblapack-3.8.0            |      17_openblas          11 KB  conda-forge
    liblapacke-3.8.0           |      17_openblas          11 KB  conda-forge
    libopenblas-0.3.10         |       h5a2b251_0         4.5 MB
    libuv-1.40.0               |       hd18ef5c_0         920 KB  conda-forge
    markupsafe-1.1.1           |   py36h8f6f2f9_3          27 KB  conda-forge
    matplotlib-3.1.1           |   py36h5429711_0         5.0 MB
    matplotlib-base-3.1.0      |   py36h5f35d83_0         6.7 MB  conda-forge
    mistune-0.8.4              |py36h8f6f2f9_1003          54 KB  conda-forge
    mkl-service-2.3.0          |   py36h8c4c3a4_2          54 KB  conda-forge
    nbconvert-5.6.1            |   py36h9f0ad1d_1         487 KB  conda-forge
    notebook-6.0.2             |           py36_0         6.2 MB  conda-forge
    numpy-1.12.1               |py36_blas_openblash1522bff_1001         3.8 MB  conda-forge
    openblas-0.3.3             |    h9ac9557_1001        15.8 MB  conda-forge
    openssl-1.1.1k             |       h7f98852_0         2.1 MB  conda-forge
    pandas-0.24.2              |   py36hf484d3e_0        11.1 MB  conda-forge
    pexpect-4.7.0              |           py36_0          78 KB  conda-forge
    pillow-8.1.0               |   py36h4f9996e_1         675 KB  conda-forge
    pip-21.0.1                 |     pyhd8ed1ab_0         1.1 MB  conda-forge
    pycosat-0.6.3              |py36h8f6f2f9_1006         107 KB  conda-forge
    pyqt-5.9.2                 |   py36hcca6a23_4         5.7 MB  conda-forge
    pyrsistent-0.15.6          |   py36h516909a_0          89 KB  conda-forge
    pysocks-1.7.1              |   py36h5fab9bb_3          27 KB  conda-forge
    python-3.6.13              |       hdb3f193_0        29.7 MB
    python_abi-3.6             |          1_cp36m           4 KB  conda-forge
    pyzmq-18.1.0               |   py36h1768529_0         516 KB  conda-forge
    ruamel_yaml-0.15.80        |py36h8f6f2f9_1004         268 KB  conda-forge
    scikit-learn-0.22.1        |   py36h22eb022_0         5.3 MB
    scipy-1.3.1                |   py36he2b7bc3_0        14.0 MB
    setuptools-49.6.0          |   py36h5fab9bb_3         936 KB  conda-forge
    sip-4.19.8                 |py36hf484d3e_1000         290 KB  conda-forge
    six-1.13.0                 |           py36_0          22 KB  conda-forge
    statsmodels-0.9.0          |py36h3010b51_1000         8.7 MB  conda-forge
    terminado-0.8.3            |   py36h9f0ad1d_1          23 KB  conda-forge
    tornado-6.0.3              |   py36h516909a_4         636 KB  conda-forge
    traitlets-4.3.3            |   py36h9f0ad1d_1         133 KB  conda-forge
    typing_extensions-3.7.4.3  |             py_0          25 KB  conda-forge
    zope.interface-5.4.0       |   py36h8f6f2f9_0         317 KB  conda-forge
    ------------------------------------------------------------
                                           Total:       143.4 MB

The following NEW packages will be INSTALLED:

  _openmp_mutex      conda-forge/linux-64::_openmp_mutex-4.5-1_gnu
  c-ares             conda-forge/linux-64::c-ares-1.17.1-h36c2ea0_0
  libev              conda-forge/linux-64::libev-4.33-h516909a_1
  libgomp            conda-forge/linux-64::libgomp-9.3.0-h2828fa1_19
  libuv              conda-forge/linux-64::libuv-1.40.0-hd18ef5c_0
  openblas           conda-forge/linux-64::openblas-0.3.3-h9ac9557_1001
  typing_extensions  conda-forge/noarch::typing_extensions-3.7.4.3-py_0

The following packages will be UPDATED:

  brotlipy           pkgs/main::brotlipy-0.7.0-py38h7b6447~ --> conda-forge::brotlipy-0.7.0-py36h8f6f2f9_1001
  certifi                         2019.11.28-py38h32f6830_1 --> 2020.12.5-py36h5fab9bb_1
  cffi                pkgs/main::cffi-1.14.3-py38he30daa8_0 --> conda-forge::cffi-1.14.5-py36hc120d54_0
  chardet                pkgs/main::chardet-3.0.4-py38_1003 --> conda-forge::chardet-3.0.4-py36h9880bd3_1008
  conda                               4.10.0-py38h578d9bd_1 --> 4.10.1-py36h5fab9bb_0
  conda-package-han~ pkgs/main::conda-package-handling-1.6~ --> conda-forge::conda-package-handling-1.7.3-py36h8f6f2f9_0
  cryptography       pkgs/main::cryptography-3.1.1-py38h1b~ --> conda-forge::cryptography-3.4.7-py36hb60f036_0
  gevent                              20.9.0-py38h1e0a361_1 --> 21.1.2-py36h8f6f2f9_0
  greenlet                            0.4.17-py38h1e0a361_1 --> 0.4.17-py36h8f6f2f9_2
  libblas                                 3.8.0-14_openblas --> 3.8.0-17_openblas
  libcblas                                3.8.0-14_openblas --> 3.8.0-17_openblas
  libgcc-ng           pkgs/main::libgcc-ng-9.1.0-hdf63c60_0 --> conda-forge::libgcc-ng-9.3.0-h2828fa1_19
  liblapack                               3.8.0-14_openblas --> 3.8.0-17_openblas
  liblapacke                              3.8.0-14_openblas --> 3.8.0-17_openblas
  libopenblas        conda-forge::libopenblas-0.3.7-h5ec1e~ --> pkgs/main::libopenblas-0.3.10-h5a2b251_0
  markupsafe                           1.1.1-py38h8df0ef7_2 --> 1.1.1-py36h8f6f2f9_3
  mistune                           0.8.4-py38h25fe258_1002 --> 0.8.4-py36h8f6f2f9_1003
  openssl                                 1.1.1h-h516909a_0 --> 1.1.1k-h7f98852_0
  pillow                               8.0.1-py38h70fbd49_0 --> 8.1.0-py36h4f9996e_1
  pip                 pkgs/main/linux-64::pip-20.2.3-py38_0 --> conda-forge/noarch::pip-21.0.1-pyhd8ed1ab_0
  pycosat            pkgs/main::pycosat-0.6.3-py38h7b6447c~ --> conda-forge::pycosat-0.6.3-py36h8f6f2f9_1006
  pysocks                   pkgs/main::pysocks-1.7.1-py38_0 --> conda-forge::pysocks-1.7.1-py36h5fab9bb_3
  zope.interface                       5.2.0-py38h25fe258_0 --> 5.4.0-py36h8f6f2f9_0

The following packages will be SUPERSEDED by a higher-priority channel:

  _libgcc_mutex           pkgs/main::_libgcc_mutex-0.1-main --> conda-forge::_libgcc_mutex-0.1-conda_forge
  pyqt                 pkgs/main::pyqt-5.9.2-py38h05f1152_4 --> conda-forge::pyqt-5.9.2-py36hcca6a23_4
  ruamel_yaml        pkgs/main::ruamel_yaml-0.15.87-py38h7~ --> conda-forge::ruamel_yaml-0.15.80-py36h8f6f2f9_1004
  scikit-learn       conda-forge::scikit-learn-0.22.1-py38~ --> pkgs/main::scikit-learn-0.22.1-py36h22eb022_0
  setuptools         pkgs/main::setuptools-50.3.0-py38hb0f~ --> conda-forge::setuptools-49.6.0-py36h5fab9bb_3
  sip                 pkgs/main::sip-4.19.13-py38he6710b0_0 --> conda-forge::sip-4.19.8-py36hf484d3e_1000

The following packages will be DOWNGRADED:

  blas                                        2.14-openblas --> 1.1-openblas
  importlib-metadata                  3.10.1-py38h578d9bd_0 --> 3.10.1-py36h5fab9bb_0
  ipykernel                            5.1.3-py38h5ca1d4c_0 --> 5.1.3-py36h5ca1d4c_0
  ipython                             7.11.1-py38h5ca1d4c_0 --> 7.11.1-py36h5ca1d4c_0
  jedi                                        0.15.2-py38_0 --> 0.15.2-py36_0
  jupyter_core                         4.7.1-py38h578d9bd_0 --> 4.7.1-py36h5fab9bb_0
  kiwisolver                           1.1.0-py38hbf85e49_1 --> 1.1.0-py36hdb11119_1
  matplotlib                           3.1.1-py38h5429711_0 --> 3.1.1-py36h5429711_0
  matplotlib-base                      3.3.1-py38h91b0d89_0 --> 3.1.0-py36h5f35d83_0
  mkl-service                          2.3.0-py38h1e0a361_2 --> 2.3.0-py36h8c4c3a4_2
  nbconvert                            5.6.1-py38h32f6830_1 --> 5.6.1-py36h9f0ad1d_1
  notebook                                     6.0.2-py38_0 --> 6.0.2-py36_0
  numpy                               1.18.1-py38h8854b6b_1 --> 1.12.1-py36_blas_openblash1522bff_1001
  pandas                              0.24.2-py38hb3f55d8_1 --> 0.24.2-py36hf484d3e_0
  pexpect                                      4.7.0-py38_0 --> 4.7.0-py36_0
  pyrsistent                          0.15.6-py38h516909a_0 --> 0.15.6-py36h516909a_0
  python                                   3.8.3-hcff3b4d_0 --> 3.6.13-hdb3f193_0
  python_abi                                     3.8-1_cp38 --> 3.6-1_cp36m
  pyzmq                               18.1.0-py38h1768529_0 --> 18.1.0-py36h1768529_0
  scipy                                1.3.1-py38he2b7bc3_0 --> 1.3.1-py36he2b7bc3_0
  six                                         1.13.0-py38_0 --> 1.13.0-py36_0
  statsmodels                         0.12.1-py38h0b5ebd8_1 --> 0.9.0-py36h3010b51_1000
  terminado                            0.8.3-py38h32f6830_1 --> 0.8.3-py36h9f0ad1d_1
  tornado                              6.0.3-py38h516909a_4 --> 6.0.3-py36h516909a_4
  traitlets                            4.3.3-py38h32f6830_1 --> 4.3.3-py36h9f0ad1d_1

Proceed ([y]/n)? 

Downloading and Extracting Packages
sip-4.19.8           | 290 KB    | ########## | 100% 
notebook-6.0.2       | 6.2 MB    | ########## | 100% 
greenlet-0.4.17      | 23 KB     | ########## | 100% 
typing_extensions-3. | 25 KB     | ########## | 100% 
terminado-0.8.3      | 23 KB     | ########## | 100% 
_openmp_mutex-4.5    | 22 KB     | ########## | 100% 
pyrsistent-0.15.6    | 89 KB     | ########## | 100% 
libgcc-ng-9.3.0      | 7.8 MB    | ########## | 100% 
pyqt-5.9.2           | 5.7 MB    | ########## | 100% 
conda-package-handli | 916 KB    | ########## | 100% 
conda-4.10.1         | 3.1 MB    | ########## | 100% 
six-1.13.0           | 22 KB     | ########## | 100% 
jedi-0.15.2          | 759 KB    | ########## | 100% 
pip-21.0.1           | 1.1 MB    | ########## | 100% 
c-ares-1.17.1        | 111 KB    | ########## | 100% 
libblas-3.8.0        | 11 KB     | ########## | 100% 
tornado-6.0.3        | 636 KB    | ########## | 100% 
liblapack-3.8.0      | 11 KB     | ########## | 100% 
pyzmq-18.1.0         | 516 KB    | ########## | 100% 
matplotlib-base-3.1. | 6.7 MB    | ########## | 100% 
traitlets-4.3.3      | 133 KB    | ########## | 100% 
libuv-1.40.0         | 920 KB    | ########## | 100% 
scikit-learn-0.22.1  | 5.3 MB    | ########## | 100% 
pycosat-0.6.3        | 107 KB    | ########## | 100% 
pysocks-1.7.1        | 27 KB     | ########## | 100% 
certifi-2020.12.5    | 143 KB    | ########## | 100% 
_libgcc_mutex-0.1    | 3 KB      | ########## | 100% 
pexpect-4.7.0        | 78 KB     | ########## | 100% 
gevent-21.1.2        | 1.7 MB    | ########## | 100% 
kiwisolver-1.1.0     | 86 KB     | ########## | 100% 
python_abi-3.6       | 4 KB      | ########## | 100% 
markupsafe-1.1.1     | 27 KB     | ########## | 100% 
pandas-0.24.2        | 11.1 MB   | ########## | 100% 
setuptools-49.6.0    | 936 KB    | ########## | 100% 
pillow-8.1.0         | 675 KB    | ########## | 100% 
openblas-0.3.3       | 15.8 MB   | ########## | 100% 
libgomp-9.3.0        | 376 KB    | ########## | 100% 
importlib-metadata-3 | 26 KB     | ########## | 100% 
ruamel_yaml-0.15.80  | 268 KB    | ########## | 100% 
ipython-7.11.1       | 1.1 MB    | ########## | 100% 
scipy-1.3.1          | 14.0 MB   | ########## | 100% 
numpy-1.12.1         | 3.8 MB    | ########## | 100% 
cffi-1.14.5          | 225 KB    | ########## | 100% 
openssl-1.1.1k       | 2.1 MB    | ########## | 100% 
libopenblas-0.3.10   | 4.5 MB    | ########## | 100% 
blas-1.1             | 1 KB      | ########## | 100% 
libev-4.33           | 104 KB    | ########## | 100% 
statsmodels-0.9.0    | 8.7 MB    | ########## | 100% 
zope.interface-5.4.0 | 317 KB    | ########## | 100% 
mistune-0.8.4        | 54 KB     | ########## | 100% 
ipykernel-5.1.3      | 159 KB    | ########## | 100% 
nbconvert-5.6.1      | 487 KB    | ########## | 100% 
brotlipy-0.7.0       | 341 KB    | ########## | 100% 
matplotlib-3.1.1     | 5.0 MB    | ########## | 100% 
jupyter_core-4.7.1   | 72 KB     | ########## | 100% 
mkl-service-2.3.0    | 54 KB     | ########## | 100% 
cryptography-3.4.7   | 1.1 MB    | ########## | 100% 
liblapacke-3.8.0     | 11 KB     | ########## | 100% 
libcblas-3.8.0       | 11 KB     | ########## | 100% 
python-3.6.13        | 29.7 MB   | ########## | 100% 
chardet-3.0.4        | 194 KB    | ########## | 100% 
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
Removing intermediate container 2449155a7526
 ---> 7710483f6225
Step 24/32 : WORKDIR /home/app/
 ---> Running in 72b0b46efad0
Removing intermediate container 72b0b46efad0
 ---> 614da0062994
Step 25/32 : COPY function/ ./function
 ---> 0389cb3478cb
Step 26/32 : ENV fprocess="python index.py"
 ---> Running in c2abd77c4fa5
Removing intermediate container c2abd77c4fa5
 ---> 6043b98a0ef7
Step 27/32 : ENV cgi_headers="true"
 ---> Running in 74818e80a63b
Removing intermediate container 74818e80a63b
 ---> 01a802776f85
Step 28/32 : ENV mode="http"
 ---> Running in 7306558f9645
Removing intermediate container 7306558f9645
 ---> 9b2add6e4dbf
Step 29/32 : ENV upstream_url="http://127.0.0.1:5000"
 ---> Running in a88eaf96f372
Removing intermediate container a88eaf96f372
 ---> 9d817f4138c9
Step 30/32 : ENV function_root="/home/app/function"
 ---> Running in 9f46b8b78821
Removing intermediate container 9f46b8b78821
 ---> 9ba272bafe0e
Step 31/32 : HEALTHCHECK --interval=5s CMD [ -e /tmp/.lock ] || exit 1
 ---> Running in 2a46f5aa3c7f
Removing intermediate container 2a46f5aa3c7f
 ---> f39d994619c4
Step 32/32 : CMD ["fwatchdog"]
 ---> Running in 9469dd7bee66
Removing intermediate container 9469dd7bee66
 ---> 8cc9f9e6bbc3
Successfully built 8cc9f9e6bbc3

What's wrong?

When I run the function with invoke:

$ faas-cli invoke hello-python
Reading from STDIN - hit (Control + D) to stop.
asdasdad
Server returned unexpected status code: 500 - exit status 1
Traceback (most recent call last):
  File "index.py", line 6, in <module>
    from function import handler
  File "/home/app/function/handler.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'

Why the module is not found?

LucasRoesler commented 3 years ago

hey @IsmaelGSerrano I haven't been able to reproduce this yet, is it possible for you to push your sample broken function to a public github repo so that I can take a look at it? I know the sample is pretty simple, but perhaps there must be some step that we are doing differently and the shared repo will help reduce that.

IsmaelGSerrano commented 3 years ago

hey @IsmaelGSerrano I haven't been able to reproduce this yet, is it possible for you to push your sample broken function to a public github repo so that I can take a look at it? I know the sample is pretty simple, but perhaps there must be some step that we are doing differently and the shared repo will help reduce that.

Hi @LucasRoesler, Thank you for answering, I created this repo: https://github.com/IsmaelGSerrano/hello-openfaas

LucasRoesler commented 3 years ago

Hi @IsmaelGSerrano i am a little confused, that repo you posted is not quite the pydatascience template, since you hacked in the basic auth stuff, (makes em wonder if there is a nice way to expose this kind of "add additional middlewares" without forking the template, but that is a side note/idea).

But I looked through it and the docker template is almost the same (one small extra conda install that I would love to know why it was required instead of adding it to the handler's requirements.txt)

I then built and ran the function without any issues

$ curl localhost:8080 -d "example.com"
Hi, you said: b'example.com'. Random number = [ 0.98218931  0.34564669  0.39562981  0.04804355  0.63363297  0.88951796
  0.33120779  0.92167527  0.50666615  0.3265648 ]

So the image is fine, it seems.

I should note that I took the time to update the pydatascience template to add unit testing during builds, so there might be a few more tweaks you want port https://github.com/LucasRoesler/pydatascience-template the repo now includes two non-trivial functions that build and have tests that pass, so I feel pretty confident that the template is doing what it should.

So the next thing to look at is how your are deploying it. Can you share instructions for how you created your openfaas cluster so that I can try replicating that too? Thanks

IsmaelGSerrano commented 3 years ago

Hi @LucasRoesler, yes you are right, I was using another fork of pydatascience. I did not notice that till now, a colleague used this code before me. Now, the function works fine with just the original pydatascience template and I have included the flask authorization feature with no issues. I really do not know what could be the initial problem, but it's solved. Thank you @LucasRoesler for your help.