0
$\begingroup$

There is an error when I want to import the scipy module into blender through the anaconda directory. How can I fix this error?

Code:

import sys

scipy_path = "C:\Users\ALAFG\AppData\Local\Continuum\anaconda3\lib\site-packages"

if not scipy_path in sys.path:
    sys.path.append(scipy_path)    

import scipy

Error:

Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
File "/Users/ALAFG/AppData/Local/Continuum/anaconda3/Lib/site- 
packages\scipy\__init__.py", line 118, in <module>
from scipy._lib._ccallback import LowLevelCallable
File "/Users/ALAFG/AppData/Local/Continuum/anaconda3/Lib/site- 
packages\scipy\_lib\_ccallback.py", line 1, in <module>
from . import _ccallback_c
ImportError: cannot import name '_ccallback_c'
$\endgroup$
4
$\begingroup$

Just a guess, but perhaps you have a different version of python installed on your system than the one being used by Blender.

To keep things simple, I usually install scipy into Blender's python.

I run the get_pip.py file in Blender's text editor.

Then I install using pip by running this in the text editor:

import pip

pip.main(['install', 'scipy'])

Doing this will allow you to import scipy without needing to append any path.

Depending on how you have Blender installed, you may need to run Blender with administrator priveledges in order to do this.

$\endgroup$
  • $\begingroup$ Thanks for answer, I used this code and there is no Error now! $\endgroup$ – Ali Toloee Apr 10 '18 at 22:38
  • $\begingroup$ I can't import pip: ImportError: No module named 'pip'. I also tried pip3 but it didn't work. $\endgroup$ – sodiumnitrate May 11 '18 at 17:00
  • $\begingroup$ You have to download the get-pip.py file and run that in Blender's text editor first. That will install pip inside Blender. $\endgroup$ – doakey3 May 11 '18 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.