1

I have been trying to get scipy working on a Beanstalk application. Basically I have a python web app I am developing that uses Flask and a few other libraries including Scipy. In my project directory I have only 3 files. They are:

application.py
requirements.txt
.ebextensions/python.config

My application.py file is very simple and doesn't contain much of substance that could be causing my problems so will not paste the code in it here. My requirements.txt file contains the following:

Flask==0.10.1
itsdangerous==0.24
Jinja2==2.9.6
MarkupSafe==1.0
numpy==1.12.1
scipy==0.19.0
scikit-learn==0.18.1
sklearn==0.0
Werkzeug==0.12.2

and my .ebextensions/python.config file contains the following:

packages:  
  yum:
    make: []
    gcc-c++: []
    gcc-gfortran: []
    python-devel: []
    atlas-sse3-devel: []
    lapack-devel: []
    libpng-devel: []
    freetype-devel: []
    zlib-devel: []
container_commands:  
  AddGlobalWSGIGroupAccess: 
    command: "if ! grep -q 'WSGIApplicationGroup %{GLOBAL}' ../wsgi.conf ; then echo 'WSGIApplicationGroup %{GLOBAL}' >> ../wsgi.conf; fi;"

I basically just set up the flask app and get it working locally before using the Elastic Beanstalk cli on my mac to try and send my local app to Beanstalk and have it run as a website. So after i have done all the pip installs and an eb init I do the following in my terminal:

eb create flask-env

This runs for a bit but then fails giving the following error:

ERROR: Your requirements.txt is invalid. Snapshot your logs for details.
ERROR: [Instance: i-00b93584dae09f4d2] Command failed on instance. Return code: 1 Output: (TRUNCATED)...)
  File "/usr/lib64/python2.7/subprocess.py", line 541, in check_call
    raise CalledProcessError(retcode, cmd)

I then check my eb-activity.log file to try and get a better understanding of the problem. In the eb-activity.log is so much stuff that looks like it has to do with this error but some of the most helpful error messages in the log file are the following:

File "scipy/linalg/setup.py", line 20, in configuration
          raise NotFoundError('no lapack/blas resources found')
      numpy.distutils.system_info.NotFoundError: no lapack/blas resources found

 lapack_info:
        libraries lapack not found in ['/opt/python/run/venv/lib', '/usr/local/lib64', '/usr/local/lib', '/usr/lib64', '/usr/lib']
        NOT AVAILABLE

openblas_lapack_info:
        libraries openblas not found in ['/opt/python/run/venv/lib', '/usr/local/lib64', '/usr/local/lib', '/usr/lib64', '/usr/lib']
        NOT AVAILABLE

As you can tell these error messages in the logs are pretty verbose and hard to interpret. After googling around I thought my problem was stemming from scipy (and perhaps numpy) having a bunch of dependencies that are not Python related which pip does not handle.

I thought based on some other answers i found that my .ebextensions/python.config would fix this problem but it does not seem to - nor does it even appear in my directory as it starts with a '.'. Am I doing something small slightly wrong or what?

Update: I am on mac OS if that matters too. I found some stuff that sort of looked helpful at the link suggested in the comments but this seems out dated (as per the comments on the answer) and not specific to mac OS and thus seems kind of useless.

sometimesiwritecode
  • 2,993
  • 7
  • 31
  • 69
  • This answer might help: https://stackoverflow.com/a/14639949/4638378 – Brian Jun 05 '17 at 14:32
  • Your last block of error is pretty easy to interpret. Info 1: `NotFoundError: no lapack/blas resources found`. Info 2: `library lapack not found in [places where it should be]`. Info 3: `libraries openblas not found in [places where it should be]`. These indeed suggest that lapack/blas is a missing dependency for scipy. – Andras Deak -- Слава Україні Jun 06 '17 at 00:16
  • @AndrasDeak if you want to post that as an answer i am trying it now and will accept it if it works! – sometimesiwritecode Jun 06 '17 at 00:17
  • I don't know anything about beanstalk nor macs, and frankly I don't think this info deserves the rep:) You've probably found it by now but anyway: there are some hints for the dependencies [here](https://www.scipy.org/scipylib/building/macosx.html) – Andras Deak -- Слава Україні Jun 06 '17 at 00:19
  • As suggested in https://stackoverflow.com/a/14639949/4638378, did you try installing `lapack-devel` and `blas-devel`? – Brian Jun 06 '17 at 14:40
  • @Brian i am having a little trouble installing them on my beanstalk environment VS locally- any ideas how to do that? – sometimesiwritecode Jun 06 '17 at 18:11
  • Did you try adding them to the `packages: yum:` section of `.ebextensions/python.config`? Since your EB environment is Linux, figuring out how to get your local Mac environment working isn't particularly relevant. – Brian Jun 06 '17 at 19:32

1 Answers1

1

You're just missing a few dependencies. Try using homebrew for development on your mac:

brew install numpy --with-openblas
brew install scipy --with-openblas

Theano has similar dependencies and provides a few methods for installation in various environments: http://deeplearning.net/software/theano/install_macos.html

Aidan Hoolachan
  • 2,285
  • 1
  • 11
  • 14