The APT method of installing Thonny only installs the 3.7 version of Thonny from the archives.
I needed to install the newest version and Github suggested to use the pip install method.
After uninstalling the old version this method appeared to install without errors and even setting up a .desktop file on the Desktop.
However when I double clicked on the Icon nothing happened. The properties section showed that the file is executed thus:
/home/pi/apps/thonny/bin/thonny %F
From a terminal typing: thonnyin the home screen and in the above directory does in fact invoke thonny 4.1.4
Indeed there is an executable file with that name residing in that directory.
However when I execute /home/pi/apps/thonny/bin/thonny %F in terminal nothing happens.
Also editing the .desktop file and replacing the full entry with just thonny does not work either.
Your story makes me think that thonny which is invoked from terminal is not /home/pi/apps/thonny/bin/thonny. To verify this theory you can use which thonny command. Next to it, you can search your disk for all files named thonny.
Considering mention of pip, I can suppose that application in question is written in Python. That is thonny has to be an executable shell script. You can have a look at that script and deduce command line which actually starts thonny. I.e. something like python3 -m thonny %1
Previously I stated that editing the .desktop file with Exec thonny does nothing.
Going back to the .desktop file again I noted that there are 2 sections where the Exec command is invoked.
These are:
[Desktop Entry]
and also
[Desktop Action Edit]
When I edited BOTH Exec entries I was able to run thonny from desktop normally.
returning to your suggestion, which thonny returns:
/home/pi/.local/bin/thonny
Doing python3 -m thonny %1 runs thonny as well.
The question remains, why did the original install put that former directory in the .desktop file.
That directory does actually exist and it does actually contain an executable file called thonny which is just 401 bytes long. When I try to run this file
using the full path this file actually tries to run but generates an error. This file is actually a bash file of sorts which is itself trying to invoke python3.10, itself residing in this directory and is more than 20Mbytes long. It seems that it is this python version which is in the end causing the error. when I try to run python3.10 I get:
Cannot execute binary file: Execute format error
I now think it is the latter which requires further investigation.
N.B. that when I run thonny from desktop it invokes python 3.8 which comes with the original Mate installation.
allows for suspicion that .deb package tries to install its own local Python interpreter alongside with Thonny itself. And that results in a mess provided that Python is already installed system-wide. On the other hand, pip install just adds new module(s) to the existing Python infrastructure and does not introduce conflicts.
BTW dpkg -c <package>.deb command lists a contents of a package and might help to verify mentioned guess.