Alex Ravenel's blog

HOME | ARCHIVES | ATOM

  1. Compiling Python Extensions in Windows Inside Virtualenv

    Thu 23 August 2012

    If you are writing much Python code, there is a good chance you are using Virtualenv. If you are doing this under Windows, you may have had any number of problems (see previous rant).

    My most recent issue came with trying to install Celery inside a virtualenv. My installation was failing when compiling the Billiard dependency with the following error:

    C:\MinGW\bin\gcc.exe -shared -s build\temp.win32-2.7\Release\modules\_billiard\multiprocessing.o build\temp.win32-2.7\Re lease\modules\_billiard\semaphore.o build\temp.win32-2.7\Release\modules\_billiard\pipe_connection.o build\temp.win32-2. 7\Release\modules\_billiard\socket_connection.o build\temp.win32-2.7\Release\modules\_billiard\win32_functions.o build\t emp.win32-2.7\Release\modules\_billiard\_billiard.def -LC:\Users\aravenel\code\WeeklyMenus\venv\libs -LC:\Users\aravenel \code\WeeklyMenus\venv\PCbuild -lws2_32 -lpython27 -lmsvcr90 -o build\lib.win32-2.7\_billiard.pyd

    c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find -lpython27

    collect2: ld returned 1 exit status

    error: command 'gcc' failed with exit status 1

    This as it turns out is an issue with the Virtualenv not correctly knowing the location of the Python libraries upon which it depends (notably libpython27.a). To fix this, simply edit the activate.bat script in your venv/Scripts folder to add the following line:

    set LIBRARY_PATH=c:\python27\libs

    Voila. No more compiler errors.

    Answer found (as usual!) on StackOverflow

    Comments
  2. Don't write Python code in Windows (or, how to install Celery via pip in Windows).

    Mon 23 July 2012

    Seriously, just don't.

    I love Python. I got my start writing it at work to automate simple but tedious tasks ("rename these 4,000 files according to their author ...

  3. Manually Set Netflix Streaming Bitrate

    Sat 07 April 2012

    I stream Netflix to an HTPC I have setup. Depending on what I am watching, I sometimes want to manually tweak the quality of the streaming beyond Netflix's automatic ...

  4. Mango Arepa Sauce

    Sun 25 March 2012

    And now for something completely different... I live in New York, and there is this fantastic restaurant in the East Village called Caracas Arepa Bar. While the Arepas there are ...

  5. Gigabyte GA-Z68AP-D3 Network Issues in Ubuntu

    Mon 02 January 2012

    I recently purchased a Gigabyte GA-Z68AP-D3 motherboard as part of a new PC build. When I went to install Ubuntu on it, my network connection was horribly slow--time outs all ...

continue   →