Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 369931 - media-gfx/blender-2.57-r1 isn't able to load external python modules by default
Summary: media-gfx/blender-2.57-r1 isn't able to load external python modules by default
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal minor (vote)
Assignee: Luca Barbato
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-03 18:57 UTC by Aiwendil
Modified: 2012-07-16 08:54 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
temp quick & dirty patch (blender.patch,560 bytes, patch)
2011-11-07 14:18 UTC, Ian Delaney (RETIRED)
Details | Diff
blender-2.57-enable_site_module.patch (blender-2.57-enable_site_module.patch,939 bytes, patch)
2011-11-07 14:58 UTC, Arfrever Frehtes Taifersar Arahesis
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Aiwendil 2011-06-03 18:57:57 UTC
Sorry, not sure if this even qualifies as a bug. The way blender ist started at the moment it's python interpreter doesn't find any of the external installed python modules. A "help ("modules")" doesn't show them. The problem is that "/usr/lib64/blender3.2/site-packages" is not in the search path for modules in blender:
>>> import sys
>>> print (sys.path)
['/usr/share/blender/2.5/scripts/addons', '/usr/share/blender/2.5/scripts/startup', '/usr/share/blender/2.5/scripts/modules', '/usr/lib64/python32.zip', '/usr/lib64/python3.2/', '/usr/lib64/python3.2/plat-linux2', '/usr/lib64/python3.2/lib-dynload', '/usr/share/blender/2.5/scripts/addons/modules']

The problem can be easily fixed within blender with a "sys.path.append("/usr/lib64/python3.2/site-packages")" but I think adding "export PYTHONPATH="/usr/lib64/python3.2/site-packages"" to the /usr/bin/blender-2.5 start script is a better solution.

Reproducible: Always

Steps to Reproduce:
1. start Blender
2. Go the the Blender python console
3. try a "import lxml" (in case dev-python/lxml is actually installed..should work with any other python package also)
Actual Results:  
>>> import lxml
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
ImportError: No module named lxml

Expected Results:  
importing of external modules work in blender-python
Comment 1 Rafał Mużyło 2011-06-03 19:18:19 UTC
This looks more like a python-updater problem.
Did you run it after installing python:3.2 ?
Comment 2 Aiwendil 2011-06-03 19:33:33 UTC
yep..even had a complete --emptytree rebuild afterwards.

Oh..and I forgot to mention..when I start "python3.2" from the shell and do a "help ("modules")" there I have access to all external modules. It just doesn't work in blender. 

And to add some more information..in eselect python 2.7 is the active python installation....but tried to temporary select 3.2 there with no change.
Comment 3 movrev 2011-10-09 05:58:09 UTC
This is a common issue across platforms (I've bumped into it on Gentoo and on Mac OSX). It stems from the fact that Blender 2.5x bundles it's own Python 3.2 packaged with its modules. My workaround is to create the following alias in ~/.bashrc:

alias blender='PYTHONPATH="/usr/lib64/python3.2/site-packages/:${PYTHONPATH}" blender-2.5'

You can also modify the ebuild to build against the system python 3.2 installation by following this guide:

http://wiki.blender.org/index.php/Dev:2.5/Doc/Building_Blender/Linux/Troubleshooting
Comment 4 Ian Delaney (RETIRED) gentoo-dev 2011-11-07 14:18:09 UTC
Created attachment 291909 [details, diff]
temp quick & dirty patch
Comment 5 Ian Delaney (RETIRED) gentoo-dev 2011-11-07 14:20:01 UTC
assigned to python team, this one sitting untouched for 5 months.
The  ebuild needs cleaning up, commented out code everywhere.
You'll find me in irc to polish
Comment 6 Arfrever Frehtes Taifersar Arahesis 2011-11-07 14:32:00 UTC
Overwriting of /etc/bash/bashrc in pkg_postinst() is definitely unacceptable.
Comment 7 Arfrever Frehtes Taifersar Arahesis 2011-11-07 14:58:25 UTC
Created attachment 291911 [details, diff]
blender-2.57-enable_site_module.patch

Value of sys.path from comment #0 suggests that site module is not imported.
Please test this patch.
Comment 8 Matt Summers (RETIRED) gentoo-dev 2011-11-07 17:56:32 UTC
re-assigning to lu_zero as that is the maintainer listed in metadata.xml for this package.
Comment 9 Aiwendil 2011-11-15 14:59:42 UTC
This seems to work now in blender-2.60a. I could import lxml without any problems and I get all installed python modules shown with "help ("modules").
 
Sorry, couldn't test those patches for 2.57 easily as I ran into bug 380989 when trying to compile that version. But with 2.60a all seems fine now...Thanks a lot.
Comment 10 Arfrever Frehtes Taifersar Arahesis 2011-11-16 17:59:26 UTC
  07 Nov 2011; Luca Barbato <lu_zero@gentoo.org> blender-2.57-r1.ebuild,
  +files/blender-2.57-enable_site_module.patch,
  files/blender-2.57-libav-0.7.patch:
  Update ebuild to fix #369931 and #374339