2
votes

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')

1
Show the error message. - user2357112 supports Monica
import sympy Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/lib/sympy/__init__.py", line 15, in <module> 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 "<stdin>", line 6, in <module>\r\nOSError: [Errno 13] EACCES\r\n') - Sahak Sahakyan
Did adding micropython-future help? Did you succeed in running SymPy under micropython? - Avitzur

1 Answers

2
votes

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.