7
$\begingroup$

I try to import numpy in Blender 2.77a. My Blender uses python that came pre-packaged. It has numpy module "2.77/python/lib/python3.5/site-packages/numpy". But running import numpy I get this error:

found bundled python: /home/user/blender-2.77a-linux-glibc211-x86_64/2.77/python
Traceback (most recent call last):
  File "/Text", line 1, in <module>
  File "/home/user/blender-2.77a-linux-glibc211-x86_64/2.77/scripts/modules/numpy/__init__.py", line 137, in <module>
    from . import add_newdocs
  File "/home/user/blender-2.77a-linux-glibc211-x86_64/2.77/scripts/modules/numpy/add_newdocs.py", line 9, in <module>
    from numpy.lib import add_newdoc
  File "/home/user/blender-2.77a-linux-glibc211-x86_64/2.77/scripts/modules/numpy/lib/__init__.py", line 4, in <module>
    from .type_check import *
  File "/home/user/blender-2.77a-linux-glibc211-x86_64/2.77/scripts/modules/numpy/lib/type_check.py", line 8, in <module>
    import numpy.core.numeric as _nx
  File "/home/user/blender-2.77a-linux-glibc211-x86_64/2.77/scripts/modules/numpy/core/__init__.py", line 5, in <module>
    from . import multiarray
ImportError: cannot import name 'multiarray'
Error: Python script fail, look in the console for now...

Is there something else I should do?

EDIT:

I tried a different machine, same download, and it works without problems. How could I identify what is wrong with my machine? Some missing paths, settings, libraries?

$\endgroup$
3
  • $\begingroup$ @zeffii Thanks for the advice! I use the right build (but on Linux). And I get the same error when I run from numpy import version. It seems to import everything. I also added full stacktrace to the question. $\endgroup$
    – Noidea
    Aug 31, 2016 at 16:54
  • $\begingroup$ @zeffii, oh, thanks a lot! So stupid, but I couldn't figure this out. Probably I copied it there, in some previous attempts to make numpy work a while ago and then forgot. No idea, but everything works now. $\endgroup$
    – Noidea
    Sep 1, 2016 at 16:07
  • $\begingroup$ @zeffli, by the way, what shall I do with questions answered in comments? Or should I just delete it, it's anyway not very clever question? $\endgroup$
    – Noidea
    Sep 1, 2016 at 16:09

1 Answer 1

6
$\begingroup$

Python looks in the list returned by sys.path.

import sys
print(sys.path)

It looks in each directory in the sequence, and the first mention of the module you are trying to import is where it will attempt to import from. You for some reason had numpy in /scripts/modules, and it looks like it was perhaps from an older Python version. Blender comes bundled with numpy for quite a while now, so no need to install it into modules.

On Windows machines, Blender stores the numpy in

2.77\python\lib\site-packages\numpy

on Linux it seems to be

python/lib/python3.5/site-packages/numpy

or

/usr/lib/python3/dist-packages/numpy/
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .