2

I'm interested in trying out sympy with Blender (v2.76, Python 3.4.2 Console, Windows 8.1). I followed this answer from Blender SE, downloaded sympy as a ZIP from Githib, and moved the sympy folder to C:\Program Files\Blender Foundation\Blender\2.76\python\lib\site-packages. However, when I opened Blender and tried to import sympy in the Python Console, I got the following error:

>>> import sympy
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "C:\Program Files\Blender Foundation\Blender\2.76\python\lib\site-packages\sympy\__init__.py", line 20, in <module>
    raise ImportError("SymPy now depends on mpmath as an external library. "
ImportError: SymPy now depends on mpmath as an external library. See http://docs.sympy.org/latest/install.html#mpmath for more information. 

I don't know how to install an external library. I tried going to the link mentioned in the ImportError, and I saw pip install mpmath. I tried it in cmd, but got this:

>pip install mpmath
Requirement already satisfied (use --upgrade to upgrade): mpmath in c:\anaconda3
\lib\site-packages

I did install Anaconda a while ago, so I guess it makes sense to have this output. How can I install mpmath as an external library for Blender so I can import sympy in it?

Community
  • 1
  • 1
DragonautX
  • 860
  • 1
  • 12
  • 22
  • 1
    Like sympy you want mpmath installed into blenders python folder. You are running pip in a system installed python that knows mpmath is installed in `c:\anaconda3\....` You can also try adding that existing path to [`sys.path`](https://docs.python.org/3/library/sys.html#sys.path) – sambler Oct 02 '16 at 08:59
  • @sambler That works, thanks. When you mentioned `sys.path`, it must've been about imports, and this made much more sense to me. I found I could also download [mpmath](https://github.com/fredrik-johansson/mpmath) also from Github and copy the mpmath folder as needed. It was like the Blender SE answer, but with mpmath instead of sympy. What I found pretty cool is that since I have Anaconda installed on Windows, I can just add "c:\anaconda3 \lib\site-packages" to PYTHONPATH, and I don't need to even download anything from Github. I could delete the sympy and mpmath folders, and it still works. – DragonautX Oct 02 '16 at 16:27
  • @sambler I can accept your comment as an answer. Again, thanks. – DragonautX Oct 02 '16 at 16:28

1 Answers1

1

You want to install mpmath into blenders python folder, the same as you have done for sympy.

Your example of running pip was done in a system installed python that is setup to find the mpmath that you have installed in c:\anaconda3\lib\site-packages

Another option is to use the existing install of mpmath and sympy by adding your existing path to sys.path or adding it to the PYTHONPATH environment variable before you start blender.

sambler
  • 6,917
  • 1
  • 16
  • 23