SciPy + NumPy in 2.8

Hello, forum. I was practicing some coding in 2.8 and got into following issue. When trying to import scipy console message tells me there’s no scipy module. Okay, going into blender’ python directory and installing it using python3.7m -m pip install scipy. And now when I try import scipy from within blender it breaks with the following error:

>>> import scipy
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "/home/hiisi/blender/blender28/2.80/python/lib/python3.7/site-packages/scipy/__init__.py", line 62, in <module>
    from numpy import show_config as show_numpy_config
ImportError: cannot import name 'show_config' from 'numpy' (unknown location)

Multiple attempts to reinstall either scipy or numpy didn’t help. How do I fix that?

You can symlink the system’s python to Blender’s python folder. You might want
to give that a go.

Btw Blender already comes with numpy.

Tried to delete the prepackaged python&symlink to system’s python3.7m (tried other versions also). That produced some error about encoding. I believe it’s some environment issues but that’s another story. I know that numpy comes out of the box. Yet when you do pip install scipy it also install some newer version of numpy. It all looks like bug somewhere in blender API…
P.S. Thank you!

This is a bit easier on Windows. It looks like you are on Linux, which can be sticky because Python is a systemwide installation in most Linux distros. What I recommend is looking into setting virtualenv with Blender or making sure that your system Python is actually Python 3.7. Another option you can look into is to build Python3.7 locally and symlink that as the Blender Python folder under 2.80

You can also try these flags to set your Py

-debug-python 
        Enable debug messages for Python.
--env-system-python 
        Set the BLENDER_SYSTEM_PYTHON environment variable.
        End option processing, following arguments passed unchanged. Access via Python's 'sys.argv'.
  $BLENDER_SYSTEM_PYTHON    Directory for system Python libraries.
  $PYTHONHOME               Path to the Python directory, eg. /usr/lib/python.

Thank you! Yes, I use Linux. 10 years ago I would had to justify that. Now it’s the other way around :slight_smile:
I have build the python locally, have scipy installed in it using pip and blender uses that local python installation. Works like a charm!

Hello :slight_smile:

I see that your problem is solved, but I guess that it’s not the best solution, for example for later if you want to do it on multiple machines, etc…

I had this exact same kind of import problem with numpy, and I finally found the problem

Indeed the solution was to reinstall numpy. But I noticed uninstalling numpy is not fully doable by pip.
For some reasons, I had to run the pip uninstall several times, to wait for pip to say that numpy in not found. And THEN (here is the trick) you still have some numpy folder in site-packages … Deleting it by hand before installing, solved the problem.

See you ++
Tricotou