Skip to content
Matt Westcott edited this page Aug 12, 2015 · 1 revision

Troubleshooting

/bin/sh: django_libsass.SassCompiler: command not found

What you need to know

  • This is a very nondescript error, and can be caused by all kinds of things. Just because it looks like someone else's error report, doesn't mean it's the same issue.
  • The error message simply means "Something went wrong when I tried to load django_libsass as a library, so I tried to run it as a command line program instead. That didn't work either." The 'Something went wrong' is the bit we're interested in.
  • django-libsass does not depend on any command-line tools - it works entirely through Python / C library calls. Installing random SASS-related command-line utilities you find around the net will not help. If you find yourself installing anything to do with Node or Ruby, you've gone way off track.

1: Isolate the problem

In a clean virtualenv, install hello-django-libsass as per the instructions in the readme. If this succeeds, but your own project doesn't, then the problem lies somewhere within your own project - check your own settings file against the one from hello-django-libsass.

2: Check that libraries have installed correctly

Run pip freeze to get a list of installed Python packages. You should see django-libsass and libsass in the list. If either of them are missing, run pip install django-libsass or pip install libsass as appropriate. Check the output for any error messages. In particular, note that libsass requires a recent version of GCC or Clang/LLVM - see the libsass readme.

3: Test python-libsass in isolation

From the Django shell (./manage.py shell), run:

import sass; sass

This should give a response like <module 'sass' from '.../lib/python3.4/site-packages/libsass-0.6.2-py3.4-linux-i686.egg/sass.py'>. If you get an error instead, something is wrong with the underlying libsass installation - you'll need to fix this before you can get django-libsass running.

If the above command succeeds, run:

from django_libsass import SassCompiler

This should complete with no output.

Everything works fine on the shell and under ./runserver, but not when deploying to a proper web server

This can happen if your build of libsass has been compiled in a way that depends on the LD_LIBRARY_PATH environment variable - the web server process is not running within a shell session, and so it will not pick up this variable. See https://groups.google.com/d/msg/wagtail/bmz9t8If2RA/7EAhdVUOd24J - in this case, libstdc++ was installed locally in the user's home directory as a workaround for a PaaS hosting service not providing the necessary version (and not giving the user sufficient privileges to install it globally). In cases like this, we would recommend using your hosting provider's support channel - we can't provide support for specific third-party hosting setups.

To investigate further, you could try putting the lines import sass; sass and from django_libsass import SassCompiler into your settings file and seeing if this throws any errors that didn't appear when running those commands in the shell.

Still no luck?

Feel free to open an issue, providing full details of your setup, including any error messages you encounter when following these steps.