# Installing Python dependencies on Mac [duplicate]

I'm using MacOS Catalina and I following this question to install scipy with my addon: How to write my add-on so that when installed it also installs dependencies (let's say: scipy or numpy-quaternion)?

Running this code downloads and installs the module so I can use it in Terminal:

>>> import scipy
>>> print(scipy.pi)
3.141592653589793


However Blender doesn't see the module:

Traceback (most recent call last):
File "/Text", line 2, in <module>
ModuleNotFoundError: No module named 'scipy'
Error: Python script failed, check the message in the system console


What I noticed is that if I try to run the install code again, I see this in the console:

Requirement already up-to-date: pip in /Applications/Blender.app/Contents/Resources/2.83/python/lib/python3.7/site-packages (20.1.1)
Requirement already satisfied: scipy in ./.local/lib/python3.7/site-packages (1.4.1)
Requirement already satisfied: numpy>=1.13.3 in /Applications/Blender.app/Contents/Resources/2.83/python/lib/python3.7/site-packages (from scipy) (1.17.0)


So scipy is located in ./.local and other modules are in Blender.app/Contents/. Does anyone know how can I fix this and use scipy in my addon?

• Use bpy.app.binary_path_python to get the path to Blender's Python as shown here. – Robert Gützkow May 22 '20 at 20:09
• @RobertGützkow thank you for your reply. Unfortunately it's not: when I use your example to install a module I don't have (matplotlib you had there) it works, when I changed it to scipy I got the same warning as before: Requirement already satisfied + failed to import the module imgur.com/a/pbA4FC2 – Sergey Kritskiy May 23 '20 at 5:52
• @RobertGützkow ok so I manually uninstalled scipy that I had before, reinstalled it from your addon and it works now, thank you! Do you have any idea what has happened? I checked and bpy.app.binary_path_python was the same path that I used in my script (str(py_exec)). Was it because something about using a wrong pip..? – Sergey Kritskiy May 23 '20 at 5:59
• You don't have to use the --user flag. There are some improvements planned that would allow this to work properly, but they are not implemented yet (see developer.blender.org/T71420) – Robert Gützkow May 23 '20 at 7:43
• You would have to add the modules to your sys.path if your using --user. – Robert Gützkow May 23 '20 at 16:40