Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you delete, clean or clear a virtualenv in Heroku?

Tags:

python

heroku

I have a Heroku Python project that is emitting errors that I can't reproduce locally. I suspect that the Python virtualenv in the Heroku deployment is corrupted in some way.

Is there a way to clean the Python virtualenv in a Heroku project and start fresh?

like image 766
Neil Avatar asked Jan 21 '26 06:01

Neil


1 Answers

See Heroku docs. Create a runtime.txt file with a different version of Python than your current version and push to heroku. This will purge your appication's build cache and virtualenv. Then you can revert to your previous Python version in the runtime.txt and push that up to Heroku, giving you both your desired Python runtime and a clean virtualenv.

like image 80
mcastle Avatar answered Jan 23 '26 18:01

mcastle



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!