Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    /usr/bin/env: ‘python3’: Permission denied

    Scheduled Pinned Locked Moved
    DSF Development
    3
    8
    565
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Ant1undefined
      Ant1
      last edited by

      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

      chrishammundefined 1 Reply Last reply Reply Quote 0
      • chrishammundefined
        chrishamm administrators @Ant1
        last edited by

        @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.

        Duet software engineer

        Ant1undefined 1 Reply Last reply Reply Quote 0
        • Ant1undefined
          Ant1 @chrishamm
          last edited by

          @chrishamm

          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 ?

          chrishammundefined 1 Reply Last reply Reply Quote 0
          • chrishammundefined
            chrishamm administrators @Ant1
            last edited by

            @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"],
            ...
            

            Duet software engineer

            Ant1undefined 1 Reply Last reply Reply Quote 0
            • Ant1undefined
              Ant1 @chrishamm
              last edited by

              @chrishamm
              Yes I have already done that. My plugin.json contains the following:

                "sbcPackageDependencies": ["libzbar0", "python3-picamera2"],
                "sbcPythonDependencies": ["opencv-python", "pyzbar", "Pillow", "numpy", "dsf-python>=3.5.0.2rc2"],
              
              chrishammundefined 1 Reply Last reply Reply Quote 0
              • chrishammundefined
                chrishamm administrators @Ant1
                last edited by

                @Ant1 Can you share the full plugin ZIP?

                Duet software engineer

                1 Reply Last reply Reply Quote 0
                • achrnundefined
                  achrn
                  last edited by achrn

                  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).

                  Ant1undefined 1 Reply Last reply Reply Quote 1
                  • Ant1undefined
                    Ant1 @achrn
                    last edited by

                    @achrn
                    Thank you a lot ! This was indeed the problem, I didn't have launchProcesses. 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 issue 🙂

                    Thank you !

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post
                    Unless otherwise noted, all forum content is licensed under CC-BY-SA