During development of our Python/Django application, we accidentally introduced package requirements in requirements.txt that installed conflicting versions of a library. Heroku has cached the broken requirements in the CACHE_DIR specified by the python buildpack, as documented on their buildpack API info page, and it doesn't seem that any amount of modification to the requirements.txt file can purge the cache of the broken packages. How can we force Heroku to totally empty out the CACHE_DIR and reinstall all requirements and dependencies from scratch?
Asked
Active
Viewed 4,338 times
3 Answers
38
Use heroku-repo
plugin purge_cache command:
$ heroku plugins:install heroku-repo
$ heroku repo:purge_cache -a appname

Janusz Skonieczny
- 17,642
- 11
- 55
- 63

zakjan
- 2,391
- 1
- 19
- 29
-
3This is awkward. There really is not `clean` switch for build/deploy on Heroku? Do we really need this extra step just to make throw away stale caches? – Janusz Skonieczny Dec 29 '16 at 16:35
7
I ran in the same problem as I was trying to install a module (django-piston
) from source as the last official release is a bit old and lacks some bug fixes that are crucial to me. Anyway, there has been an issue opened before, and I actually got a reply from support.
It seems a bit odd to me, but at least it works (just choose any python release number in runtime.txt
, rebuild, and then change back to your desired runtime and rebuild again)

Ivan Ferić
- 4,725
- 11
- 37
- 47

Johannes Lerch
- 106
- 4
-
Clunky solution but it solved my problem (and there does not appear to be any better one at this time). Thank you! – Andrew Gorcester Jan 18 '13 at 17:48
-
Any idea how to do this with a custom heroku-buildpack-php ? I'm tweaking one to work with Laravel 4, and I got it to compile and deploy, but it's missing pdo_pgsql so I want the new php.ini file but it's still stuck in the cache_dir – Lotus Sep 01 '13 at 19:14
-2
I was able to clear the cache by simply making a change to the readme.md file (added some spaces), committing, and pushing

Lotus
- 2,596
- 1
- 22
- 20