I'll start with the fix, then follow with "the boring details":
The Fix
- Download the version of the "Arduino_TensorFlowLite" library that was created by Arduino from this link:
https://downloads.arduino.cc/libraries/github.com/bcmi-labs/Arduino_TensorFlowLite-2.4.0-ALPHA.zip - Wait for the download to finish.
- Select "Libraries" from the menu on the left side of the "Arduino Web Editor" window.
- Click the upward pointing arrow button ("Import") to the right side of the LIBRARY MANAGER button.
- If you get a popup about importing your sketchbook, click the IMPORT button.
- Select the "ZIP" file that contains the library.
- Click the Open button.
- Wait for "Arduino Web Editor" to display the notification that the library was successfully imported.
- Click the OK button.
You should now be able to compile your sketch for the Pico again without getting the errors.
Explanation
For some years, Arduino maintained a library named "Arduino_TensorFlowLite". This was "TensorFlow Lite Micro" packaged in a form that could be distributed as an Arduino library via the Arduino Library Manager.
The "TensorFlow Lite Micro" maintainers later created their own dedicated Arduino library project:
They requested the removal of the "Arduino_TensorFlowLite" library from Arduino Library Manager:
All the libraries of the Arduino Library Manager are pre-installed on Arduino Cloud. So you can compile Arduino sketches that depend on any of those libraries without having to first install the dependencies. Your sketch has a dependency on the TensorFlow Lite Micro library so it was using that library that used to be in Arduino Library Manager. When it was removed from library manager at the request of the "TensorFlow Lite Micro" maintainers, the dependency of your sketch was no longer available from the Arduino Cloud servers.
You might expect the removal of the dependency to result in an error like "TensorFlowLite.h No such file or directory
", and that is what would happen if you tried to compile your sketch on your local computer after deleting the "Arduino_TensorFlowLite" library installation. But there are >5000 libraries in Arduino Library Manager, so when your sketch contains an #include
directive for any common header filename, there will often be multiple libraries available that contain that header file. In this case, Arduino Cloud tries to guess the best library to use, and usually does a pretty good job at that. This was the case for the #include
directives in your sketch. When the "Arduino_TensorFlowLite" library was available, Arduino Cloud correctly chose that library. But once that library was removed, it had to pick another library that happened to contain the specified files. You can see that happening in the verbose compilation output here:
Alternatives for TensorFlowLite.h: [harvard_tinymlx_1_2_3_alpha@1.2.3-Alpha]
ResolveLibrary(TensorFlowLite.h)
-> candidates: [harvard_tinymlx_1_2_3_alpha@1.2.3-Alpha]
So instead of using the , your sketch now uses the "Harvard_TinyMLx" library. This change in library dependency is the cause of the errors you experienced.
In theory, you should be able to use TensorFlow's new official Arduino library. After all, Arduino's library was only a mirror of the same "TensorFlow Lite Micro" project. I don't know anything about this "Harvard_TinyMLx" library, but it is also based on "TensorFlow Lite Micro", so theoretically it should also be usable. Unfortunately I did not have any success getting the sketch to compile with TensorFlow's library despite quite some trying. So out of desperation I dug up a download for Arduino's library.
Once you manually install that library in your Arduino Cloud account, it will once more be selected instead of the "Harvard_TinyMLx" library when compiling:
Multiple libraries were found for "TensorFlowLite.h"
Used: /mnt/create-efs/webide/a8/06/a806d47ed6d3f06510574743ac5887d3:pert_test/libraries_v2/Arduino_TensorFlowLite
Not used: /home/builder/opt/libraries/harvard_tinymlx_1_2_3_alpha
Please note that, following the removal request from TensorFlow, Arduino no longer maintains or supports the "Arduino_TensorFlowLite" library and there is no guarantee the download link I shared above will continue to work. So you might want to store a copy of that downloaded ZIP file in a safe place.