I've got two Heroku apps, running on the same codebase. The 1st is used as staging env and it works as expected (it auto deploys the devel branch) and the 2nd is used as the production app (auto deploying the master branch).
Today I did a minor code-level change and submitted a PR from devel to master and merged it. From that moment, heroku cannot deploy my master branch in production.
Full logs for this as given by heroku build log:
----->
Python app detected
-----> Uninstalling stale dependencies
Uninstalling django-elasticsearch-0.5:
Successfully uninstalled django-elasticsearch-0.5
Uninstalling pymongo-3.3.0:
Successfully uninstalled pymongo-3.3.0
$ pip install -r requirements.txt
Collecting git+https://github.com/liberation/django_elasticsearch.git (from -r requirements.txt (line 69))
Cloning https://github.com/liberation/django_elasticsearch.git to /tmp/pip-ZPaLWp-build
Collecting Delorean==0.6.0 (from -r requirements.txt (line 10))
Downloading Delorean-0.6.0.tar.gz
Collecting humanize==0.5.1 (from -r requirements.txt (line 37))
Downloading humanize-0.5.1.tar.gz
Collecting pynamodb==2.0.2 (from -r requirements.txt (line 46))
Downloading pynamodb-2.0.2-py2.py3-none-any.whl (73kB)
Collecting tzlocal==1.3 (from -r requirements.txt (line 63))
Downloading tzlocal-1.3.tar.gz
Installing collected packages: humanize, tzlocal, Delorean, django-traffic, pynamodb, django-elasticsearch
Running setup.py install for humanize: started
Running setup.py install for humanize: finished with status 'done'
Running setup.py install for tzlocal: started
Running setup.py install for tzlocal: finished with status 'done'
Running setup.py install for Delorean: started
Running setup.py install for Delorean: finished with status 'done'
Running setup.py install for django-elasticsearch: started
Running setup.py install for django-elasticsearch: finished with status 'done'
Successfully installed Delorean-0.6.0 django-elasticsearch-0.5 django-traffic-1.2.4 humanize-0.5.1 pynamodb-2.0.2 tzlocal-1.3
-----> Django app detected
-----> Running Django migrations
ImportError: No module named site
! Push rejected, failed to compile Django app.
! Push failed
Well, as fas as I know, there's no "site" module/app or anything in my code, so I cannot understand what's the problem in this case. I remind you, the devel branch auto deploys as expected in the respective Heroku app.
Any ideas?
Related
I've installed flask, flask_login, and ldap in the virtualenv for my flask package (to authenticate ldap users with the usernames & passwords of the other users at my company).
When I run my flask app, I get "AttributeError: 'module' object has no attribute 'initialize'"
I'm tried "pip install python-ldap"
but I get a red error (sandwiched between other white text) that reads:
"Failed building wheel for python-ldap"
I have thoroughly examined these:
How to install python-ldap on a python 2.7 virtualenv on windows without compiling
Installing python-ldap in a virtualenv on Windows
https://www.python-ldap.org/docs.html
https://www.linuxjournal.com/article/6988?page=0,1
to no avail.
I've had this error for days now...
(also:
pip install openldap
gives:
Collecting openldap
Could not find a version that satisfies the requirement openldap (from versions: )
No matching distribution found for openldap
...(in and outside of my venv) if that information helps)
I had this error last week and after switching work computers, I recreated the virtualenv and installed all of the other packages and dependencies successfully.
my requirements.txt file contains these lines after a line of git stuff:
click==6.7
Flask==0.12.2
Flask-Login==0.4.0
itsdangerous==0.24
Jinja2==2.9.6
ldap==1.0.2
ldap3==2.2.4
MarkupSafe==1.0
pyasn1==0.2.3
Werkzeug==0.12.2
Has anyone successfully installed python-ldap into a flask virtualenv with windows? If so... how?!
Go to:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#python-ldap
download python_ldap-2.4.38-cp27-cp27m-win_amd64.whl in the same directory that your venv folder is listed under
(ex.)
/myrepo
/myapp
/myapp
/venv
/run.py
/python_ldap-2.4.38-cp27-cp27m-win_amd64.whl
install the .whl file while inside of your venv
venv\Scripts\activate
pip install python_ldap-2.4.38-cp27-cp27m-win_amd64.whl
Voila!
The error
ERROR: Failed building wheel for python-ldap
can occur for several reasons. You actually have to look at what happened above this line. In my case, I just had to install missing dependencies to build python-ldap. You can look them up here. For CentOS 8, I had to install:
sudo dnf install openldap-devel python3-devel gcc
to make
python3 -m pip install --user python-ldap -U
work.
I'm trying to upload my application in heroku but when i try to do the first push I get this:
-----> Python app detected
-----> No runtime.txt provided; assuming python-2.7.4.
-----> Preparing Python runtime (python-2.7.4)
-----> Installing Distribute (0.6.36)
-----> Installing Pip (1.3.1)
-----> Installing dependencies using Pip (1.3.1)
then, the proccess stop working for a long time and it neve finish. After 15 minutes I got hits:
! Timed out compiling Python app (15 minutes)
! See https://devcenter.heroku.com/articles/slug-compiler#time-limit
What can I do?
My requirements.txt is like that:
Django==1.5.2
argparse==1.2.1
distribute==0.6.24
wsgiref==0.1.2
I was running heroku push master, and got this:
----- Python app detected
----- No runtime.txt provided; assuming python-2.7.3.
----- Using Python runtime (python-2.7.3)
----- Installing dependencies using Pip (1.2.1)
Downloading/unpacking Django-1.5c2 from https://www.djangoproject.com/download/1.5c2/tarball (from -r
requirements.txt (line 1))
Cannot determine compression type for file /tmp/pip-rYIGHS-unpack/tarball.ksh
Running setup.py egg_info for package Django-1.5c2
Installing collected packages: Django-1.5c2
Running setup.py install for Django-1.5c2
changing mode of build/scripts-2.7/django-admin.py from 600 to 755
changing mode of /app/.heroku/python/bin/django-admin.py to 755
========
WARNING!
========
You have just installed Django over top of an existing
installation, without removing it first. Because of this,
your install may now include extraneous files from a
previous version that have since been removed from
Django. This is known to cause a variety of problems. You
should manually remove the
/app/.heroku/python/lib/python2.7/site-packages/django
directory and re-install Django.
Successfully installed Django-1.5c2
How can I remove the previous Django package?
UPDATE:
My requirements.txt:
https://www.djangoproject.com/download/1.5c2/tarball/**#egg=django**
South==0.7.6
argparse==1.2.1
distribute==0.6.24
dj-database-url==0.2.1
psycopg2==2.4.6
wsgiref==0.1.2
PIL==1.1.7
The text in bold fixed the above warning.
UPDATE 2:
Since Django 1.5 was officially released, I just used pip freeze:
Django==1.5
South==0.7.6
argparse==1.2.1
distribute==0.6.24
dj-database-url==0.2.1
psycopg2==2.4.6
wsgiref==0.1.2
PIL==1.1.7
I've had problems where Heroku caches broken packages and there's no way to get them out. The Python buildpack should have some kind of support for flushing this cache (CACHE_DIR), but it does not.
There is a workaround: follow these instructions to change your Python runtime to, for instance, 3.3.0 (it doesn't matter if your app actually supports Python 3 or not). Then change it back to the default. The act of changing your Python runtime and then deploying will force the buildpack to totally erase the cache. As far as I know this is the only practical way to erase the cache at the moment.
Push current virtenv package to file
pip freeze > requirements.txt
Commit
git commit -am 'update packages'
And push to heroku
git push heroku
Then heroku will rebuild the environment
Counting objects: 13, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (13/13), 1.26 KiB, done.
Total 13 (delta 3), reused 0 (delta 0)
-----> Python app detected
-----> No runtime.txt provided; assuming python-2.7.3.
-----> Preparing Python runtime (python-2.7.3)
-----> Installing Distribute (0.6.34)
-----> Installing Pip (1.2.1)
-----> Installing dependencies using Pip (1.2.1)
Downloading/unpacking Flask==0.9 (from -r requirements.txt (line 1))
Running setup.py egg_info for package Flask
Thought I removed the faulting package and all other packages that depends on it but nope. Each time I deploy I keep getting an error. Finally I somehow striped out all other packages that depends on the faulting package and everything worked perfectly. Hope somebody will find this useful
I am getting this error while pushing the Django project to Heroku master. I am new to Django. Any help will be really appreciated.
-----> Installing dependencies using Pip (1.2.1)
Downloading/unpacking Brlapi==0.5.5 (from -r requirements.txt (line 1))
Could not find any downloads that satisfy the requirement Brlapi==0.5.5 (from -r requirements.txt (line 1))
No distributions at all found for Brlapi==0.5.5 (from -r requirements.txt (line 1))
Storing complete log in /app/.pip/pip.log
! Heroku push rejected, failed to compile Python app
To git#heroku.com:enigmatic-plateau-3620.git
! [remote rejected] master -> master (pre-receive hook declined)
Use the --no-site-packages option to prevent the virtual environment from having access to all the packages on your system.
virtualenv --no-site-packages venv
If you don't need the Brlapi for your Django app, try removing the Brlapi==0.5.5 line from your requirements.txt document. Then, commit the change:
git add requirements.txt
git commit
git push heroku master
I have an issue while trying to deploy my Django app to Heroku.
It complains about issues with installing facebook-sdk library, but actually there is
no such thing in the requirements.txt file.
I already tried pushing with -f flag, I commented out lines from requirements.txt. I've even pushed an empty requirements file and the issues still persist.
I have no idea if there is any way to reset the app or heroku's repo beside creating a new one? Any ideas what I could try?
Console log:
$ git push prod master
Counting objects: 52282, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (17957/17957), done.
Writing objects: 100% (52282/52282), 138.01 MiB | 137 KiB/s, done.
Total 52282 (delta 33410), reused 48501 (delta 30768)
-----> Heroku receiving push
-----> Python/Django app detected
-----> Preparing Python interpreter (2.7.2)
-----> Creating Virtualenv version 1.7
New python executable in .heroku/venv/bin/python2.7
Also creating executable in .heroku/venv/bin/python
Installing distribute.............................................................................................................................................................................................done.
Installing pip...............done.
Running virtualenv with interpreter /usr/local/bin/python2.7
-----> Activating virtualenv
-----> Installing dependencies using pip version 1.0.2
error: The requested URL returned error: 401 while accessing http://github.com/facebook/python-sdk.git/info/refs
fatal: HTTP request failed
Downloading/unpacking paramiko (from -r requirements.txt (line 17))
Creating supposed download cache at /app/tmp/repo.git/.cache/pip_downloads
Storing download in cache at /app/tmp/repo.git/.cache/pip_downloads/http%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fp%2Fparamiko%2Fparamiko-1.7.7.2.zip
Running setup.py egg_info for package paramiko
Obtaining facebook-sdk from git+http://github.com/facebook/python-sdk.git#egg=facebook-sdk (from -r requirements.txt (line 23))
Cloning http://github.com/facebook/python-sdk.git to ./.heroku/src/facebook-sdk
Complete output from command /usr/bin/git clone -q http://github.com/facebook/python-sdk.git /tmp/build_1bn5oykhrmms7/.heroku/src/facebook-sdk:
----------------------------------------
Command /usr/bin/git clone -q http://github.com/facebook/python-sdk.git /tmp/build_1bn5oykhrmms7/.heroku/src/facebook-sdk failed with error code 128
Storing complete log in /app/.pip/pip.log
! Heroku push rejected, failed to compile Python/django app
The right solution is "Maxime R."'s solution on how to pip uninstall with virtualenv on heroku cedar stack?
heroku labs:enable user_env_compile heroku config:add
CLEAN_VIRTUALENV=true
Currently this won't work because there is a bug. You'll need to use
my fork of the buildpack until this get fixed upstream :
heroku config:add
BUILDPACK_URL=git#github.com:blaze33/heroku-buildpack-python.git
Now push your new code and you'll notice that the whole virtualenv
gets reinstalled.
Andrey's answer no longer works since March 23 2012. The new style
virtualenv commit moved the virtual env from /app to /app/.heroku/venv
but the purge branch wasn't updated to catch up so that you end up
with a virtualenv not being in PYTHONHOME.
After several attempts with heroku run command finally I applied Maxime R. solution successfully. Also I have been opened a Heroku ticket and Heroku support has been confirmed to me that this is the solution.
It's happen because you're using an empty repository for python-SDK's library (http://github.com/facebook/python-sdk.git), try using another repo: https://github.com/pythonforfacebook/facebook-sdk
I had removed two packages from the virtual env and requirements.txt, and temporarily changing the Python runtime (as suggested here) is the only approach I found that allowed me to uninstall those packages from heroku.