Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIP Installation issue on some linux / docker environment #326

Closed
raychew13 opened this issue Oct 10, 2017 · 12 comments
Closed

PIP Installation issue on some linux / docker environment #326

raychew13 opened this issue Oct 10, 2017 · 12 comments
Labels
Milestone

Comments

@raychew13
Copy link

I've been using fbprophet in my local dev environment (Mac) for a while for forecasting purpose and It's AWESOME.

I'm planning to run my forecasting engine on EC2. But I have issue with installing the fbprophet. I've also managed to reproduce the installation issue on my docker container. Below is the command that I used to test the installation of the fbprophet library in the runtime docker container.
docker run --rm -i -t python:3.6.0 bash -c "pip install fbprophet==0.2"

I'm using python3.6 docker image from docker-hub. Just wondering if there is any issue with the specific version of gcc. I've also checked the version of gcc installed in python3.6 docker image. It has gcc (Debian 4.9.2-10) 4.9.2

Below is the error.

Installing collected packages: pyparsing, six, cycler, numpy, python-dateutil, pytz, matplotlib, pandas, Cython, pystan, 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-build-6027ivd3/fbprophet/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-khm0g75a-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib
    creating build/lib/fbprophet
    creating build/lib/fbprophet/stan_models
    INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_1fdd477dd8bcc50395c4e25c8741f1c1 NOW.
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/local/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-6027ivd3/fbprophet/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-khm0g75a-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-6027ivd3/fbprophet/

@bletham
Copy link
Contributor

bletham commented Oct 11, 2017

I'm not certain what the issue is but one issue that has come up before in VMs is that it actually requires a lot of RAM to compile the models. Does this instance have >2GB of RAM?

@raychew13
Copy link
Author

Hi Ben,
Thanks for the response.
The issue is in the installation of fbprophet library in the docker container. If you are using docker in your local machine, you can easily reproduce the issue by running the below command.

docker run --rm -i -t python:3.6.0 bash -c "pip install fbprophet==0.2"

Please let me know if you have additional information.

Regards,
Ray

@ghost
Copy link

ghost commented Oct 17, 2017 via email

@bletham
Copy link
Contributor

bletham commented Oct 17, 2017

@robertdknight Thanks for the details on the RAM requirements. I updated the description in the docs to include the 4GB install requirement (d1bf4a1).

@dtourillon
Copy link

Based on the error traces I see in the initial issue's description, I seem to have the same problem when trying to install fbprophet on my laptop with 16G of RAM.

@raychew13 : was your problem related to RAM?

@bletham : any other idea as to what could be causing the problem, apart from insufficient RAM?

See #346 for the ticket I've created for my issue, before finding this one.

bletham added a commit that referenced this issue Nov 8, 2017
* Update memory requirement description per #326

* Fix R warning with extra regressor; disallow constant extra regressors.

* Fix unit test broken in new pandas

* Fix diagnostics unit tests for new pandas

* Fix copy with extra seasonalities / regressors Py

* Fix copy with extra seasonalities / regressors R

* Fix weekly_start and yearly_start in R plot_components

* Fix plotting in pandas 0.21 by using pydatetime instead of numpy
@CarstVaartjes
Copy link

CarstVaartjes commented Nov 17, 2017

Hi,

I have a similar issue, but doing this on a local docker image of amazonlinux:2017.03 where my laptop has ubuntu 17.10 and 32gb, so I'm hesitant to think that it's a memory issue.

Building wheels for collected packages: fbprophet
  Running setup.py bdist_wheel for fbprophet ... error
  Complete output from command /sklearn_build/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-zXYmeu/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/tmpljkJYmpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib
  creating build/lib/fbprophet
  creating build/lib/fbprophet/stan_models
  INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_1fdd477dd8bcc50395c4e25c8741f1c1 NOW.
  error: command 'gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for fbprophet
  Running setup.py clean for fbprophet
Failed to build fbprophet
Installing collected packages: fbprophet
  Running setup.py install for fbprophet ... error
    Complete output from command /sklearn_build/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-zXYmeu/fbprophet/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-s6Sfs4-record/install-record.txt --single-version-externally-managed --compile --install-headers /sklearn_build/include/site/python2.7/fbprophet:
    running install
    running build
    running build_py
    creating build
    creating build/lib
    creating build/lib/fbprophet
    creating build/lib/fbprophet/stan_models
    INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_1fdd477dd8bcc50395c4e25c8741f1c1 NOW.
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "/sklearn_build/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-zXYmeu/fbprophet/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-s6Sfs4-record/install-record.txt --single-version-externally-managed --compile --install-headers /sklearn_build/include/site/python2.7/fbprophet" failed with error code 1 in /tmp/pip-build-zXYmeu/fbprophet/

From what I understand, docker doesn't limit the memory usage of a container in Linux, so what could it be then?

Edit: I just saw #346 and tried the example code there.

>>> model = pystan.StanModel(model_code=model_code)
INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_5944b02c79788fa0db5b3a93728ca2bf NOW.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/sklearn_build/lib64/python2.7/site-packages/pystan/model.py", line 313, in __init__
    build_extension.run()
  File "/usr/lib64/python2.7/distutils/command/build_ext.py", line 339, in run
    self.build_extensions()
  File "/usr/lib64/python2.7/distutils/command/build_ext.py", line 448, in build_extensions
    self.build_extension(ext)
  File "/usr/lib64/python2.7/distutils/command/build_ext.py", line 498, in build_extension
    depends=ext.depends)
  File "/usr/lib64/python2.7/distutils/ccompiler.py", line 574, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "/usr/lib64/python2.7/distutils/unixccompiler.py", line 134, in _compile
    raise CompileError, msg
distutils.errors.CompileError: command 'gcc' failed with exit status 1

So the issue is pystan here and not fbprophet, but i do have gcc installed: Package gcc-4.8.5-1.22.amzn1.noarch already installed and latest version

Will check for known pystan issues with docker/amazon linux

See also: stan-dev/pystan#219
Going back to cython 0.22 from 0.27.3 did not help. So it must be something else...

It seems to be a gcc issue such as here: stan-dev/pystan#395

edit: I solved it by uninstall gcc and then:

yum install gcc64
yum install gcc64-c++

After that everything was in sync; apparently pystan doesn't like gcc<5 and I ended up with GCC 4 & 6 at the same time which confused cython amongst others.

@bletham
Copy link
Contributor

bletham commented Nov 17, 2017

Great to hear a solution, thanks! It looks like we should add to the linux installation instructions to check that gcc is 6 or higher?

@ghost
Copy link

ghost commented Nov 20, 2017 via email

bletham added a commit that referenced this issue Dec 23, 2017
* Update memory requirement description per #326

* Fix R warning with extra regressor; disallow constant extra regressors.

* Fix unit test broken in new pandas

* Fix diagnostics unit tests for new pandas

* Fix copy with extra seasonalities / regressors Py

* Fix copy with extra seasonalities / regressors R

* Fix weekly_start and yearly_start in R plot_components

* Fix plotting in pandas 0.21 by using pydatetime instead of numpy

* Version bump

* Update README for new version

* Fix missing columns in SHF with extra regressor
@bletham bletham added this to the v0.3-release milestone May 25, 2018
@bletham bletham added the ready label May 28, 2018
@bletham
Copy link
Contributor

bletham commented Jun 7, 2018

I updated the install instructions for Red Hat to include gcc64, hopefully that helps others but I'm going to go ahead and close this issue and just point others with Linux install issues here in the future.

@bletham bletham closed this as completed Jun 7, 2018
@Gypsying
Copy link

I met the same problems when i pip install fbprophet:
CompileError: command 'gcc' failed with exit status 1

my env :
centos 7.2
Python 3.6
numpy 1.16.2
cython 0.29.7
pystan 2.19.0.0

I change the pystan to 2.18.1.0 solve the problems.

@bletham
Copy link
Contributor

bletham commented Apr 17, 2019

hm I'm not sure what might be happening there. I just installed pystan 2.19 and pip install fbprophet went smoothly after that.
I wonder if maybe something went wrong in the pystan 2.19 installation. I'm glad it's working now, but if you are interested in further debugging I'd be interested to know if the following code runs in pystan 2.19:

import pystan
model_code = 'parameters {real y;} model {y ~ normal(0,1);}'
model = pystan.StanModel(model_code=model_code)  # this will take a minute
y = model.sampling(n_jobs=1).extract()['y']
y.mean()  # should be close to 0

@bletham
Copy link
Contributor

bletham commented Apr 18, 2019

Actually it looks like the integration tests on Travis are now failing for the same reason, and was also fixed by setting pystan<=2.18.1. I'm opening an issue for it in #930

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants