Houman
Houman

Reputation: 66320

ImportError: No module named haystack

If I install the latest stable 1.2.7 django-haystack with sudo pip install django-haystack, it works fine. But after uninstalling it and installing the very latest dev version 2.0.0 BETA instead as suggested on the main page:

pip install -e git+https://github.com/toastdriven/django-haystack.git@master#egg=django-haystack

Despite the success messages below, it seems like it is not properly installed:

Obtaining django-haystack from git+https://github.com/toastdriven/django-haystack.git@master#egg=django-haystack
  Cloning https://github.com/toastdriven/django-haystack.git (to master) to ./src/django-haystack
  Running setup.py egg_info for package django-haystack

Installing collected packages: django-haystack
  Running setup.py develop for django-haystack
    Checking .pth file support in /usr/local/lib/python2.7/dist-packages/
    /usr/bin/python -E -c pass
    TEST PASSED: /usr/local/lib/python2.7/dist-packages/ appears to support .pth files

    Creating /usr/local/lib/python2.7/dist-packages/django-haystack.egg-link (link to .)
    Adding django-haystack 2.0.0-beta to easy-install.pth file

    Installed /home/kave/projects/cb/src/django-haystack
Successfully installed django-haystack
Cleaning up...

because when I go into the django shell environment and do a

>>> from haystack import indexes

Traceback (most recent call last):
  File "<console>", line 1, in <module>
ImportError: No module named haystack

I have followed the instructions and have INSTALLED_APPS = (... 'haystack',) in there

I had this problem before, but could never solve it. sudo pip install default works fine, but as long as I get the latest Git version, my django doesn't seem to see it.

What could I be missing?

Many Thanks for your advice,

UPDATE

Apologies, but it seems the error is happening only within Aptana Studio 3.0. In Django Shell I can do the import after all. I am still dazzled, as this should be the same. Why can Aptana see the libraries when installing with sudo pip install django-haystack but not if using latest Git version? What could go wrong there please?

UPDATE 2

full sys.path

['/home/kaveh/projects/cb', '/usr/local/lib/python2.7/dist-packages/requests-0.13.9-py2.7.egg', '/home/kaveh/projects/cb/src/django-haystack', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PIL', '/usr/lib/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', '/usr/lib/python2.7/dist-packages/ubuntuone-client', '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', '/usr/lib/python2.7/dist-packages/ubuntuone-couch', '/usr/lib/python2.7/dist-packages/ubuntuone-installer', '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol']

Upvotes: 0

Views: 4516

Answers (1)

Houman
Houman

Reputation: 66320

I finally got it working.

As I said the problem is pip install -e git+https://github.com/toastdriven/django-haystack.git@master#egg=django-haystack is apparently not working.

I simply uninstalled it and made sure its deleted.

Then I simply downloaded the source as zip file, extracted it and

python setup.py build
sudo python setup.py install

This way it will guaranteed be working. Hope this helps someone.

Upvotes: 1

Related Questions