on 02-08-2019 3:10 PM
Hello,
I can't push a python application in SAP Cloud Foundry. I have problems installing the numpy and scikit-fuzzy packages. The application has the following requirements.
requirements.txt
Flask==1.0.2
numpy==1.16.1
scikit-fuzzy==0.4.0
runtime.txt
python-3.6.8
manifest.yml
---
applications:
- name: pyapp
memory: 128M
disk_quota: 256M
path: .
command: python server.py
buildpacks:
- https://github.com/cloudfoundry/python-buildpack
By running cf logs pyapp --recent I get the following:
2019-02-08T10:15:09.83-0400 [API/5] OUT Updated app with guid 6e395c32-5392-4517-9d48-01eca041e9b1 ({"buildpack"=>"https://github.com/cloudfoundry/python-buildpack", "command"=>"[PRIVATE DATA HIDDEN]", "disk_quota"=>256, "health_check_http_endpoint"=>"", "health_check_type"=>"port", "instances"=>1, "memory"=>128, "name"=>"pyapp", "space_guid"=>"49f9beb7-ae91-4202-bb17-300b529310d1"})
2019-02-08T10:15:10.19-0400 [API/0] OUT Uploading bits for app with guid 6e395c32-5392-4517-9d48-01eca041e9b1
2019-02-08T10:15:14.70-0400 [API/4] OUT Creating build for app with guid 6e395c32-5392-4517-9d48-01eca041e9b1
2019-02-08T10:15:14.80-0400 [API/4] OUT Updated app with guid 6e395c32-5392-4517-9d48-01eca041e9b1 ({"state"=>"STARTED"})
2019-02-08T10:15:14.89-0400 [STG/0] OUT Cell bd568339-1521-47aa-b578-839e02352a93 creating container for instance 856d14a4-ece8-4564-a37d-c66bb3edf612
2019-02-08T10:15:15.20-0400 [STG/0] OUT Cell bd568339-1521-47aa-b578-839e02352a93 successfully created container for instance 856d14a4-ece8-4564-a37d-c66bb3edf612
2019-02-08T10:15:15.37-0400 [STG/0] OUT Downloading app package...
2019-02-08T10:15:15.42-0400 [STG/0] OUT Downloaded app package (4K)
2019-02-08T10:15:16.92-0400 [STG/0] OUT -----> Download go 1.11.4
2019-02-08T10:15:22.83-0400 [STG/0] OUT -----> Running go build supply
2019-02-08T10:15:22.83-0400 [STG/0] OUT /tmp/buildpackdownloads/fe158333cd0331a0073936bf6f26e45e ~
2019-02-08T10:15:27.02-0400 [STG/0] OUT ~
2019-02-08T10:15:27.02-0400 [STG/0] OUT -----> Python Buildpack version 1.6.28
2019-02-08T10:15:27.02-0400 [STG/0] OUT -----> Supplying Python
2019-02-08T10:15:27.02-0400 [STG/0] OUT -----> Installing python 3.6.8
2019-02-08T10:15:27.02-0400 [STG/0] OUT Download [https://buildpacks.cloudfoundry.org/dependencies/python/python-3.6.8-linux-x64-cflinuxfs3-0e8b91a8.tgz]
2019-02-08T10:15:30.23-0400 [STG/0] OUT -----> Installing pip-pop 0.1.3
2019-02-08T10:15:30.23-0400 [STG/0] OUT Download [https://buildpacks.cloudfoundry.org/dependencies/manual-binaries/pip-pop/pip-pop-0.1.3-fc106ef6.tar.gz]
2019-02-08T10:15:34.37-0400 [STG/0] OUT -----> Running Pip Install
2019-02-08T10:15:34.80-0400 [STG/0] OUT Collecting Flask==1.0.2 (from -r /tmp/app/requirements.txt (line 1))
2019-02-08T10:15:34.90-0400 [STG/0] OUT Downloading https://files.pythonhosted.org/packages/7f/e7/08578774ed4536d3242b14dacb4696386634607af824ea997202cd... (91kB)
2019-02-08T10:15:34.93-0400 [STG/0] OUT Collecting numpy==1.16.1 (from -r /tmp/app/requirements.txt (line 2))
2019-02-08T10:15:35.24-0400 [STG/0] OUT Downloading https://files.pythonhosted.org/packages/f5/bf/4981bcbee43934f0adb8f764a1e70ab0ee5a448f6505bd04a87a2f... (17.3MB)
2019-02-08T10:15:36.04-0400 [STG/0] OUT Collecting scikit-fuzzy==0.4.0 (from -r /tmp/app/requirements.txt (line 3))
2019-02-08T10:15:36.06-0400 [STG/0] OUT Downloading https://files.pythonhosted.org/packages/09/36/4938f22f99ea415ef6b9f831b36057e1cb6bac3783f35a54a99da9... (994kB)
2019-02-08T10:15:36.37-0400 [STG/0] OUT Complete output from command python setup.py egg_info:
2019-02-08T10:15:36.37-0400 [STG/0] OUT To install scikit-fuzzy from source, you will need numpy.
2019-02-08T10:15:36.37-0400 [STG/0] OUT Install numpy with pip:
2019-02-08T10:15:36.37-0400 [STG/0] OUT pip install numpy
2019-02-08T10:15:36.37-0400 [STG/0] OUT Or use your operating system package manager.
2019-02-08T10:15:36.37-0400 [STG/0] OUT
2019-02-08T10:15:36.37-0400 [STG/0] OUT ----------------------------------------
2019-02-08T10:15:36.41-0400 [STG/0] ERR Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-fzpbncb3/scikit-fuzzy/
2019-02-08T10:15:36.47-0400 [STG/0] ERR You are using pip version 18.1, however version 19.0.1 is available.
2019-02-08T10:15:36.47-0400 [STG/0] ERR You should consider upgrading via the 'pip install --upgrade pip' command.
2019-02-08T10:15:36.51-0400 [STG/0] OUT [31;1m**ERROR**[0m Could not install pip packages: could not run pip: exit status 1
2019-02-08T10:15:36.86-0400 [STG/0] ERR Failed to compile droplet: Failed to run all supply scripts: exit status 14
2019-02-08T10:15:36.87-0400 [STG/0] OUT Exit status 223
2019-02-08T10:15:37.26-0400 [STG/0] OUT Cell bd568339-1521-47aa-b578-839e02352a93 stopping instance 856d14a4-ece8-4564-a37d-c66bb3edf612
2019-02-08T10:15:37.26-0400 [STG/0] OUT Cell bd568339-1521-47aa-b578-839e02352a93 destroying container for instance 856d14a4-ece8-4564-a37d-c66bb3edf612
2019-02-08T10:15:41.03-0400 [STG/0] OUT Cell bd568339-1521-47aa-b578-839e02352a93 successfully destroyed container for instance 856d14a4-ece8-4564-a37d-c66bb3edf612
I would appreciate your help, I don't know what else to do.
Hi Luis,
I believe the best solution to this issue is to deploy your application using miniconda with the standard buildpack. I've tested it on the same application I shared above and it works. Here is how you do it:
- Remote the files: requirements.txt & runtime.txt from your project folder
- Create a file named: environment.yml with the following contents:
name: flask-skfuzzy
channels:
- conda-forge
dependencies:
- python=3.6
- pip
- pytest
- icu == 56.*
- flask
- numpy
- nomkl
- scipy
- matplotlib
- scikit-fuzzy
This approach use miniconda to install the dependencies. This has a caveat: the package numpy via miniconda requires a lot of disk space. Therefore, you would also need to change your manifest.yml to allow for a larger disk quota:
---
applications:
- name: flask-skfuzzy
memory: 512MB
disk_quota: 2G
buildpack: python_buildpack
stack: cflinuxfs3
NOTE: I didn't figure out the optimal disk size for my project - thus 2G my be larger than what's really required.
I'm updating the git repository with such files for your convenience.
Enjoy!
Best regards,
Ivan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello, Ivan,
I did everything you suggested and it worked perfectly. Everything was installed without any problem. Finally my configuration files stayed this way.
manifest.yml
---
applications:
- name: fuzzy-test
memory: 64MB
disk_quota: 1.5GB
path: .
command: python server.py
stack: cflinuxfs3
buildpacks:
- https://github.com/cloudfoundry/python-buildpack
runtime.txt
python-3.6
environment.yml
name: fuzzy-alarm
channels:
- conda-forge
dependencies:
- pip==19.0.1
- Flask==1.0.2
- numpy==1.16.1
- scikit-fuzzy==0.4.0
I appreciate all your help, thank you very much. Best regards,
Luis
Hi Luis,
Apparently the buildpack is not being able to install both numpy and skfuzzy at the same time - because of inter dependencies.
The current python buildpack from CF is not able to do it and I am not sure why this is happening. It sounds like the culprit is either pip or setuptools - as both are really old on this particular buildpack. I've read at Pivotal bug track system that newer pip version have some private methods that are incompatible with the way the parse the requirements.txt file.
However, not all hope is lost. I've fund another buildpack based on heroku's that allows you to have numpy and scipy. But there is a caveat on how to install skfuzzy on to it.
First you need to change the change the stack to cflinuxfs2 and then supply the buildpack within the manifest.yml. Next comment (with a '#' char) skfuzzy requirement and push it to CF. This will install numpy on your application's filesystem. I am not sure why, but this particular buildpack takes the previously deployed app and avoids reinstalling python packages that were previously installed. Once this is done, your application will fail because skfuzzy is not there yet. Don't worry, add it to the requirement.txt and deploy your app once more.
This procedure should solve your problem and it is a one-time thing. Once your app gets deployed with all dependencies it will accept further changes to py files without reinstalling the requirements that were already deployed into your app filesystem.
I've shared my fuzzy project on git with my PoC containing a program that implements Flask + NumPy + SciPy + MatPlotLib + SciKit-Fuzzy - with the example from skfuzzy. (remember to comment skfuzzy the first time you deploy it).
Best regards,
Ivan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ivan,
This method works perfect and it consume less disk quota. Thank you very much.
Best regards,
Luis
Hi Luis Leon,
I am trying to figure out how to deploy numpy and other pre requisites on a standard buildpack from Cloud Foundry. I have managed to fork the standard Python BuildPack and incremented the startup procedure with the required pip commands to install numpy before it tries to install the other dependencies from the "requirements.txt". It works!
However, it is very rudimentary and it is installing numpy, matplotlib and scipy without specifying their versions.
I wanted to figure out how to deploy them via a "pre_requirements.txt" file - just like it is done on other buildpacks out there.
If you are interested, you could use my fork on your other tests.
buildpacks:
- https://github.com/ivanmir/python-buildpack#numpy<br>;
The "#numpy" suffix is a branch on my fork that contains the modifications I've done to this particular buildpack.
If I make any further changes on this fork I'll do it on another branch so it doesn't mess with anything while other may be testing this forked buildpack.
Best regards,
Ivan
Hi Luis,
this is definitely I tough one 🤔 I spent some time to reproduce your issue.
You're doing everything right, the problem seems to be the scikit-fuzzy package.
I'm not able to install it on my local machine either, so I guess the package is correcupted.
Were you able to install it locally?
Regards,
Marius
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.