prophet icon indicating copy to clipboard operation
prophet copied to clipboard

INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_dfdaf2b8ece8a02eb11f050ec701c0ec NOW.

Open luisv10 opened this issue 4 years ago • 4 comments

Im working in Red Hat servidor, this server doesnt have acces to internet, I installed manually Python3.6.8 and packages necesaries to fbprophet whit .tar files When I tried to install fbprophet have this issue INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_dfdaf2b8ece8a02eb11f050ec701c0ec NOW.

how i can solve? pystan=2.18

gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1) Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

g++ (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1) Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

GNU Make 4.2.1 Built for x86_64-redhat-linux-gnu Copyright (C) 1988-2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

Looking in indexes: http://pypi.python.org/simple/ Processing ./fbprophet-0.7.1.tar.gz Requirement already satisfied: Cython>=0.22 in /home/usrflens/.local/lib/python3.6/site-packages (from fbprophet==0.7.1) (0.29.21) Requirement already satisfied: cmdstanpy==0.9.5 in /home/usrflens/.local/lib/python3.6/site-packages (from fbprophet==0.7.1) (0.9.5) Requirement already satisfied: pystan>=2.14 in /home/usrflens/.local/lib/python3.6/site-packages (from fbprophet==0.7.1) (2.18.0.0) Requirement already satisfied: numpy>=1.15.4 in /home/usrflens/.local/lib/python3.6/site-packages (from fbprophet==0.7.1) (1.19.5) Requirement already satisfied: pandas>=1.0.4 in /home/usrflens/.local/lib/python3.6/site-packages (from fbprophet==0.7.1) (1.0.4) Requirement already satisfied: matplotlib>=2.0.0 in /home/usrflens/.local/lib/python3.6/site-packages (from fbprophet==0.7.1) (3.3.0) Requirement already satisfied: LunarCalendar>=0.0.9 in /home/usrflens/.local/lib/python3.6/site-packages (from fbprophet==0.7.1) (0.0.9) Requirement already satisfied: convertdate>=2.1.2 in /home/usrflens/.local/lib/python3.6/site-packages (from fbprophet==0.7.1) (2.1.2) Requirement already satisfied: holidays>=0.10.2 in /home/usrflens/.local/lib/python3.6/site-packages (from fbprophet==0.7.1) (0.10.4) Requirement already satisfied: setuptools-git>=1.2 in /home/usrflens/.local/lib/python3.6/site-packages (from fbprophet==0.7.1) (1.2) Requirement already satisfied: python-dateutil>=2.8.0 in /home/usrflens/.local/lib/python3.6/site-packages (from fbprophet==0.7.1) (2.8.0) Requirement already satisfied: tqdm>=4.36.1 in /home/usrflens/.local/lib/python3.6/site-packages (from fbprophet==0.7.1) (4.36.1) Requirement already satisfied: pytz>=2017.2 in /home/usrflens/.local/lib/python3.6/site-packages (from pandas>=1.0.4->fbprophet==0.7.1) (2017.2) Requirement already satisfied: cycler>=0.10 in /home/usrflens/.local/lib/python3.6/site-packages (from matplotlib>=2.0.0->fbprophet==0.7.1) (0.10.0) Requirement already satisfied: pillow>=6.2.0 in /home/usrflens/.local/lib/python3.6/site-packages (from matplotlib>=2.0.0->fbprophet==0.7.1) (7.1.2) Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /home/usrflens/.local/lib/python3.6/site-packages (from matplotlib>=2.0.0->fbprophet==0.7.1) (2.4.7) Requirement already satisfied: kiwisolver>=1.0.1 in /home/usrflens/.local/lib/python3.6/site-packages (from matplotlib>=2.0.0->fbprophet==0.7.1) (1.0.1) Requirement already satisfied: ephem>=3.7.5.3 in /home/usrflens/.local/lib/python3.6/site-packages (from LunarCalendar>=0.0.9->fbprophet==0.7.1) (3.7.7.1) Requirement already satisfied: six in /home/usrflens/.local/lib/python3.6/site-packages (from holidays>=0.10.2->fbprophet==0.7.1) (1.16.0) Requirement already satisfied: korean_lunar_calendar in /home/usrflens/.local/lib/python3.6/site-packages (from holidays>=0.10.2->fbprophet==0.7.1) (0.2.1) Requirement already satisfied: setuptools in /home/usrflens/.local/lib/python3.6/site-packages (from kiwisolver>=1.0.1->matplotlib>=2.0.0->fbprophet==0.7.1) (49.1.3) Installing collected packages: fbprophet Running setup.py install for fbprophet ... error Complete output from command /usr/local/bin/python3.6 -u -c "import setuptools, tokenize;file='/tmp/pip-req-build-tlnbtp_0/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-qa0c0dlr/install-record.txt --single-version-externally-managed --compile --user --prefix=: running install running build running build_py creating build creating build/lib creating build/lib/fbprophet creating build/lib/fbprophet/stan_model Importing plotly failed. Interactive plots will not work. DIAGNOSTIC(S) FROM PARSER: Warning: left-hand side variable (name=cp_idx) occurs on right-hand side of assignment, causing inefficient deep copy to avoid aliasing. Warning: left-hand side variable (name=m_pr) occurs on right-hand side of assignment, causing inefficient deep copy to avoid aliasing.

INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_dfdaf2b8ece8a02eb11f050ec701c0ec NOW.
/home/usrflens/.local/lib/python3.6/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/tmpcbgzy6b4/stanfit4anon_model_dfdaf2b8ece8a02eb11f050ec701c0ec_7057881772964718840.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-req-build-tlnbtp_0/setup.py", line 149, in <module>
    long_description_content_type='text/markdown',
  File "/home/usrflens/.local/lib/python3.6/site-packages/setuptools/__init__.py", line 165, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/local/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/usrflens/.local/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
    return orig.install.run(self)
  File "/usr/local/lib/python3.6/distutils/command/install.py", line 545, in run
    self.run_command('build')
  File "/usr/local/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.6/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/usr/local/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/tmp/pip-req-build-tlnbtp_0/setup.py", line 48, in run
    build_models(target_dir)
  File "/tmp/pip-req-build-tlnbtp_0/setup.py", line 38, in build_models
    StanBackendEnum.get_backend_class(backend).build_model(target_dir, MODEL_DIR)
  File "/tmp/pip-req-build-tlnbtp_0/fbprophet/models.py", line 214, in build_model
    sm = pystan.StanModel(model_code=model_code)
  File "/home/usrflens/.local/lib/python3.6/site-packages/pystan/model.py", line 356, in __init__
    self.module = load_module(self.module_name, lib_dir)
  File "/home/usrflens/.local/lib/python3.6/site-packages/pystan/model.py", line 51, in load_module
    return __import__(module_name)
ImportError: /tmp/tmpcbgzy6b4/stanfit4anon_model_dfdaf2b8ece8a02eb11f050ec701c0ec_7057881772964718840.cpython-36m-x86_64-linux-gnu.so: failed to map segment from shared object

----------------------------------------

Command "/usr/local/bin/python3.6 -u -c "import setuptools, tokenize;file='/tmp/pip-req-build-tlnbtp_0/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-qa0c0dlr/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-req-build-tlnbtp_0/

luisv10 avatar Sep 13 '21 15:09 luisv10

Hmm I'm not sure what the issue is here, it seems like it could be platform-specific and only for an older version (0.7.1).

Can you try installing pystan 2.19.1.1 and prophet instead of fbprophet, with pip? See https://github.com/facebook/prophet#installation-in-python

tcuongd avatar Oct 02 '21 11:10 tcuongd

I installed pystan 2.19.1.1 and am getting this exact same error when I try to pip install prophet. If it is platform-specific, I'm running this in wsl2 Ubuntu 20.04.

    ERROR: Command errored out with exit status 1:
     command: /home/linuxbrew/.linuxbrew/opt/[email protected]/bin/python3.8 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1ik5ew8v/prophet_a0d90915974a454d82216b457abde10c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-1ik5ew8v/prophet_a0d90915974a454d82216b457abde10c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-05efjie3/install-record.txt --single-version-externally-managed --compile --install-headers /home/linuxbrew/.linuxbrew/include/python3.8/prophet
         cwd: /tmp/pip-install-1ik5ew8v/prophet_a0d90915974a454d82216b457abde10c/
    Complete output (9 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib
    creating build/lib/prophet
    creating build/lib/prophet/stan_model
    INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_dfdaf2b8ece8a02eb11f050ec701c0ec NOW.
    error: command 'gcc-5' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/linuxbrew/.linuxbrew/opt/[email protected]/bin/python3.8 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1ik5ew8v/prophet_a0d90915974a454d82216b457abde10c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-1ik5ew8v/prophet_a0d90915974a454d82216b457abde10c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-05efjie3/install-record.txt --single-version-externally-managed --compile --install-headers /home/linuxbrew/.linuxbrew/include/python3.8/prophet Check the logs for full command output.

finsterdexter avatar Oct 24 '21 05:10 finsterdexter

Also get a similar error when trying to install dependencies that include prophet within a python:3.8.12-slim-bullseye image.

Getting:

#0 156.3   EnvCommandError
#0 156.3 
#0 156.3   Command ['/usr/local/bin/python', '-m', 'pip', 'install', '--no-deps', '/root/.cache/pypoetry/artifacts/79/19/3a/10d31aec104694870c38024e2987bbc708a0856a1ab3b13ab7659f1571/prophet-1.0.1.tar.gz'] errored with the following return code 1, and output: 
#0 156.3   Processing /root/.cache/pypoetry/artifacts/79/19/3a/10d31aec104694870c38024e2987bbc708a0856a1ab3b13ab7659f1571/prophet-1.0.1.tar.gz
#0 156.3     Preparing metadata (setup.py): started
#0 156.3     Preparing metadata (setup.py): finished with status 'done'
#0 156.3   Building wheels for collected packages: prophet
#0 156.3     Building wheel for prophet (setup.py): started
#0 156.3     Building wheel for prophet (setup.py): finished with status 'error'
#0 156.3     error: subprocess-exited-with-error
#0 156.3     
#0 156.3     × python setup.py bdist_wheel did not run successfully.
#0 156.3     │ exit code: 1
#0 156.3     ╰─> [10 lines of output]
#0 156.3         running bdist_wheel
#0 156.3         running build
#0 156.3         running build_py
#0 156.3         creating build
#0 156.3         creating build/lib
#0 156.3         creating build/lib/prophet
#0 156.3         creating build/lib/prophet/stan_model
#0 156.3         Importing plotly failed. Interactive plots will not work.
#0 156.3         INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_dfdaf2b8ece8a02eb11f050ec701c0ec NOW.
#0 156.3         error: command 'gcc' failed with exit status 1
#0 156.3         [end of output]
#0 156.3     
#0 156.3     note: This error originates from a subprocess, and is likely not a problem with pip.
#0 156.3     ERROR: Failed building wheel for prophet
#0 156.3     Running setup.py clean for prophet
#0 156.3   Failed to build prophet
#0 156.3   Installing collected packages: prophet
#0 156.3     Running setup.py install for prophet: started
#0 156.3     Running setup.py install for prophet: finished with status 'error'
#0 156.3     error: subprocess-exited-with-error
#0 156.3     
#0 156.3     × Running setup.py install for prophet did not run successfully.
#0 156.3     │ exit code: 1
#0 156.3     ╰─> [10 lines of output]
#0 156.3         running install
#0 156.3         running build
#0 156.3         running build_py
#0 156.3         creating build
#0 156.3         creating build/lib
#0 156.3         creating build/lib/prophet
#0 156.3         creating build/lib/prophet/stan_model
#0 156.3         Importing plotly failed. Interactive plots will not work.
#0 156.3         INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_dfdaf2b8ece8a02eb11f050ec701c0ec NOW.
#0 156.3         error: command 'gcc' failed with exit status 1
#0 156.3         [end of output]
#0 156.3     
#0 156.3     note: This error originates from a subprocess, and is likely not a problem with pip.
#0 156.3   error: legacy-install-failure
#0 156.3   
#0 156.3   × Encountered error while trying to install package.
#0 156.3   ╰─> prophet
#0 156.3   
#0 156.3   note: This is an issue with the package mentioned above, not pip.
#0 156.3   hint: See above for output from the failure.

even though I specify the required installation of pystan 2.19.1.1.

Dockerfile:

# syntax=docker/dockerfile:1
FROM python:3.8.12-slim-bullseye
ENV APP_HOME /app
WORKDIR $APP_HOME
# Allow statements and log messages to immediately appear in the Knative logs
ENV PYTHONUNBUFFERED True
ENV FLASK_APP=src/__main__.py
ENV FLASK_RUN_HOST=0.0.0.0
COPY pyproject.toml pyproject.toml
COPY poetry.lock poetry.lock
COPY .python-version .python-version
RUN apt-get update
RUN apt-get install gcc -y
RUN python -m pip install --upgrade pip
RUN pip install poetry==1.1.12
RUN poetry config virtualenvs.create false
RUN poetry install

with the following dependencies:

python = "^3.8"
pandas = "^1.4.2"
pystan = "2.19.1.1"
prophet = "^1.0.1"
darts = "^0.19.0"
black = "^22.3.0"
isort = "^5.10.1"
toml = "^0.10.2"
snapshottest = "^0.6.0"
pytest = "^7.1.1"
pylint = "^2.13.7"
nbqa = "^1.3.1"
mypy = "^0.942"
arrow = "^1.2.2"
Flask = "^2.1.1"
psycopg2 = "^2.9.3"
google-cloud-secret-manager = "^2.10.0"
colorlog = "^6.6.0"
google-cloud-logging = "^3.0.0"
google-cloud-storage = "^2.3.0"

pierresegonne avatar May 07 '22 14:05 pierresegonne

This has been resolved in prophet 1.1. You can now pip install prophet directly from PyPI

akosfurton avatar Jun 27 '22 14:06 akosfurton

Closing due to PyStan no longer being a dependency of prophet

WardBrian avatar Oct 12 '23 13:10 WardBrian