Reputation: 105
when I try to run my script in Blender:
import bpy
import pandas as pd
datafr = pd.read_table("/Users/Admin/Desktop/Python/Programming/storage_ocp_ode.csv", delimiter = ",", index_col = 0)
...
I get an ImportError: No module named pandas.
Traceback (most recent call last):
File "/Users/Admin/Desktop/watertank1.blend/storageobject_flow.py", line 6, in <module>
ImportError: No module named 'pandas'
Error: Python script fail, look in the console for now...
But when I use the command line and import pandas there, it works
Python 3.4.3 |Anaconda 2.3.0 (x86_64)| (default, Mar 6 2015, 12:07:41)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
>>>
I´m using Blender 2.76 on a Mac with OS X 10.11.
Upvotes: 1
Views: 3949
Reputation: 105
My solution is symlinks:
sudo ln -s /Users/Admin/anaconda/lib/python3.4/site-packages/pandas /Applications/blender.app/Contents/Resources/2.76/scripts/modules/pandas
After this I had to do the same with numpy, dateutil, six.py and pytz, but now it works fine!
Upvotes: 1
Reputation: 879083
The Blender releases distributed from blender.org include a complete Python installation on all platforms, this has the disadvantage that any extensions you have installed in your systems Python wont be found by Blender. (my emphasis)
There are 2 ways around this:
remove Blender Python sub-directory, Blender will then fallback on the systems Python and use that instead .. warning:
The Python version must match the one that Blender comes with.
copy the extensions into Blender’s Python sub-directory so Blender can access them, you could also copy the entire Python installation into Blenders sub-directory, replacing the one Blender comes with. This works as long as the Python versions match and the paths are created in the same relative locations. Doing this has the advantage that you can redistribute this bundle to others with Blender and/or the game player, including any extensions you rely on.
Upvotes: 3