0
$\begingroup$

This question already has an answer here:

Here's the output from Blender python console:

>>> from numpy import *
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/numpy/__init__.py", line 153, in <module>
    from . import add_newdocs
  File "/usr/lib/python3/dist-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/usr/lib/python3/dist-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/usr/lib/python3/dist-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/usr/lib/python3/dist-packages/numpy/core/__init__.py", line 6, in <module>
    from . import multiarray
ImportError: cannot import name 'multiarray'

It seems that Blender is trying to use my system Numpy instead of its own version. If I try importing numpy in a regular python console, it works just fine. However, the regular python console seems to use numpy from a different path than Blender:

>>> import numpy
>>> print(numpy.__path__)
['/usr/local/lib/python3.4/dist-packages/numpy']

How to solve this?

EDIT: Inside Blender, sys.path gives:

>>> print(sys.path)
['/usr/share/blender/2.78/scripts/addons_contrib', '/usr/share/blender/2.78/scripts/addons', '/usr/share/blender/2.78/scripts/startup', '/usr/share/blender/2.78/scripts/modules', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/lib/python3/dist-packages', '/usr/share/blender/2.78/scripts/freestyle/modules', '/usr/share/blender/2.78/scripts/addons/modules', '/home/myhome/.config/blender/2.78/scripts/addons/modules']

In normal python console, I get:

>>> print(sys.path)
['', '/usr/lib/python3.4', '/usr/lib/python3.4/plat-x86_64-linux-gnu', '/usr/lib/python3.4/lib-dynload', '/usr/local/lib/python3.4/dist-packages', '/usr/lib/python3/dist-packages']
$\endgroup$

marked as duplicate by PGmath, Ray Mairlot, zeffii, someonewithpc, David Oct 11 '16 at 22:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    $\begingroup$ That question didn't really have a proper answer. Also, I thought I had exactly the same problem and I deleted the /scripts/modules directory that was causing problems for the other guy completely, but this didn't solve the problem. It is possible that my problem would be solved by forcing Blender to use numpy from another path, but how do I do this? $\endgroup$ – Echows Oct 11 '16 at 12:39
  • $\begingroup$ well, run from numpy import version, what does it say? and what does print(sys.paths) from the answer say? This should give you the answer which numpy it finds. $\endgroup$ – Noidea Oct 11 '16 at 12:43
  • $\begingroup$ By the way, there is a typo: print(sys.path) should be correct. Run it from Blender. $\endgroup$ – Noidea Oct 11 '16 at 12:52
  • 1
    $\begingroup$ well, I use 2.77a for linux and it comes with python 3.5 and numpy prepackaged. Which installation are you using? $\endgroup$ – Noidea Oct 11 '16 at 17:07
  • 2
    $\begingroup$ I see.. I have an even older Ubuntu :) You can just download Blender Tarball .bz2 from blender.org/download , unpack it and it should work out of the box. It has blender executable, you just run it. $\endgroup$ – Noidea Oct 11 '16 at 17:57

Browse other questions tagged or ask your own question.