Mbed CLI problem


Right this morning the mbed online compiler showed an internal error and for this reason I downloaded embed CLI in order to continue my work. I am using an MBED OS 2 platform (Nucleo F33R8). After importing my program in mbed cli I tried to compile it (commands mbed detect, mbed toolchain etc) following the instructions from https://www.youtube.com/watch?v=PI1Kq9RSN_Y&list=PLiVCejcvpseuWWmJc9uELYww-xindjZCH&index=1
However mbed detect raises the following error:
ImportError: No module named elftools.common.py3compat
[mbed] ERROR: Failed to correctly detect all targets (run with ‘-vv’ for more information)
I then tried "pip install elftools’’ and I get the following error:
Cache entry deserialization failed, entry ignored
Could not find a version that satisfies the requirement elftools (from versions: )
No matching distribution found for elftools
You are using pip version 9.0.1, however version 20.1 is available.
You should consider upgrading via the ‘python -m pip install --upgrade pip’ command.

What can I do to solve this in order to compile my program through CLI ?

You can try pyelftools.

pip install pyelftools