Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku not install anything listed in requirements.txt

I'm not a native English user and I'm a Python beginner. Please excuse any grammar error.

I am having trouble pushing a simple flask project to Heroku.

The project is on Github

First, my requirements.txt is like below:

click==6.7
Flask==0.12.2
gunicorn==19.7.1
itsdangerous==0.24
Jinja2==2.9.6
MarkupSafe==1.0
Werkzeug==0.12.2

However, Heroku return the error code

remote:
remote: -----> Python app detected
remote: -----> Installing python-3.6.1
remote: -----> Installing pip
remote: -----> Installing requirements with pip
remote:        Failed to import the site module
remote:        Traceback (most recent call last):
remote:          File "/tmp/build_b20ee4f76cefa5dfa20998cf2e3692c7/site.py", line 1, in <module>
remote:            from flask import Flask, render_template
remote:        ModuleNotFoundError: No module named 'flask'
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed

I've run the project successfully on venv and global environment, and run the ./venv/bin/pip freeze command several times both in venv activate and deactive mode. ./venv/bin/pip -r install requirements.txt in a new venv can work just fine.

I'm not sure which step I've done wrong. Any advise will help.

Thanks.

like image 683
Tomaz Wang Avatar asked Nov 07 '22 20:11

Tomaz Wang


1 Answers

requirements.txt information needs to be included in Pipfile. On local pipenv, I used:

pipenv install -r requirements.txt

This also updated Pipfile. Then committed and pushed to heroku. Hope this helps.

like image 86
pseudorandomcoder Avatar answered Nov 15 '22 04:11

pseudorandomcoder