I have developed a Flask web application that works on my local computer but which I am now trying to port onto the web (via IBM Bluemix). My first attempt to do so was unsuccessful. The error message I receive is:
Server error, status code: 400, error code: 170001, message: Staging error: no available stagers
When I check the log files with cf logs myapp --recent I find:
2015-11-08T15:34:15.92-0500 [STG/35] OUT -----> Downloaded app package (72K)
2015-11-08T15:34:19.98-0500 [STG/35] OUT -----> Downloaded app buildpack cache (39M)
2015-11-08T15:34:24.82-0500 [STG/0] OUT -------> Buildpack version 1.3.1
2015-11-08T15:34:40.57-0500 [STG/0] OUT -----> Installing dependencies with pip
2015-11-08T15:34:41.54-0500 [STG/0] OUT You are using pip version 6.1.0.dev0, however version 7.1.2 is available.
2015-11-08T15:34:41.54-0500 [STG/0] OUT You should consider upgrading via the 'pip install --upgrade pip' command.
2015-11-08T15:34:41.56-0500 [STG/0] OUT Collecting flask.ext.wtf (from -r requirements.txt (line 2))
2015-11-08T15:34:41.88-0500 [STG/0] OUT Could not find a version that satisfies the requirement flask.ext.wtf (from -r requirements.txt (line 2)) (from versions: )
2015-11-08T15:34:41.88-0500 [STG/0] OUT No matching distribution found for flask.ext.wtf (from -r requirements.txt (line 2))
2015-11-08T15:34:41.96-0500 [STG/0] OUT Staging failed: Buildpack compilation step failed
2015-11-08T15:34:41.97-0500 [STG/0] ERR
2015-11-08T15:34:42.67-0500 [API/2] ERR encountered error: App staging failed in the buildpack compile phase
2015-11-08T15:35:37.75-0500 [API/3] OUT Updated app with guid b580bb64-4415-4bb4-8fd1-1e4d3de4f7d9 ({"name"=>"cultural-insight", "memory"=>128, "environment_json"=>"PRIVATE DATA HIDDEN"})
2015-11-08T15:35:49.95-0500 [API/3] OUT Updated app with guid b580bb64-4415-4bb4-8fd1-1e4d3de4f7d9 ({"state"=>"STOPPED"})
2015-11-08T15:35:52.41-0500 [DEA/113] OUT Got staging request for app with id b580bb64-4415-4bb4-8fd1-1e4d3de4f7d9
2015-11-08T15:35:52.47-0500 [API/0] ERR exception handling first response Staging error: failed to stage application:
2015-11-08T15:35:52.47-0500 [API/0] ERR Not enough memory resources available
2015-11-08T15:50:52.42-0500 [API/0] ERR encountered error: Staging error: failed to stage application: staging had already been marked as failed, this could mean that staging took too long
The problem appears to be that pip can't find Flask-WTF, which I need for my application to work.
I installed Flask-WTF on my local machine with pip install Flask-WTF. The contents of requirements.txt, which the builder ingests while setting up, is simply:
Flask==0.10.1
Flask-WTF
In particular, I am unsure why pip is asking for flask.ext.wtf? Additionally it is troubling me that the application says it is limited to 128 MB, when I bumped it up to 512 MB.
Altogether, I'm not sure what's going on. How do I resolve this issue? The full source code is here.
run this (EDITED):
pip install --upgrade pip
and update your requirements.txt file:
pip freeze > requirements.txt
Related
I am trying to deploy a basic web application using Elastic Beanstalk from AWS.
My app is written in python and uses pyTorch library so it can import NLP model named "bart-cnn-large" (with it I can produce text summarization).
I have a file named requirements.txt and with it the EC2 sets the virtual environment.
However, it always fails when trying to install the pytorch library.
If I remove "torch" from the requirements.txt then the installation doesn't fail anymore.
but I get this message:
None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models
won't be available and only tokenizers, configuration and file/data
utilities can be used.
If I leave "torch" in requirements I get this message:
2021/08/06 10:54:23.688955 [ERROR] An error occurred during execution
of command [app-deploy] - [InstallDependency]. Stop running the
command. Error: fail to install dependencies with requirements.txt
file with error Command /bin/sh -c
/var/app/venv/staging-LQM1lest/bin/pip install -r requirements.txt
failed with error exit status 1. Stderr:ERROR: Invalid requirement:
'torch==1.9.0+cu102 torchvision==0.10.0+cu102 torchaudio===0.9.0'
(from line 1 of requirements.txt)
the requirments.txt content:
>torch==1.9.0+cu102 torchvision==0.10.0+cu102 torchaudio===0.9.0 -f
https://download.pytorch.org/whl/torch_stable.html
Flask~=2.0.1
Werkzeug~=2.0.1
tika~=1.24
beautifulsoup4~=4.8.2
docx2txt~=0.8
transformers~=4.8.2
clean-text
I tried several versions of "pip torch" but none seems to work.
is this a storage problem? why won't it install?
I installed django-user-visit with pip install django-user-visit , tested it in my local environment and everything seems to work fine, but when i try to deploy my app to production with Heroku i get the following error :
remote: Collecting django-cors-headers==3.6.0
remote: Downloading django_cors_headers-3.6.0-py3-none-any.whl (12 kB)
remote: ERROR: Could not find a version that satisfies the requirement django-user-visit==0.4.1 (from -r /tmp/build_940d12d0/requirements.txt (line 4)) (from versions: none)
remote: ERROR: _No matching distribution_ found for django-user-visit==0.4.1 (from -r /tmp/build_940d12d0/requirements.txt (line 4))
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
Does anyone know why Heroku can't find the package and if i can fix this ?
My packages are being installed by running the libraries indicated in my requirements.txt file:
asgiref==3.3.1
Django==3.1.5
django-cors-headers==3.6.0
django-user-visit==0.4.1
djangorestframework==3.12.2
gunicorn==20.0.4
psycopg2==2.8.6
pytz==2020.5
sqlparse==0.4.1
ua-parser==0.10.0
user-agents==2.2.0
whitenoise==5.2.0
What i've tried so far is to change the version to 0.4 and to not specify a version at all
From the documentation: https://devcenter.heroku.com/articles/python-runtimes
If you’re running a Python application that requires a different supported runtime, or if you simply want to lock your project against patch updates until you’re ready to upgrade, you can specify which runtime to use for your app.
To specify a Python runtime, add a runtime.txt file to your app’s root directory that declares the exact version number to use.
after that
pip freeze > requirements.txt
I'm trying to deploy my Django application to Beanstalk but my app health is Degraded for some reason. The log file is also deleted automatically so I cannot read the error.
But when I click on "Cause", I get this message:
Command failed on all instances.
Incorrect application version found on all instances. Expected version "app-fc04-XXXX" (deployment XXX).
Application deployment failed at 2020-07-29T07:24:43Z with exit status 1 and error: Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py failed.
It's also worth noting that the failure is happening when trying to install from requirements.txt, here's the error:
Application deployment failed at 2020-07-29T07:24:43Z with exit status 1 and error: Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py failed.
Collecting alphabet-detector==0.0.7 (from -r /opt/python/ondeck/app/requirements.txt (line 1))
Using cached https://files.pythonhosted.org/packages/f8/89/c9ab40530fb9142890a79bf39b6f2ee47c311729358794719acd15974e68/alphabet-detector-0.0.7.tar.gz
Collecting argcomplete==1.10.0 (from -r /opt/python/ondeck/app/requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/4d/82/f44c9661e479207348a979b1f6f063625d11dc4ca6256af053719bbb0124/argcomplete-1.10.0-py2.py3-none-any.whl
I've tried rebooting the instance, deploying an old working version, and deleting the EC2 instance but none of them work.
I'm following AWS Elastic Beanstalk's Flask tutorial to deploy the sample application.
Though I get error Your requirements.txt is invalid - in full as below. I google for this error though I get no helpful solution for me.
My requirements.txt file is pasted in below sections. And I'm using Ubuntu Desktop 16.04
As you may succeed the deployment following the tutorial, please share. Thank you.
Error
ERROR: Your requirements.txt is invalid. Snapshot your logs for details.
ERROR: [Instance: i-c78c8f57] Command failed on instance. Return code: 1 Output: (TRUNCATED)...)
File "/usr/lib64/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
CalledProcessError:
Command
'/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt'
returned non-zero exit status 1.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py failed.
For more detail, check /var/log/eb-activity.log using console or EB CLI.
INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
WARN: Environment health has transitioned from Pending to Degraded. Command failed on all instances. Initialization completed 45 seconds ago and took 3 minutes.
ERROR: Create environment operation is complete, but with errors. For more information, see troubleshooting documentation.
requirements.txt
click==6.6
Flask==0.11.1
itsdangerous==0.24
Jinja2==2.8
MarkupSafe==0.23
pkg-resources==0.0.0
Werkzeug==0.11.10
I tested locally and was able to replicate your problem. To get more information about what went wrong on instance I used eb logs to view the logs currently on the EC2 instances. From that I was able to see the full stack in the eb-activity.log
Collecting pkg-resources==0.0.0 (from -r /opt/python/ondeck/app/requirements.txt (line 4))
Could not find a version that satisfies the requirement pkg-resources==0.0.0 (from -r /opt/python/ondeck/app/requirements.txt (line 4)) (from versions: )
No matching distribution found for pkg-resources==0.0.0 (from -r /opt/python/ondeck/app/requirements.txt (line 4))
I'm not sure where the pkg-resources=0.0.0 came from but it's not a valid package in pip. I was able to delete that line and deploy successfully.
You may want to verify the output of your pip freeze and see if that library is actually there.
To preface, I have already seen this question Is it possible to use pip to install a package from a private github repository?
I am trying to install a package from a private repository that I have access to using pip.
I am able to directly clone it like so:
(myenv)robbie#ubuntu:~/git$ git clone git#github.com:matherbk/django-messages.git
Cloning into 'django-messages'...
remote: Counting objects: 913, done.
remote: Compressing objects: 100% (345/345), done.
remote: Total 913 (delta 504), reused 913 (delta 504)
Receiving objects: 100% (913/913), 165.73 KiB, done.
Resolving deltas: 100% (504/504), done.
But when I try to install it via pip (my virtualenv is activated):
(myenv)robbie#ubuntu:~/git$ pip install git+https://git#github.com/matherbk/django-messages.gitDownloading/unpacking git+https://git#github.com/matherbk/django-messages.git
Cloning https://git#github.com/matherbk/django-messages.git to /tmp/pip-13ushS-build
Password for 'https://git#github.com':
fatal: Authentication failed
Complete output from command /usr/bin/git clone -q https://git#github.com/matherbk/django-messages.git /tmp/pip-13ushS-build:
----------------------------------------
Command /usr/bin/git clone -q https://git#github.com/matherbk/django-messages.git /tmp/pip-13ushS-build failed with error code 128 in None
Storing complete log in /home/robbie/.pip/pip.log
I tried typing in my password but it failed. However I am ssh authenticated for git#github.com:
(myenv)robbie#ubuntu:~/git$ ssh -T git#github.com
Hi robpodosek! You've successfully authenticated, but GitHub does not provide shell access.
I can switch git#github.com to robpodosek#github.com and it lets me install via pip just fine:
(myenv)robbie#ubuntu:~/git$ pip install git+https://robpodosek#github.com/matherbk/django-messages.git
Downloading/unpacking git+https://robpodosek#github.com/matherbk/django-messages.git
Cloning https://robpodosek#github.com/matherbk/django-messages.git to /tmp/pip-SqEan9-build
Password for 'https://robpodosek#github.com':
Running setup.py egg_info for package from git+https://robpodosek#github.com/matherbk/django-messages.git
warning: no files found matching 'README'
Installing collected packages: django-messages
Running setup.py install for django-messages
warning: no files found matching 'README'
Successfully installed django-messages
Cleaning up...
However I want to do what the first mentioned article does by using git#github.com so that I don't have to add my username into a requirements.txt file and add that to version control.
Any thoughts? I previously had this working but had to boot up a fresh image. Thanks ahead of time.
It worked by using oxyum's suggestion of changing the : to a /:
pip install git+ssh://git#github.com/matherbk/django-messages.git
Make sure you use github.com/account instead of github.com:account
see Git+SSH dependencies have subtle (yet critical) differences from git clone
Had virtualenv activated and had to install a series of applications from github.com from a text file.
(venv)$ cat requirements.txt
-e git://github.com/boto/botocore.git#develop#egg=botocore
-e git://github.com/boto/jmespath.git#develop#egg=jmespath
-e git://github.com/boto/s3transfer.git#develop#egg=s3transfer
nose==1.3.3
mock==1.3.0
wheel==0.24.0
unittest2==0.5.1; python_version == '2.6'
(venv)$ pip install -r requirements.txt
Ignoring unittest2: markers 'python_version == "2.6"' don't match your environment Obtaining botocore from git+git://github.com/boto/botocore.git#develop#egg=botocore (from -r requirements.txt (line 1))
Cloning git://github.com/boto/botocore.git (to develop) to ./venv/src/botocore
fatal: unable to connect to github.com:
github.com[0: 192.30.253.112]: errno=Connection timed out
github.com[1: 192.30.253.113]: errno=Connection timed out
Command "git clone -q git://github.com/boto/botocore.git
/home/ubuntu/utils/boto3/venv/src/botocore" failed with error code 128 in None
However, as #Robeezy suggested, edited the requirement.txt and changed from
-e git://github.com...
to
-e git+https://github.com...
That is the link provided if you were to clone from the site (only options were Clone or Download).
So, thank you! It did work finally.
If you're installing with pip install git+https://github.com/repo and getting this error, make sure your username and password are correct. I was getting this error because I was incorrectly entering my password.