Python + Boost + LuxRender = working pylux?

Yesterday I tried to fix an issue which I think i noted before on my Linux environment in which,  Python Boost and LuxRender would compile seemingly fine, however when i try to use pylux in blender 2.5 I am left with an error in the console.

The Error was this
ImportError was: /usr/local/lib/ undefined symbol: PyUnicodeUCS2_AsUTF8String)

I was helped alot by a member in the luxrender IRC channel, (THANKS ONCE AGAIN! Orbisvicis) and would like to share what we think was the problem and the fix. For my records and for anyone who is unlucky enough to see the same error. I say unlucky because from experience, getting and compiling boost and having it link with everything, can be extremely painful. I lost count of the number of times i compiled python boost and luxrender yesterday.

OK so it appears to be a unicode problem, the exact cause could be a number of things

  • unicode support was not included with the python I compiled.
  • pylux is linked against an incorrect version of python.
  • the python implemented/packaged with blender is causing the issue.

The easist one of these to check is the linking in use ldd to check the library dependancies. Look for things that look odd or out of place. NOW this is were I had my problem. Despite Boost being built against the correct version of Python, when make finally linked, it fell back to my systems pre-installed Python2.6… so it was getting confused by this.

HOWEVER for completeness I will detail the final full solution of building python correct for the job and luxrender.

First i got the latest version of python 3.2.1rc1
I applied a patch to the python, for the boost libraries

Python was then built with the following command.

./configure –prefix=/usr –enable-shared –with-threads –with-computed-gotos –enable-ipv6 –with-valgrind –with-wide-unicode –with-system-expat –with-system-ffi; make

I changed –prefix to my desired build location. and did a make install after the above command. NB you might get an error during the compile, however, these shouldnt be anything you need (for LuxBlend or LuxRender) if you need to fix them, unfortunately that will be up to you, sorry.

I also got a later version of boost, 1.46, however the build process is IDENTICAL to that talked about previously however, be sure to check you used the correct include directories, as the normal
directory will have a ‘u’ on the end (signifying unicode?)

Boost should (at least it did on mine) compile perfectly fine.

The next part is LuxRender. The part here is cmake will often default to system directories in case of issues, and unfortunately this causes alot of issues. Cmake in luxrender was reorganised recently, and is likely still undergoing some change. there is a directory, cmake in the head directory of lux which contains a few useful files in which you can change cmake include directories and search paths.

in my case because python was likely my issue when i did the cmake i used the following commands

-DPYTHON_INCLUDE_DIR=<link to include dir>
-DPYTHON_LIBRARY=<link to actual lib file>

A full list of all options can be found in the CMakeCache.txt file which cmake generates… there are MANY MANY MANY and with the new cmake rewrite, if you have problems you can write your own custom config file and load it. Once you have picked out the ones you need you can use them by

cmake -DPYTHON_LIBRARY=<link to actual lib file> .
for example.

I was able to use blender with and all was right with the world. 😀

Once again thanks to the help i was given in IRC, and I hope these notes can come in handy to anyone suffering similar issues. Even if the error isnt exactly the same as shown here, the cmake notes at the end can fix so many issues. Also for library problems ldd is your friend.

This entry was posted in Uncategorized. Bookmark the permalink.

2 Responses to Python + Boost + LuxRender = working pylux?

  1. Thats why Windows has more users. Is a lot more easier to use! Simply open the package and done! Everythnig works! I’m using Unbuntu 11 64 bit now and i have the same problem with pylux. It simply dont work! I read your solution, but I dont understood it. It is too damn hard! I’m an cg artist, not a programmer. Making people build stuff is just stupid! Can you send me a working pylux or something, please?!

    • Mark says:

      Building is really only for the development version, one of the issues is the use of bleeding edge or obscure distributions of linux. In my case it was Scientific Linux, which doesn’t come bundled with all the correct versions of headers and libs. My best advice is a combination of the following,

      i can recommend downloading the 0.8 version which is available on and using that… it *should* work stand alone and the pylux contained in it should compatible with updates to the luxblend25 exporter.

      Information on should be useful though i think you would have already looked at that.

      The forum has a weeklies section in which the development team posts up packaged builds, these can prove very useful.

      Trying out and looking for a bundled build of blender with lux can also prove very useful.

      Failing this, the forums or irc at #luxrender is a good place to get advice.

      I could send you a version of pylux, though i have no idea if it would be compatible as i know enough to get around some problems though if something i build would work on someone else’s PC i have no idea.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s