Reputation: 1000
It's worth noting that I'm using a custom buildpack to enable coffeescript compilation with node.js.
After a change that included a migration, I got the below error upon running the migration
Running `./manage.py migrate talent` attached to terminal... up, run.3366
Traceback (most recent call last):
File "./manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
File "/app/lib/python2.7/site-packages/django/core/management/__init__.py", line 1, in <module>
import collections
File "/usr/local/lib/python2.7/collections.py", line 8, in <module>
from _collections import deque, defaultdict
ImportError: No module named _collections
After poking around a bit in a heroku run bash
shell session I found that the same error could be triggered by opening a python repl and running import collections
.
Upvotes: 3
Views: 2821
Reputation: 1000
Further poking revealed that the error could be suppressed by adding /usr/local/lib/python2.7/:/usr/local/lib/python2.7/lib-dynload/
to $PYTHONPATH. I first tried to to this in the bin/release file of the buildpack, but I also had a PYTHONPATH config variable which apparently overrides the buildpack setting of the environment (as it probably should).
Anyway fixing the $PYTHONPATH made everything work again, but this feels awkward, like a symptom that something else has gone wrong. Hopefully someone with more Heroku knowledge than me can shed some light.
Upvotes: 2