title: How to create docker image with prophet 1.0.1
body: <p>I am trying to build a docker image with <code>prophet</code> library and in my requirements.txt I have called out for all the dependencies as below -</p>
  <pre><code>numpy==1.20.2
  pandas==1.2.1
  pystan==2.19.1.1
  joblib==0.15.1
  prophet==1.0.1
  scikit-learn==0.24.1
  hampel==0.0.5
  google
  google-cloud-secret-manager
  tqdm
  </code></pre>
  <p>Yet, when I run <code>docker build .</code> command using the below docker file , my build does not go successful. Here is my docker file -</p>
  <pre><code>FROM python:3.7-slim-buster as base
  
  COPY app /root/app
  WORKDIR /root
  RUN apt update
  RUN apt-get install -y --no-install-recommends g++ build-essential git python3-dev gcc libc-dev wget rpm
  RUN pip3 install --upgrade pip
  
  
  # Below method does not work and still gives no module named numpy error even though numpy is present in requirements.txt
  RUN pip install --no-cache-dir -U -r ./app/requirements.txt
  
  # CMD streamlit run app/app.py --server.maxUploadSize=512 --server.port 8080
  ENTRYPOINT [&quot;tail&quot;, &quot;-f&quot;, &quot;/dev/null&quot;]
  </code></pre>
  <p>Here is the error trace  when I use this combination -</p>
  <pre><code>#11 24.36   
  #11 24.36   × python setup.py bdist_wheel did not run successfully.
  #11 24.36   │ exit code: 1
  #11 24.36   ╰─&gt; [41 lines of output]
  #11 24.36       running bdist_wheel
  #11 24.36       running build
  #11 24.36       running build_py
  #11 24.36       creating build
  #11 24.36       creating build/lib
  #11 24.36       creating build/lib/prophet
  #11 24.36       creating build/lib/prophet/stan_model
  #11 24.36       Traceback (most recent call last):
  #11 24.36         File &quot;&lt;string&gt;&quot;, line 36, in &lt;module&gt;
  #11 24.36         File &quot;&lt;pip-setuptools-caller&gt;&quot;, line 34, in &lt;module&gt;
  #11 24.36         File &quot;/tmp/pip-install-_y2f8_xf/prophet_6675cc9554e243a9ad11808d577194a8/setup.py&quot;, line 150, in &lt;module&gt;
  #11 24.36           long_description_content_type='text/markdown',
  #11 24.36         File &quot;/usr/local/lib/python3.7/site-packages/setuptools/__init__.py&quot;, line 153, in setup
  #11 24.36           return distutils.core.setup(**attrs)
  #11 24.36         File &quot;/usr/local/lib/python3.7/distutils/core.py&quot;, line 148, in setup
  #11 24.36           dist.run_commands()
  #11 24.36         File &quot;/usr/local/lib/python3.7/distutils/dist.py&quot;, line 966, in run_commands
  #11 24.36           self.run_command(cmd)
  #11 24.36         File &quot;/usr/local/lib/python3.7/distutils/dist.py&quot;, line 985, in run_command
  #11 24.36           cmd_obj.run()
  #11 24.36         File &quot;/usr/local/lib/python3.7/site-packages/wheel/bdist_wheel.py&quot;, line 299, in run
  #11 24.36           self.run_command('build')
  #11 24.36         File &quot;/usr/local/lib/python3.7/distutils/cmd.py&quot;, line 313, in run_command
  #11 24.36           self.distribution.run_command(command)
  #11 24.36         File &quot;/usr/local/lib/python3.7/distutils/dist.py&quot;, line 985, in run_command
  #11 24.36           cmd_obj.run()
  #11 24.36         File &quot;/usr/local/lib/python3.7/distutils/command/build.py&quot;, line 135, in run
  #11 24.36           self.run_command(cmd_name)
  #11 24.36         File &quot;/usr/local/lib/python3.7/distutils/cmd.py&quot;, line 313, in run_command
  #11 24.36           self.distribution.run_command(command)
  #11 24.36         File &quot;/usr/local/lib/python3.7/distutils/dist.py&quot;, line 985, in run_command
  #11 24.36           cmd_obj.run()
  #11 24.36         File &quot;/tmp/pip-install-_y2f8_xf/prophet_6675cc9554e243a9ad11808d577194a8/setup.py&quot;, line 48, in run
  #11 24.36           build_models(target_dir)
  #11 24.36         File &quot;/tmp/pip-install-_y2f8_xf/prophet_6675cc9554e243a9ad11808d577194a8/setup.py&quot;, line 36, in build_models
  #11 24.36           from prophet.models import StanBackendEnum
  #11 24.36         File &quot;/tmp/pip-install-_y2f8_xf/prophet_6675cc9554e243a9ad11808d577194a8/prophet/__init__.py&quot;, line 8, in &lt;module&gt;
  #11 24.36           from prophet.forecaster import Prophet
  #11 24.36         File &quot;/tmp/pip-install-_y2f8_xf/prophet_6675cc9554e243a9ad11808d577194a8/prophet/forecaster.py&quot;, line 14, in &lt;module&gt;
  #11 24.36           import numpy as np
  #11 24.36       ModuleNotFoundError: No module named 'numpy'
  </code></pre>
  <p>So then, I tried adding the dependencies in the docker file itself to see and test out these dependencies -</p>
  <p>In my trial 2, my docker file looks like this -</p>
  <pre><code>FROM python:3.7-slim-buster as base
  
  COPY app /root/app
  WORKDIR /root
  RUN apt update
  RUN apt-get install -y --no-install-recommends g++ build-essential git python3-dev gcc libc-dev wget rpm
  RUN pip3 install --upgrade pip
  
  RUN pip install numpy==1.21.0
  RUN pip install pandas==1.2.1
  RUN pip install pystan==2.19.1.1
  RUN pip install convertdate
  RUN pip install lunarcalendar
  RUN pip install holidays
  RUN pip install tqdm
  RUN pip install prophet==1.0.1
  
  
  
  # CMD streamlit run app/app.py --server.maxUploadSize=512 --server.port 8080
  ENTRYPOINT [&quot;tail&quot;, &quot;-f&quot;, &quot;/dev/null&quot;]
  </code></pre>
  <p>Then I did <code>docker build .</code> and this time I got below error trace -</p>
  <pre><code>[+] Building 89.3s (17/18)                                                                                                                                       
   =&gt; [internal] load metadata for docker.io/library/python:3.7-slim-buster                                                                                   0.8s
   =&gt; [internal] load build context                                                                                                                           0.0s
   =&gt; =&gt; transferring context: 65B                                                                                                                            0.0s
   =&gt; [ 1/14] FROM docker.io/library/python:3.7-slim-buster@sha256:1c99a3b0f4c8168b2210e74911cbcf028a6a44ddad50d0eed5a5eced28173295                           0.0s
   =&gt; CACHED [ 2/14] COPY app /root/app                                                                                                                       0.0s
   =&gt; CACHED [ 3/14] WORKDIR /root                                                                                                                            0.0s
   =&gt; CACHED [ 4/14] RUN apt update                                                                                                                           0.0s
   =&gt; CACHED [ 5/14] RUN apt-get install -y --no-install-recommends g++ build-essential git python3-dev gcc libc-dev wget rpm                                 0.0s
   =&gt; CACHED [ 6/14] RUN pip3 install --upgrade pip                                                                                                           0.0s
   =&gt; [ 7/14] RUN pip install numpy==1.21.0                                                                                                                   6.5s
   =&gt; [ 8/14] RUN pip install pandas==1.2.1                                                                                                                   6.3s
   =&gt; [ 9/14] RUN pip install pystan==2.19.1.1                                                                                                               19.4s
   =&gt; [10/14] RUN pip install convertdate                                                                                                                     7.2s
  [+] Building 89.4s (17/18)                                                                                                                                       
   =&gt; CACHED [ 6/14] RUN pip3 install --upgrade pip                                                                                                           0.0s
   =&gt; [ 7/14] RUN pip install numpy==1.21.0                                                                                                                   6.5s 
   =&gt; [ 8/14] RUN pip install pandas==1.2.1                                                                                                                   6.3s 
   =&gt; [ 9/14] RUN pip install pystan==2.19.1.1                                                                                                               19.4s 
   =&gt; [10/14] RUN pip install convertdate                                                                                                                     7.2s 
   =&gt; [11/14] RUN pip install lunarcalendar                                                                                                                   3.0s 
   =&gt; [12/14] RUN pip install holidays                                                                                                                        3.1s 
   =&gt; [13/14] RUN pip install tqdm                                                                                                                            1.7s 
   =&gt; [14/14] RUN pip install prophet==1.0.1                                                                                                                 41.2s 
                                                                                                                                                                   
                                                                                                                                                                   
                                                                                                                                                                   
                                                                                                                                                                   
  [+] Building 732.3s (17/18)                                                                                                                                      
   =&gt; [internal] load build definition from Dockerfile                                                                                                        0.0s 
   =&gt; =&gt; transferring dockerfile: 911B                                                                                                                        0.0s 
   =&gt; [internal] load .dockerignore                                                                                                                           0.0s 
   =&gt; =&gt; transferring context: 2B                                                                                                                             0.0s 
   =&gt; [internal] load metadata for docker.io/library/python:3.7-slim-buster                                                                                   0.8s 
   =&gt; [internal] load build context                                                                                                                           0.0s 
   =&gt; =&gt; transferring context: 65B                                                                                                                            0.0s 
   =&gt; [ 1/14] FROM docker.io/library/python:3.7-slim-buster@sha256:1c99a3b0f4c8168b2210e74911cbcf028a6a44ddad50d0eed5a5eced28173295                           0.0s 
   =&gt; CACHED [ 2/14] COPY app /root/app                                                                                                                       0.0s 
  [+] Building 732.5s (17/18)                                                                                                                                      
   =&gt; CACHED [ 4/14] RUN apt update                                                                                                                           0.0s
   =&gt; CACHED [ 5/14] RUN apt-get install -y --no-install-recommends g++ build-essential git python3-dev gcc libc-dev wget rpm                                 0.0s
   =&gt; CACHED [ 6/14] RUN pip3 install --upgrade pip                                                                                                           0.0s
   =&gt; [ 7/14] RUN pip install numpy==1.21.0                                                                                                                   6.5s
   =&gt; [ 8/14] RUN pip install pandas==1.2.1                                                                                                                   6.3s
   =&gt; [ 9/14] RUN pip install pystan==2.19.1.1                                                                                                               19.4s
   =&gt; [10/14] RUN pip install convertdate                                                                                                                     7.2s
   =&gt; [11/14] RUN pip install lunarcalendar                                                                                                                   3.0s
   =&gt; [12/14] RUN pip install holidays                                                                                                                        3.1s
  [+] Building 1015.7s (18/18) FINISHED                                                                                                                            
   =&gt; [internal] load build definition from Dockerfile                                                                                                        0.0s
   =&gt; =&gt; transferring dockerfile: 911B                                                                                                                        0.0s
   =&gt; [internal] load .dockerignore                                                                                                                           0.0s
   =&gt; =&gt; transferring context: 2B                                                                                                                             0.0s
   =&gt; [internal] load metadata for docker.io/library/python:3.7-slim-buster                                                                                   0.8s
   =&gt; [internal] load build context                                                                                                                           0.0s
   =&gt; =&gt; transferring context: 65B                                                                                                                            0.0s
   =&gt; [ 1/14] FROM docker.io/library/python:3.7-slim-buster@sha256:1c99a3b0f4c8168b2210e74911cbcf028a6a44ddad50d0eed5a5eced28173295                           0.0s 
   =&gt; CACHED [ 2/14] COPY app /root/app                                                                                                                       0.0s 
   =&gt; CACHED [ 3/14] WORKDIR /root                                                                                                                            0.0s 
   =&gt; CACHED [ 4/14] RUN apt update                                                                                                                           0.0s 
   =&gt; CACHED [ 5/14] RUN apt-get install -y --no-install-recommends g++ build-essential git python3-dev gcc libc-dev wget rpm                                 0.0s 
   =&gt; CACHED [ 6/14] RUN pip3 install --upgrade pip                                                                                                           0.0s 
   =&gt; [ 7/14] RUN pip install numpy==1.21.0                                                                                                                   6.5s 
   =&gt; [ 8/14] RUN pip install pandas==1.2.1                                                                                                                   6.3s 
   =&gt; [ 9/14] RUN pip install pystan==2.19.1.1                                                                                                               19.4s 
   =&gt; [10/14] RUN pip install convertdate                                                                                                                     7.2s 
   =&gt; [11/14] RUN pip install lunarcalendar                                                                                                                   3.0s
   =&gt; [12/14] RUN pip install holidays                                                                                                                        3.1s
   =&gt; [13/14] RUN pip install tqdm                                                                                                                            1.7s
   =&gt; ERROR [14/14] RUN pip install prophet==1.0.1                                                                                                          967.4s
  ------                                                                                                                                                           
   &gt; [14/14] RUN pip install prophet==1.0.1:                                                                                                                       
  #18 0.996 Collecting prophet==1.0.1                                                                                                                              
  #18 1.125   Downloading prophet-1.0.1.tar.gz (65 kB)                                                                                                             
  #18 1.153      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.8/65.8 KB 3.2 MB/s eta 0:00:00                                                                        
  #18 1.176   Preparing metadata (setup.py): started                                                                                                               
  #18 1.513   Preparing metadata (setup.py): finished with status 'done'
  #18 1.528 Requirement already satisfied: Cython&gt;=0.22 in /usr/local/lib/python3.7/site-packages (from prophet==1.0.1) (0.29.28)
  #18 1.752 Collecting cmdstanpy==0.9.68
  #18 1.853   Downloading cmdstanpy-0.9.68-py3-none-any.whl (49 kB)
  #18 1.876      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 49.0/49.0 KB 2.5 MB/s eta 0:00:00
  #18 1.880 Requirement already satisfied: pystan~=2.19.1.1 in /usr/local/lib/python3.7/site-packages (from prophet==1.0.1) (2.19.1.1)
  #18 1.881 Requirement already satisfied: numpy&gt;=1.15.4 in /usr/local/lib/python3.7/site-packages (from prophet==1.0.1) (1.21.0)
  #18 1.883 Requirement already satisfied: pandas&gt;=1.0.4 in /usr/local/lib/python3.7/site-packages (from prophet==1.0.1) (1.2.1)
  #18 2.119 Collecting matplotlib&gt;=2.0.0
  #18 2.146   Downloading matplotlib-3.5.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (11.2 MB)
  #18 3.265      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.2/11.2 MB 18.3 MB/s eta 0:00:00
  #18 3.323 Requirement already satisfied: LunarCalendar&gt;=0.0.9 in /usr/local/lib/python3.7/site-packages (from prophet==1.0.1) (0.0.9)
  #18 3.324 Requirement already satisfied: convertdate&gt;=2.1.2 in /usr/local/lib/python3.7/site-packages (from prophet==1.0.1) (2.4.0)
  #18 3.326 Requirement already satisfied: holidays&gt;=0.10.2 in /usr/local/lib/python3.7/site-packages (from prophet==1.0.1) (0.13)
  #18 3.371 Collecting setuptools-git&gt;=1.2
  #18 3.436   Downloading setuptools_git-1.2-py2.py3-none-any.whl (10 kB)
  #18 3.453 Requirement already satisfied: python-dateutil&gt;=2.8.0 in /usr/local/lib/python3.7/site-packages (from prophet==1.0.1) (2.8.2)
  #18 3.456 Requirement already satisfied: tqdm&gt;=4.36.1 in /usr/local/lib/python3.7/site-packages (from prophet==1.0.1) (4.64.0)
  #18 3.612 Collecting ujson
  #18 3.669   Downloading ujson-5.2.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (45 kB)
  #18 3.693      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 45.0/45.0 KB 2.1 MB/s eta 0:00:00
  #18 3.713 Requirement already satisfied: pymeeus&lt;=1,&gt;=0.3.13 in /usr/local/lib/python3.7/site-packages (from convertdate&gt;=2.1.2-&gt;prophet==1.0.1) (0.5.11)
  #18 3.719 Requirement already satisfied: korean-lunar-calendar in /usr/local/lib/python3.7/site-packages (from holidays&gt;=0.10.2-&gt;prophet==1.0.1) (0.2.1)
  #18 3.720 Requirement already satisfied: hijri-converter in /usr/local/lib/python3.7/site-packages (from holidays&gt;=0.10.2-&gt;prophet==1.0.1) (2.2.3)
  #18 3.726 Requirement already satisfied: pytz in /usr/local/lib/python3.7/site-packages (from LunarCalendar&gt;=0.0.9-&gt;prophet==1.0.1) (2022.1)
  #18 3.727 Requirement already satisfied: ephem&gt;=3.7.5.3 in /usr/local/lib/python3.7/site-packages (from LunarCalendar&gt;=0.0.9-&gt;prophet==1.0.1) (4.1.3)
  #18 3.773 Collecting cycler&gt;=0.10
  #18 3.791   Downloading cycler-0.11.0-py3-none-any.whl (6.4 kB)
  #18 4.149 Collecting pillow&gt;=6.2.0
  #18 4.202   Downloading Pillow-9.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.3 MB)
  #18 4.459      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.3/4.3 MB 17.2 MB/s eta 0:00:00
  #18 4.891 Collecting fonttools&gt;=4.22.0
  #18 4.929   Downloading fonttools-4.33.3-py3-none-any.whl (930 kB)
  #18 4.981      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 930.9/930.9 KB 19.7 MB/s eta 0:00:00
  #18 5.171 Collecting pyparsing&gt;=2.2.1
  #18 5.191   Downloading pyparsing-3.0.8-py3-none-any.whl (98 kB)
  #18 5.208      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 98.5/98.5 KB 10.2 MB/s eta 0:00:00
  #18 5.562 Collecting packaging&gt;=20.0
  #18 5.585   Downloading packaging-21.3-py3-none-any.whl (40 kB)
  #18 5.594      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 40.8/40.8 KB 6.7 MB/s eta 0:00:00
  #18 5.908 Collecting kiwisolver&gt;=1.0.1
  #18 5.970   Downloading kiwisolver-1.4.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.1 MB)
  #18 6.111      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 8.9 MB/s eta 0:00:00
  #18 6.135 Requirement already satisfied: six&gt;=1.5 in /usr/local/lib/python3.7/site-packages (from python-dateutil&gt;=2.8.0-&gt;prophet==1.0.1) (1.16.0)
  #18 6.289 Collecting typing-extensions
  #18 6.305   Downloading typing_extensions-4.2.0-py3-none-any.whl (24 kB)
  #18 6.389 Building wheels for collected packages: prophet
  #18 6.391   Building wheel for prophet (setup.py): started
  #18 282.2   Building wheel for prophet (setup.py): still running...
  #18 287.9   Building wheel for prophet (setup.py): finished with status 'error'
  #18 288.4   error: subprocess-exited-with-error
  #18 288.4   
  #18 288.4   × python setup.py bdist_wheel did not run successfully.
  #18 288.4   │ exit code: 1
  #18 288.4   ╰─&gt; [11 lines of output]
  #18 288.4       running bdist_wheel
  #18 288.4       running build
  #18 288.4       running build_py
  #18 288.4       creating build
  #18 288.4       creating build/lib
  #18 288.4       creating build/lib/prophet
  #18 288.4       creating build/lib/prophet/stan_model
  #18 288.4       Importing matplotlib failed. Plotting will not work.
  #18 288.4       Importing plotly failed. Interactive plots will not work.
  #18 288.4       INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_dfdaf2b8ece8a02eb11f050ec701c0ec NOW.
  #18 288.4       error: command 'gcc' failed with exit status 1
  #18 288.4       [end of output]
  #18 288.4   
  #18 288.4   note: This error originates from a subprocess, and is likely not a problem with pip.
  #18 288.4   ERROR: Failed building wheel for prophet
  #18 288.4   Running setup.py clean for prophet
  #18 289.1 Failed to build prophet
  #18 289.7 Installing collected packages: setuptools-git, ujson, typing-extensions, pyparsing, pillow, fonttools, cycler, packaging, kiwisolver, matplotlib, cmdstanpy, prophet
  #18 293.9   Running setup.py install for prophet: started
  #18 959.4   Running setup.py install for prophet: still running...
  #18 964.5   Running setup.py install for prophet: finished with status 'error'
  #18 964.7   error: subprocess-exited-with-error
  #18 964.7   
  #18 964.7   × Running setup.py install for prophet did not run successfully.
  #18 964.7   │ exit code: 1
  #18 964.7   ╰─&gt; [10 lines of output]
  #18 964.7       running install
  #18 964.7       running build
  #18 964.7       running build_py
  #18 964.7       creating build
  #18 964.7       creating build/lib
  #18 964.7       creating build/lib/prophet
  #18 964.7       creating build/lib/prophet/stan_model
  #18 964.7       Importing plotly failed. Interactive plots will not work.
  #18 964.7       INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_dfdaf2b8ece8a02eb11f050ec701c0ec NOW.
  #18 964.7       error: command 'gcc' failed with exit status 1
  #18 964.7       [end of output]
  #18 964.7   
  #18 964.7   note: This error originates from a subprocess, and is likely not a problem with pip.
  #18 964.9 error: legacy-install-failure
  #18 964.9 
  #18 964.9 × Encountered error while trying to install package.
  #18 964.9 ╰─&gt; prophet
  #18 964.9 
  #18 964.9 note: This is an issue with the package mentioned above, not pip.
  #18 964.9 hint: See above for output from the failure.
  </code></pre>
  <p>In trial 2, I do not see specific errors but my build still fails.</p>
  <p>Has anyone tried building a clean image with prophet library ?</p>