Ulab Problems

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
sprinkfitter
Posts: 36
Joined: Wed Sep 27, 2017 1:42 pm
Location: Louisville Ky

Ulab Problems

Post by sprinkfitter » Tue Jan 19, 2021 1:02 am

I have been trying to upload ulab in firmware. I have used this bin fileESP32/v1.12_with_ulab/ulab_v0.54.0_2020 ... -07-29.bin. I get this burn into my esp32 and see Ulab is in the boot. The following are the function in ulab. encode -- <function>
find -- <function>
rfind -- <function>
index -- <function>
rindex -- <function>
join -- <function>
split -- <function>
splitlines -- <function>
rsplit -- <function>
startswith -- <function>
endswith -- <function>
strip -- <function>
lstrip -- <function>
rstrip -- <function>
format -- <function>
replace -- <function>
count -- <function>
partition -- <function>
rpartition -- <function>
center -- <function>
lower -- <function>
upper -- <function>
isspace -- <function>
isalpha -- <function>
isdigit -- <function>
isupper -- <function>
islower -- <function>
error code ImportError: no module named 'numpy'
I am running version download ok
exec(open('ulab.py').read(),globals())
you are running ulab version 0.54.0
What pray tell am I doing wrong? Where is the numpy?

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Ulab Problems

Post by jimmo » Tue Jan 19, 2021 2:53 am

sprinkfitter wrote:
Tue Jan 19, 2021 1:02 am
I have used this bin fileESP32/v1.12_with_ulab/ulab_v0.54.0_2020 ... -07-29.bin.
I'm guessing this comes from here

https://gitlab.com/rcolistete/micropyth ... 2020-07-29
sprinkfitter wrote:
Tue Jan 19, 2021 1:02 am
The following are the function in ulab.
I think you might be using the help() function incorrectly as it's printing out the methods on str. Can you show us how you're using help?

It should be

Code: Select all

>>> import ulab
>>> help(ulab)
sprinkfitter wrote:
Tue Jan 19, 2021 1:02 am
Where is the numpy?
ulab isn't numpy, it just provides something that looks a bit like numpy. So you need to import ulab instead.

See this example for how to make code that works with both numpy and ulab:

https://github.com/v923z/micropython-ulab#usage

sprinkfitter
Posts: 36
Joined: Wed Sep 27, 2017 1:42 pm
Location: Louisville Ky

Re: Ulab Problems

Post by sprinkfitter » Tue Jan 19, 2021 4:00 am

Thank you for your responds. Made newbie mistake. object <module 'ulab'> is of type module
__name__ -- ulab
__version__ -- 0.54.0
set_printoptions -- <function>
get_printoptions -- <function>
array -- <class 'ndarray'>
arange -- <function>
eye -- <function>
linspace -- <function>
ones -- <function>
zeros -- <function>
linalg -- <module 'linalg'>
vector -- <module 'vector'>
numerical -- <module 'numerical'>
poly -- <module 'poly'>
fft -- <module 'fft'>
filter -- <module 'filter'>
compare -- <module 'compare'>
approx -- <module 'approx'>
user -- <module 'user'>
uint8 -- 66
int8 -- 98
uint16 -- 72
int16 -- 104
float -- 100

Code: Select all

try:
    from ulab import numpy as np
    from ulab import scipy as spy
except ImportError:
    import numpy as np
    import scipy as spy

x = np.array([1, 2, 3])
spy.special.erf(x)
When I run this I still get the error download ok
exec(open('testnumpy.py').read(),globals())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 5, in <module>
ImportError: no module named 'numpy'
Is there a bin file that would have all of ulab including numpy and scipy?

User avatar
rcolistete
Posts: 352
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil
Contact:

Re: Ulab Problems

Post by rcolistete » Wed Jan 20, 2021 9:01 pm

Follow ulab docs.
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).

sprinkfitter
Posts: 36
Joined: Wed Sep 27, 2017 1:42 pm
Location: Louisville Ky

Re: Ulab Problems

Post by sprinkfitter » Thu Jan 21, 2021 7:03 pm

Thank You for your insight on Ulab. I have read the docs and have not found the bin file with Numpy in it. Fairly new to Micropython would hope I could get a little bit more help. Even the new guy always looks at the docs. When they do not see something they ask a question. I know it must be in front of my eyes. With Covid in the states my eyes could be going bad.

Thanks

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Ulab Problems

Post by jimmo » Mon Jan 25, 2021 12:22 am

sprinkfitter wrote:
Thu Jan 21, 2021 7:03 pm
I have read the docs and have not found the bin file with Numpy in it.
There is no numpy for MicroPython, only ulab.

The maintainers of ulab don't provide a ESP32 build (only instructions on how to make it yourself -- https://github.com/v923z/micropython-ul ... sed-boards)

However rcolistete provides a pre-built bin for ESP32 (and other boards) at https://gitlab.com/rcolistete/micropyth ... _with_ulab

Post Reply