2

Can I use Sympy library in esp8266 micropython?

I tried to install it using ampy, but it returns an error

I want to solve linear equations:

For example:

from sympy import symbols, Eq, solve

y = symbols('x')
eq1 = Eq(x*2 -5x + 6)
sol = solve(eq1)

Error:

Import sympy Traceback (most recent call last): File "", line 1, in File "/lib/sympy/init.py", line 15, in ImportError: no module named 'future'

And when I`m trying to install future it returns an error raise:

PyboardError('exception', ret, ret_err) ampy.pyboard.PyboardError: ('exception', b'', b'Traceback (most recent call last):\r\n File "", line 6, in \r\nOSError: [Errno 13] EACCES\r\n')

gre_gor
  • 6,669
  • 9
  • 47
  • 52
Sahak Sahakyan
  • 101
  • 1
  • 9
  • Show the error message. – user2357112 Feb 28 '20 at 11:08
  • import sympy Traceback (most recent call last): File "", line 1, in File "/lib/sympy/__init__.py", line 15, in ImportError: no module named '__future__' >>> And when I`m trying to install future it returns an error raise PyboardError('exception', ret, ret_err) ampy.pyboard.PyboardError: ('exception', b'', b'Traceback (most recent call last):\r\n File "", line 6, in \r\nOSError: [Errno 13] EACCES\r\n') – Sahak Sahakyan Feb 28 '20 at 11:16
  • Did adding micropython-future help? Did you succeed in running SymPy under micropython? – Avitzur May 11 '20 at 18:33

1 Answers1

2

When you are trying to use a library in MicroPython (or Python) and you get an import error it means a library needed by that library is missing or unavailable.

It may be missing because a dependency was not installed or it may be missing due to differences in Python version (2.x vs 3.x or CPython vs. MicroPython)

In this case, future is not a module available in the MicroPython standard library. There is a "future" module library. You can see here: https://libraries.io/pypi/micropython-future and https://github.com/micropython/micropython-lib. Try adding this to your ./lib and see if sympy works.

Patrick
  • 2,044
  • 1
  • 25
  • 44