Buildar lib prophet in Docker

Asked

Viewed 207 times

-1

I’m having trouble building a container with lib prophet already tried almost everything but unsuccessfully. I’ve tried to install direct, and now I’m trying to use virtualenv and still unsuccessful.

Dockerfile

FROM python:3.7


LABEL MAINTAINER Leonardo Rodrigues
# Variáveis de ambiente
ARG PORT
ARG HOST 
ARG LD_LIBRARY_PATH
ARG DEBUG

# ENV DEBUG=False
ENV DEBUG=${DEBUG}
ENV PORT=${PORT}
ENV HOST=${HOST}


WORKDIR /app

COPY . /app

RUN python3 -m venv venv
RUN . venv/bin/activate


RUN pip install --upgrade pip && pip install --no-cache-dir --user -r requirements.txt --no-warn-script-location

RUN pip install pystan==2.18
RUN pip install pytz==2017.2
RUN pip install fbprophet

RUN useradd python

COPY --chown=python . /app

EXPOSE ${PORT}

USER python

CMD python manage.py runserver 0.0.0.0:${PORT}




Error message


Sending build context to Docker daemon  1.163MB
Step 1/22 : FROM python:3.7
 ---> 84d66a048f90
Step 2/22 : LABEL MAINTAINER Leonardo Rodrigues
 ---> Running in 5caeb3889186
Removing intermediate container 5caeb3889186
 ---> 2d89013d2f52
Step 3/22 : ARG PORT
 ---> Running in 5554fd01ee7b
Removing intermediate container 5554fd01ee7b
 ---> d57cab74c8fa
Step 4/22 : ARG HOST
 ---> Running in d615ae639938
Removing intermediate container d615ae639938
 ---> d721e6ad4291
Step 5/22 : ARG LD_LIBRARY_PATH
 ---> Running in 4ac97ceedb80
Removing intermediate container 4ac97ceedb80
 ---> 5e93c9d498ab
Step 6/22 : ARG DEBUG
 ---> Running in 9b6b8e6f40f7
Removing intermediate container 9b6b8e6f40f7
 ---> 0f097182d7b1
Step 7/22 : ENV DEBUG=${DEBUG}
 ---> Running in b5a742e2050f
Removing intermediate container b5a742e2050f
 ---> b5535a55c0c3
Step 8/22 : ENV PORT=${PORT}
 ---> Running in 62d18fb577f9
Removing intermediate container 62d18fb577f9
 ---> c93c1cd45c1a
Step 9/22 : ENV HOST=${HOST}
 ---> Running in 713817af76af
Removing intermediate container 713817af76af
 ---> 2839fd846cf7
Step 10/22 : WORKDIR /app
 ---> Running in 699c12192c35
Removing intermediate container 699c12192c35
 ---> 01f5de706a90
Step 11/22 : COPY . /app
 ---> 97ca1bdfc884
Step 12/22 : RUN python3 -m venv venv
 ---> Running in be170350ea47
Removing intermediate container be170350ea47
 ---> c5fe833eacb9
Step 13/22 : RUN . venv/bin/activate
 ---> Running in 230519fb130e
Removing intermediate container 230519fb130e
 ---> acb0a7f4e853
Step 14/22 : RUN pip install pystan==2.18
 ---> Running in 4536bdec241d
Collecting pystan==2.18
  Downloading pystan-2.18.0.0-cp37-cp37m-manylinux1_x86_64.whl (50.0 MB)
Collecting Cython!=0.25.1,>=0.22
  Downloading Cython-0.29.17-cp37-cp37m-manylinux1_x86_64.whl (2.1 MB)
Collecting numpy>=1.7
  Downloading numpy-1.18.3-cp37-cp37m-manylinux1_x86_64.whl (20.2 MB)
Installing collected packages: Cython, numpy, pystan
Successfully installed Cython-0.29.17 numpy-1.18.3 pystan-2.18.0.0
Removing intermediate container 4536bdec241d
 ---> 7d0e07d85f06
Step 15/22 : RUN pip install pytz==2017.2
 ---> Running in 7be41c5af2da
Collecting pytz==2017.2
  Downloading pytz-2017.2-py2.py3-none-any.whl (484 kB)
Installing collected packages: pytz
Successfully installed pytz-2017.2
Removing intermediate container 7be41c5af2da
 ---> f2bb54e172b8
Step 16/22 : RUN pip install fbprophet
 ---> Running in 46aaa0e9d295
Collecting fbprophet
  Downloading fbprophet-0.6.tar.gz (54 kB)
Requirement already satisfied: Cython>=0.22 in /usr/local/lib/python3.7/site-packages (from fbprophet) (0.29.17)
Collecting cmdstanpy==0.4
  Downloading cmdstanpy-0.4.0-py3-none-any.whl (22 kB)
Requirement already satisfied: pystan>=2.14 in /usr/local/lib/python3.7/site-packages (from fbprophet) (2.18.0.0)
Requirement already satisfied: numpy>=1.10.0 in /usr/local/lib/python3.7/site-packages (from fbprophet) (1.18.3)
Collecting pandas>=0.23.4
  Downloading pandas-1.0.3-cp37-cp37m-manylinux1_x86_64.whl (10.0 MB)
Collecting matplotlib>=2.0.0
  Downloading matplotlib-3.2.1-cp37-cp37m-manylinux1_x86_64.whl (12.4 MB)
Collecting LunarCalendar>=0.0.9
  Downloading LunarCalendar-0.0.9-py2.py3-none-any.whl (18 kB)
Collecting convertdate>=2.1.2
  Downloading convertdate-2.2.0-py3-none-any.whl (37 kB)
Collecting holidays>=0.9.5
  Downloading holidays-0.10.2.tar.gz (110 kB)
Collecting setuptools-git>=1.2
  Downloading setuptools_git-1.2-py2.py3-none-any.whl (10 kB)
Collecting python-dateutil>=2.8.0
  Downloading python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
Requirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.7/site-packages (from pandas>=0.23.4->fbprophet) (2017.2)
Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1
  Downloading pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
Collecting cycler>=0.10
  Downloading cycler-0.10.0-py2.py3-none-any.whl (6.5 kB)
Collecting kiwisolver>=1.0.1
  Downloading kiwisolver-1.2.0-cp37-cp37m-manylinux1_x86_64.whl (88 kB)
Collecting ephem>=3.7.5.3
  Downloading ephem-3.7.7.1-cp37-cp37m-manylinux2010_x86_64.whl (1.2 MB)
Collecting pymeeus<=1,>=0.3.6
  Downloading PyMeeus-0.3.7.tar.gz (732 kB)
Collecting six
  Downloading six-1.14.0-py2.py3-none-any.whl (10 kB)
Collecting korean_lunar_calendar
  Downloading korean_lunar_calendar-0.2.1-py3-none-any.whl (8.0 kB)
Building wheels for collected packages: fbprophet, holidays, pymeeus
  Building wheel for fbprophet (setup.py): started
  Building wheel for fbprophet (setup.py): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6siitsg7/fbprophet/setup.py'"'"'; __file__='"'"'/tmp/pip-install-6siitsg7/fbprophet/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-cf0bqsg6
       cwd: /tmp/pip-install-6siitsg7/fbprophet/
  Complete output (40 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib
  creating build/lib/fbprophet
  creating build/lib/fbprophet/stan_model
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-6siitsg7/fbprophet/setup.py", line 148, in <module>
      """
    File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 144, in setup
      return distutils.core.setup(**attrs)
    File "/usr/local/lib/python3.7/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/local/lib/python3.7/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 223, in run
      self.run_command('build')
    File "/usr/local/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.7/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/usr/local/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/tmp/pip-install-6siitsg7/fbprophet/setup.py", line 48, in run
      build_models(target_dir)
    File "/tmp/pip-install-6siitsg7/fbprophet/setup.py", line 36, in build_models
      from fbprophet.models import StanBackendEnum
    File "/tmp/pip-install-6siitsg7/fbprophet/fbprophet/__init__.py", line 8, in <module>
      from fbprophet.forecaster import Prophet
    File "/tmp/pip-install-6siitsg7/fbprophet/fbprophet/forecaster.py", line 15, in <module>
      import pandas as pd
  ModuleNotFoundError: No module named 'pandas'
  ----------------------------------------
  ERROR: Failed building wheel for fbprophet
  Running setup.py clean for fbprophet
  Building wheel for holidays (setup.py): started
  Building wheel for holidays (setup.py): finished with status 'done'
  Created wheel for holidays: filename=holidays-0.10.2-py3-none-any.whl size=111560 sha256=5975198a475531b314586b35cf490753ea4d14aa5f7d886e0126cee5c22c1e59  Stored in directory: /root/.cache/pip/wheels/90/4e/82/f4130a57eb035c4344489ca14caff692590719b5f375540f53
  Building wheel for pymeeus (setup.py): started
  Building wheel for pymeeus (setup.py): finished with status 'done'
  Created wheel for pymeeus: filename=PyMeeus-0.3.7-py3-none-any.whl size=702876 sha256=9a52c21fb133ce9de1760fe697f766f0b1407cb4033d695b5897e290a5d76a70
  Stored in directory: /root/.cache/pip/wheels/80/32/5f/2a67880d4ce584b9cf99146f9945e46942dfb010a9382c6ff5
Successfully built holidays pymeeus
Failed to build fbprophet

The Pip installation manager reports the missing lib pandas error, but it is already included in the Restarts and is also installed when I run the command

RUN pip install pystan==2.18

2 answers

0

Note that in the error message ta saying that missing install pandas, adds before the line:

RUN pip install fbprophet

the line:

RUN pip install pandas
  • the pandas is already installed in the resquirements, the same problem is the execution of the installation of that lib

0

I ended up finding the solution from the anaconda.

pip install -f https://pypi.anaconda.org/conda-forge/simple fbprophet  

This command is similar to :

conda install -c conda-forge fbprophet

Since you helped me, I hope you help someone too

Browser other questions tagged

You are not signed in. Login or sign up in order to post.