0

On Windows, Python 3.4 64bit. Installed libsass, but unable to run it.
Probably something to do with the 32bit vs 64bit.

pip install libsass
Requirement already satisfied (use --upgrade to upgrade): libsass in c:\python34\lib\site-packages
Requirement already satisfied (use --upgrade to upgrade): six in c:\python34\lib\site-packages (from libsass)

python
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

import sass
Traceback (most recent call last):
File "", line 1, in 
File "C:\Python34\lib\site-packages\sass.py", line 24, in 
from _sass import OUTPUT_STYLES, compile_filename, compile_string
ImportError: DLL load failed: %1 is not a valid Win32 application.

Help!

Sherwyn Goh
  • 1,352
  • 1
  • 10
  • 19

3 Answers3

1

You should just install the appropriate wheel from: https://pypi.python.org/pypi/libsass (libsass-0.8.3-cp34-none-win_amd64.whl)

Ringil
  • 6,277
  • 2
  • 23
  • 37
0

I just experienced a similar error:

      File "K:\Python27\lib\site-packages\sass.py", line 26, in <module>
      from _sass import OUTPUT_STYLES, compile_filename, compile_string
      ImportError: DLL load failed: The specified module could not be found.

After a bunch of searching, it looked like on Windows I was missing the needed C++, and again, being Windows, the simplest way to fix this was to update VisualStudio with the C++ library.

Error is gone and libsass is working great after doing this.

    Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit(Intel)] on win32  Type "help", "copyright", "credits" or "license" for more information.
    >>> import sass
    >>> print sass.compile(string='a { b{ color: blue; } }')
     a b { color: blue; }

I know it doesn't directly answer the question, but thought I'd leave the solution I found here, for those who are in the process of losing a couple hours like I did.

I had Visual Studio 2013 - installed Visual Studio Community 2015 (making sure to select the C & C++ libraries)

KateJ
  • 1
  • 3
  • can you update on from which version you updated and what was the final version? – prasun Nov 25 '15 at 13:09
  • Yes definitely, sorry. Was in a rush when I typed that up. I had Visual Studio 2013, Installed Visual Studio Community 2015 (making sure to select the C & C++ libraries) – KateJ Nov 25 '15 at 21:08
0

The libsass DLL ("_sass.pyd" in the python world) probably misses some of its dependencies.

You can just install the small "Visual C++ Redistributable for Visual Studio 2015" to get that bunch of missing C++ components.