3
$\begingroup$

I am trying to import the SciPy library inside Blender version 2.8 and I am having trouble. I can import SciPy outside of Blender.

On my system Blender's Python is installed at

 /snap/blender/34/2.81/python

I tried the following answers I found here :

  • As suggested here I tried to install ensurepip inside Blenders Python.
  • I tried to copy the system Python's SciPy folder to Blender's Python site-packages folder.

Both of the solutions are trying to change Blender's python folder -

/snap/blender/34/2.81/python/lib/python3.7/site-packages/

And when I try them, I get stuck with this error :

"Read-only file system"

Remounting the file system doesn't work either, I am wondering if this has something to do with the way Blender 2.8 is installed using snaps?

What can I try next to get SciPy inside Blender?

$\endgroup$
8
  • 1
    $\begingroup$ Firstly I don't use snap install of blender so anything to follow is speculative. Am assuming you cannot rename /snap/blender/34/2.81/python either. Try pip install scipy --user to install to a local user folder. As long as the python version of pip matches that of blender, I've found this is perhaps the simplest approach, maybe barring venvs. I have installed matplotlib, scipy, bezier, aubio, gdal and numerous others this way without issue. $\endgroup$
    – batFINGER
    Dec 26, 2019 at 8:57
  • $\begingroup$ You did not mention what OS you are using. You need to make sure Blender has permissions to write to whatever parts of the file system it has to write during this. On Windows this can be done running Blender as administrator. The code from your link works fine when I test it on Windows starting Blender with Run as administrator. $\endgroup$ Dec 26, 2019 at 8:58
  • $\begingroup$ Oops meant to mention using sudo. Personally I would avoid using sudo pip install for the local method. Making the 3rd party libraries available to all. Also forgot to mention plumbum one of my faves. If you can sudo mv (rename) the blender python folder, blender will pick up the matching system python instead. $\endgroup$
    – batFINGER
    Dec 26, 2019 at 9:04
  • $\begingroup$ Alternatively if you set up a virtual environment using your blender python (or matching system python) set the following environment variables docs.blender.org/manual/en/dev/advanced/command_line/… @RobertGützkow let's say "another" approach. $\endgroup$
    – batFINGER
    Dec 26, 2019 at 9:12
  • 1
    $\begingroup$ @batFINGER that would be even better, venvs are the cleanest approach in my opinion until the user packages dir for Blender is used (see T71420). $\endgroup$
    – Robert Gützkow
    Dec 26, 2019 at 9:56

0

You must log in to answer this question.

Browse other questions tagged .