Installing libraries on ESP32
Installing libraries on ESP32
Hi,
I'm interested in installing additional module from https://github.com/micropython/micropython-lib
but- I guess I don't understand explanation at the bottom of the page.
im looking for - `datetime` replacement
Guy
I'm interested in installing additional module from https://github.com/micropython/micropython-lib
but- I guess I don't understand explanation at the bottom of the page.
im looking for - `datetime` replacement
Guy
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Installing libraries on ESP32
You should be able to install it using upip as described. What happens when you try?
Alternatively just copy datetime.py from micropython-lib to the ESP32: this should work as it's a simple library comprising just that one file. I have a clone of micropython-lib on my local hardware for such purposes.
Alternatively just copy datetime.py from micropython-lib to the ESP32: this should work as it's a simple library comprising just that one file. I have a clone of micropython-lib on my local hardware for such purposes.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Installing libraries on ESP32
1) I was copied that spcific file, which raised an error running it (placed in datetime directory )pythoncoder wrote: ↑Tue Jul 24, 2018 5:59 amYou should be able to install it using upip as described. What happens when you try?
Alternatively just copy datetime.py from micropython-lib to the ESP32: this should work as it's a simple library comprising just that one file. I have a clone of micropython-lib on my local hardware for such purposes.
Code: Select all
>>> import datetime.datetime
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
MemoryError: memory allocation failed, allocating 136 bytes
>>>
Code: Select all
micropython -m upip install micropython-pystone
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Installing libraries on ESP32
1. I suggest trying again without using a datetime directory. To use a directory structure you need to understand Python packages and __init__.py.
2. That invocation line is to install to a PC under the Unix build.
2. That invocation line is to install to a PC under the Unix build.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Installing libraries on ESP32
1. succeeded. can you adress to syntax examples ?pythoncoder wrote: ↑Tue Jul 24, 2018 12:35 pm1. I suggest trying again without using a datetime directory. To use a directory structure you need to understand Python packages and __init__.py.
2. That invocation line is to install to a PC under the Unix build.
2. still don't understand. Is this some kind of a build under linux ? when i try upip under repl - it does not succeed
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Installing libraries on ESP32
Python packages are a very long established feature of the Python language and are not MicroPython specific. I suggest a book or online tutorial on the language.
If you have an ESP32 connected to the internet you should be able to use upip. What invocation line are you using and what error message do you see?
If you have an ESP32 connected to the internet you should be able to use upip. What invocation line are you using and what error message do you see?
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Installing libraries on ESP32
I use Python for the past year and I know how to work with PIP using Linux. On Linux I type PIP command using terminal. Now on Micropython you don't have a command line as in Linux .... so when I want to install any upip package from the internet ( say dataetime for example )- how and where do you exactly type those commands ?pythoncoder wrote: ↑Tue Jul 24, 2018 5:41 pmPython packages are a very long established feature of the Python language and are not MicroPython specific. I suggest a book or online tutorial on the language.
If you have an ESP32 connected to the internet you should be able to use upip. What invocation line are you using and what error message do you see?
repl ? rshell ?
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Installing libraries on ESP32
You get a command line by linking the ESP32 to a PC using a USB cable and running a terminal emulator on the PC. If you're using Linux I recommend rshell. I'm not well up on other OS's, but I gather Windows users recommend Putty if rshell gives problems.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Installing libraries on ESP32
right- so I have ESP32 connected, and using rshell successfully to connect ot it.
next step - enter repl and use upip to install?
next step - enter repl and use upip to install?
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Installing libraries on ESP32
If you've connected the ESP to the internet it should work.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.