/usr/bin/env: ‘python3’: Permission denied
-
Hello ! I wrote a python plugin for my duet and I get the following error when I start the plugin from the web interface:
/usr/bin/env: ‘python3’: Permission denied
I have installed the same plugin on another duet board, and it starts without errors, but on this one it somehow doens't work... I have compared the python, dsf-python, duetsoftwareframework versions on both machines and they have the same packages.
Is there something that could be mis-configured on the raspberry PI ?
Thank you for your help !
Antoine Brunner
-
@Ant1 Make sure you are using UNIX line endings, AFAIR the script interpreter had issues with the extra
CR
at the end of the first line, which are generated by Windows text editors. If that doesn't help, try to replace the first line with#/usr/bin/python3
and check if that fixes it. -
I have tried to change the line ending with
dos2unix
but it still gives me the same error...If I change the first line to
#!/usr/bin/python3
, as you suggested, I get the following error:from pyzbar.pyzbar import decode, ZBarSymbol ... ImportError: Unable to find zbar shared library
Which is weird, because I have installed this library and all its dependencies, and I can get the import to work in a python3 interpreter, with no errors:
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import pyzbar >>>
So it seems to me that something is not quite right with the DSF environment or PATH... Any ideas ?
-
@Ant1 DSF plugins run as a different user (i.e.
dsf
) so Python dependencies from your local user scope cannot be loaded unless they're globally installed or installed by DSF. You need to change your plugin manifest to have them installed by pip:... "sbcPythonDependencies": ["pyzbar"], ...
-
@chrishamm
Yes I have already done that. Myplugin.json
contains the following:"sbcPackageDependencies": ["libzbar0", "python3-picamera2"], "sbcPythonDependencies": ["opencv-python", "pyzbar", "Pillow", "numpy", "dsf-python>=3.5.0.2rc2"],
-
@Ant1 Can you share the full plugin ZIP?
-
What sbcPermissions have you got in plugin.json? Specifically, have you got launchProcesses? Might be best to post your whole config.json
You might be running up against apparmor. You can disable apparmor (to establish whether that's the problem) by editing /opt/dsf/conf/plugins.json and set DisableAppArmor to true. That's a potential security flaw, so once you've established it's the cause you should fix it properly and then put apparmor back on (probably).
It's possible one of your systems has apparmor enabled and the other has it disabled (or doesn't have it at all).
-
@achrn
Thank you a lot ! This was indeed the problem, I didn't havelaunchProcesses
. I removed it at some point because I didn't think it was necessary to run the python script, but since it depends on an external library, that might cause the issueThank you !