Forums

Import Error: No module named 'haystack'

I'm having some errors while trying to import haystack into my web app. It's my understanding that haystack + whoosh is supported by PythonAnywhere, but when I'm running my app I get a no module error. I've already installed haystack, and django-haystack via pip. Here's the server log:

2017-07-27 19:50:49,193: Error running WSGI application
2017-07-27 19:50:49,193: ImportError: No module named 'haystack'
2017-07-27 19:50:49,194:   File "/var/www/harolddleon_pythonanywhere_com_wsgi.py", line 25, in <module>
2017-07-27 19:50:49,194:     application = get_wsgi_application()
2017-07-27 19:50:49,194: 
2017-07-27 19:50:49,194:   File "/usr/local/lib/python3.5/dist-packages/django/core/wsgi.py", line 13, in get_wsgi_application
2017-07-27 19:50:49,194:     django.setup(set_prefix=False)
2017-07-27 19:50:49,194: 
2017-07-27 19:50:49,195:   File "/usr/local/lib/python3.5/dist-packages/django/__init__.py", line 27, in setup
2017-07-27 19:50:49,195:     apps.populate(settings.INSTALLED_APPS)
2017-07-27 19:50:49,195: 
2017-07-27 19:50:49,195:   File "/usr/local/lib/python3.5/dist-packages/django/apps/registry.py", line 85, in populate
2017-07-27 19:50:49,195:     app_config = AppConfig.create(entry)
2017-07-27 19:50:49,195: 
2017-07-27 19:50:49,196:   File "/usr/local/lib/python3.5/dist-packages/django/apps/config.py", line 90, in create
2017-07-27 19:50:49,196:     module = import_module(entry)
2017-07-27 19:50:49,196: ***************************************************
2017-07-27 19:50:49,196: If you're seeing an import error and don't know why,
2017-07-27 19:50:49,196: we have a dedicated help page to help you debug: 
2017-07-27 19:50:49,196: https://help.pythonanywhere.com/pages/DebuggingImportError/

Any help with this kind of error?

Did you install it into a virtualenv? and if you weren't using a virtualenv, did you install it with pip3.5 and not pip2.7?

I wasn't using a virtualenv, but the page on Solving ImportError did showed that I was using Python 2.7, and I guess the default for pip was the same.

The solution was to install every package that was giving me an error using pip3.5, and the modules worked right away. Thanks for the help!

Excellent -- glad you worked it out!