darrylb123 / usbrelay

Control usb relay - based on hidapi
GNU General Public License v2.0
310 stars 98 forks source link

Raspberry pi 4 - python #106

Closed ArashiCZ closed 11 months ago

ArashiCZ commented 11 months ago

Hello.

I'm running 64bit raspios lite. I tried to use pip3 install usbrelay-py, however i'm constantly getting this error:

` sudo pip3 install usbrelay-py Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting usbrelay-py Using cached usbrelay_py-1.0.tar.gz (4.1 kB) Installing build dependencies ... done Getting requirements to build wheel ... error ERROR: Command errored out with exit status 1: command: /usr/bin/python3 /tmp/tmp60x1dyl7_in_process.py get_requires_for_build_wheel /tmp/tmpkxqs836 cwd: /tmp/pip-install-erk9tjr/usbrelay-py_039f083e8680440686396df0d7a080d8 Complete output (15 lines): Traceback (most recent call last): File "/tmp/tmp60x1dyl7_in_process.py", line 280, in main() File "/tmp/tmp60x1dyl7_in_process.py", line 263, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "/tmp/tmp60x1dyl7_in_process.py", line 114, in get_requires_for_build_wheel return hook(config_settings) File "/usr/local/lib/python3.9/dist-packages/setuptools/build_meta.py", line 355, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) File "/usr/local/lib/python3.9/dist-packages/setuptools/build_meta.py", line 325, in _get_build_requires self.run_setup() File "/usr/local/lib/python3.9/dist-packages/setuptools/build_meta.py", line 341, in run_setup exec(code, locals()) File "", line 17, in ImportError: cannot import name 'setuptools' from 'setuptools' (/usr/local/lib/python3.9/dist-packages/setuptools/init.py)

WARNING: Discarding https://files.pythonhosted.org/packages/0c/ad/4036a83246a7f7e59919323fd4d1f589284b9afe539fe33c0a8036bd12f2/usbrelay_py-1.0.tar.gz#sha256=d0c74c358132ce1055487ebd6ad59bb84209d8417d670ff9d61c798eb8b783d1 (from https://pypi.org/simple/usbrelay-py/). Command errored out with exit status 1: /usr/bin/python3 /tmp/tmp60x1dyl7_in_process.py get_requires_for_build_wheel /tmp/tmpkxq_s836 Check the logs for full command output. ERROR: Could not find a version that satisfies the requirement usbrelay-py ERROR: No matching distribution found for usbrelay-py ` Tried to reinstall setuptools, update pip, few other things and nothing.

wentasah commented 11 months ago

Cannot you just apt install python3-usbrelay?

darrylb123 commented 11 months ago

Don't use pip. It's a binary library and is dependent on another binary library. Use the GitHub source to build and install it.

On Wed, Sep 27, 2023, 2:41 AM ArashiCZ @.***> wrote:

Hello.

I'm running 64bit raspios lite. I tried to use pip3 install usbrelay-py, however i'm constantly getting this error: ` sudo pip3 install usbrelay-py Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting usbrelay-py Using cached usbrelay_py-1.0.tar.gz (4.1 kB) Installing build dependencies ... done Getting requirements to build wheel ... error ERROR: Command errored out with exit status 1: command: /usr/bin/python3 /tmp/tmp60x1dyl7_in_process.py get_requires_for_build_wheel /tmp/tmpkxqs836 cwd: /tmp/pip-install-erk9tjr/usbrelay-py_039f083e8680440686396df0d7a080d8 Complete output (15 lines): Traceback (most recent call last): File "/tmp/tmp60x1dyl7_in_process.py", line 280, in main() File "/tmp/tmp60x1dyl7_in_process.py", line 263, in main json_out['return_val'] = hook(*hook_input['kwargs']) File "/tmp/tmp60x1dyl7_in_process.py", line 114, in get_requires_for_build_wheel return hook(config_settings) File "/usr/local/lib/python3.9/dist-packages/setuptools/build_meta.py", line 355, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) File "/usr/local/lib/python3.9/dist-packages/setuptools/build_meta.py", line 325, in _get_build_requires self.run_setup() File "/usr/local/lib/python3.9/dist-packages/setuptools/build_meta.py", line 341, in run_setup exec(code, locals()) File "", line 17, in ImportError: cannot import name 'setuptools' from 'setuptools' (/usr/local/lib/python3.9/dist-packages/setuptools/init*.py)

WARNING: Discarding https://files.pythonhosted.org/packages/0c/ad/4036a83246a7f7e59919323fd4d1f589284b9afe539fe33c0a8036bd12f2/usbrelay_py-1.0.tar.gz#sha256=d0c74c358132ce1055487ebd6ad59bb84209d8417d670ff9d61c798eb8b783d1 (from https://pypi.org/simple/usbrelay-py/). Command errored out with exit status 1: /usr/bin/python3 /tmp/tmp60x1dyl7_in_process.py get_requires_for_build_wheel /tmp/tmpkxq_s836 Check the logs for full command output. ERROR: Could not find a version that satisfies the requirement usbrelay-py ERROR: No matching distribution found for usbrelay-py ` Tried to reinstall setuptools, update pip, few other things and nothing.

— Reply to this email directly, view it on GitHub https://github.com/darrylb123/usbrelay/issues/106, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTSUVJI5E3TSQMRVSQ3FDDX4MATRANCNFSM6AAAAAA5IAT3UQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

ArashiCZ commented 11 months ago

Cannot you just apt install python3-usbrelay?

Apparently not. image

ArashiCZ commented 11 months ago

Don't use pip. It's a binary library and is dependent on another binary library. Use the GitHub source to build and install it. On Wed, Sep 27, 2023, 2:41 AM ArashiCZ @.*> wrote: Hello. I'm running 64bit raspios lite. I tried to use pip3 install usbrelay-py, however i'm constantly getting this error: sudo pip3 install usbrelay-py Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting usbrelay-py Using cached usbrelay_py-1.0.tar.gz (4.1 kB) Installing build dependencies ... done Getting requirements to build wheel ... error ERROR: Command errored out with exit status 1: command: /usr/bin/python3 /tmp/tmp60x1dyl7_in_process.py get_requires_for_build_wheel /tmp/tmpkxq_s836 cwd: /tmp/pip-install-erk9tjr_/usbrelay-py_039f083e8680440686396df0d7a080d8 Complete output (15 lines): Traceback (most recent call last): File "/tmp/tmp60x1dyl7_in_process.py", line 280, in main() File "/tmp/tmp60x1dyl7_in_process.py", line 263, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "/tmp/tmp60x1dyl7_in_process.py", line 114, in get_requires_for_build_wheel return hook(config_settings) File "/usr/local/lib/python3.9/dist-packages/setuptools/build_meta.py", line 355, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) File "/usr/local/lib/python3.9/dist-packages/setuptools/build_meta.py", line 325, in _get_build_requires self.run_setup() File "/usr/local/lib/python3.9/dist-packages/setuptools/build_meta.py", line 341, in run_setup exec(code, locals()) File "", line 17, in ImportError: cannot import name 'setuptools' from 'setuptools' (/usr/local/lib/python3.9/dist-packages/setuptools/*init*.py) WARNING: Discarding https://files.pythonhosted.org/packages/0c/ad/4036a83246a7f7e59919323fd4d1f589284b9afe539fe33c0a8036bd12f2/usbrelay_py-1.0.tar.gz#sha256=d0c74c358132ce1055487ebd6ad59bb84209d8417d670ff9d61c798eb8b783d1 (from https://pypi.org/simple/usbrelay-py/). Command errored out with exit status 1: /usr/bin/python3 /tmp/tmp60x1dyl7_in_process.py get_requires_for_build_wheel /tmp/tmpkxq_s836 Check the logs for full command output. ERROR: Could not find a version that satisfies the requirement usbrelay-py ERROR: No matching distribution found for usbrelay-py Tried to reinstall setuptools, update pip, few other things and nothing. — Reply to this email directly, view it on GitHub <#106>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTSUVJI5E3TSQMRVSQ3FDDX4MATRANCNFSM6AAAAAA5IAT3UQ . You are receiving this because you are subscribed to this thread.Message ID: *@.>

This is what i get when running the "make" command inside the folder usbrelay_py.

pi@juhu:~/python_tests/usbrelay/usbrelay-master/usbrelay_py $ make
make: *** No rule to make target '../libusbrelay.so.1.1', needed by 'all'.  Stop.
darrylb123 commented 11 months ago

I'd be careful with the Debian package. It's not maintained.

On Wed, Sep 27, 2023, 3:57 PM ArashiCZ @.***> wrote:

Cannot you just apt install python3-usbrelay?

Apparently not. [image: image] https://user-images.githubusercontent.com/10303007/270876344-6f1d6240-957c-48d2-aa95-c319f0c3b8e6.png

— Reply to this email directly, view it on GitHub https://github.com/darrylb123/usbrelay/issues/106#issuecomment-1736749760, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTSUVNNDZ4JDGXO6KPOCATX4O54NANCNFSM6AAAAAA5IAT3UQ . You are receiving this because you commented.Message ID: @.***>

mefuller commented 11 months ago

The Fedora package is fully up-to-date!

darrylb123 commented 11 months ago

That's odd. There is a Debian python3-usbrelay package that is the current version. Can you just install usbrelay package? On Wed, Sep 27, 2023, 3:57 PM ArashiCZ @.***> wrote:

Cannot you just apt install python3-usbrelay?

Apparently not. [image: image] https://user-images.githubusercontent.com/10303007/270876344-6f1d6240-957c-48d2-aa95-c319f0c3b8e6.png

— Reply to this email directly, view it on GitHub https://github.com/darrylb123/usbrelay/issues/106#issuecomment-1736749760, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTSUVNNDZ4JDGXO6KPOCATX4O54NANCNFSM6AAAAAA5IAT3UQ . You are receiving this because you commented.Message ID: @.***>

darrylb123 commented 11 months ago

Ha, almost. Did you see my mastodon post to you and Michal :)

On Wed, Sep 27, 2023, 4:18 PM Mark E Fuller @.***> wrote:

The Fedora package is fully up-to-date!

— Reply to this email directly, view it on GitHub https://github.com/darrylb123/usbrelay/issues/106#issuecomment-1736769897, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTSUVM276A6QEZ7W6AID5LX4PAK3ANCNFSM6AAAAAA5IAT3UQ . You are receiving this because you commented.Message ID: @.***>

ArashiCZ commented 11 months ago

I tried to use atleast the "Sudo usbrelay" that i installed with apt, which works perfectly by the way with "| sed" and locating lines (relay) after the line with "Number of Relays" but it behaves strangly. It doesn't catch the line with the serial numbers.

I would like to avoid this by using the python extension. Would someone help me a guide me how to build the library for python. I'm planing to use it my upcoming project that is build upon these usb relays (home automation), is it possible to just copy the library after building it to differnt pi ? (same hw).

Thank you.

mefuller commented 11 months ago

@darrylb123 I did see your message, which is why v1.2.1 is in Rawhide, and within a couple days of clearing testing on F39 - F37: https://src.fedoraproject.org/rpms/usbrelay

darrylb123 commented 11 months ago

The documentation to build usbrelay and python extension is in the readme on GitHub. If you installed the package, you should be able to check the manual page. Also, the option flags are output with the -h flag: $ usbrelay -h usbrelay: invalid option -- 'h' Try usbrelay --help' orusbrelay --usage' for more information. @.*** ~]$ usbrelay --help Usage: usbrelay [OPTION...] [ACTION...] Control or query USB HID relays.

-d, --debug Produce debugging output -e, --export-id=DEV Print relay ID of the given DEV (/dev/hidrawXX) in udev-compatible format -q, --quiet Be quiet -?, --help Give this help list --usage Give a short usage message -V, --version Print program version

Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options.

Without ACTION, the actual state of all relays is printed to stdout. ACTION can be one of: RELID_N=[0|1] to switch the N-th relay off or on RELID_0=NEWID to change relay ID

Report bugs to https://github.com/darrylb123/usbrelay/issues.

On Wed, Sep 27, 2023, 4:31 PM ArashiCZ @.***> wrote:

I tried to use atleast the "Sudo usbrelay" that i installed with apt, which works perfectly by the way with "| sed" and locating lines (relay) after the line with "Number of Relays" but it behaves strangly. It doesn't catch the line with the serial numbers.

I would like to avoid this by using the python extension. Would someone help me a guide me how to build the library for python. I'm planing to use it my upcoming project that is build upon these usb relays (home automation), is it possible to just copy the library after building it to differnt pi ? (same hw).

Thank you.

— Reply to this email directly, view it on GitHub https://github.com/darrylb123/usbrelay/issues/106#issuecomment-1736783000, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTSUVM2NQVCTMEDKONTSEDX4PB5BANCNFSM6AAAAAA5IAT3UQ . You are receiving this because you commented.Message ID: @.***>

ArashiCZ commented 11 months ago

The documentation to build usbrelay and python extension is in the readme on GitHub. If you installed the package, you should be able to check the manual page. Also, the option flags are output with the -h flag: $ usbrelay -h usbrelay: invalid option -- 'h' Try usbrelay --help' orusbrelay --usage' for more information. @. ~]$ usbrelay --help Usage: usbrelay [OPTION...] [ACTION...] Control or query USB HID relays. -d, --debug Produce debugging output -e, --export-id=DEV Print relay ID of the given DEV (/dev/hidrawXX) in udev-compatible format -q, --quiet Be quiet -?, --help Give this help list --usage Give a short usage message -V, --version Print program version Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options. Without ACTION, the actual state of all relays is printed to stdout. ACTION can be one of: RELID_N=[0|1] to switch the N-th relay off or on RELID_0=NEWID to change relay ID Report bugs to https://github.com/darrylb123/usbrelay/issues. On Wed, Sep 27, 2023, 4:31 PM ArashiCZ @.> wrote: I tried to use atleast the "Sudo usbrelay" that i installed with apt, which works perfectly by the way with "| sed" and locating lines (relay) after the line with "Number of Relays" but it behaves strangly. It doesn't catch the line with the serial numbers. I would like to avoid this by using the python extension. Would someone help me a guide me how to build the library for python. I'm planing to use it my upcoming project that is build upon these usb relays (home automation), is it possible to just copy the library after building it to differnt pi ? (same hw). Thank you. — Reply to this email directly, view it on GitHub <#106 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTSUVM2NQVCTMEDKONTSEDX4PB5BANCNFSM6AAAAAA5IAT3UQ . You are receiving this because you commented.Message ID: @.***>

Yes, I looked at the help, but as i posted before, I cannot build the library according to the instructions. pi@juhu:~/python_tests/usbrelay/usbrelay-master/usbrelay_py $ make make: *** No rule to make target '../libusbrelay.so.1.1', needed by 'all'. Stop.

darrylb123 commented 11 months ago

You have to build the main library first. Run make in the top level directory first then sudo make install, then cd to usbrelay_py and run make and sudo make install.

On Wed, Sep 27, 2023 at 5:13 PM ArashiCZ @.***> wrote:

The documentation to build usbrelay and python extension is in the readme on GitHub. If you installed the package, you should be able to check the manual page. Also, the option flags are output with the -h flag: $ usbrelay -h usbrelay: invalid option -- 'h' Try usbrelay --help' or usbrelay --usage' for more information. @.** ~]$ usbrelay --help Usage: usbrelay [OPTION...] [ACTION...] Control or query USB HID relays. -d, --debug Produce debugging output -e, --export-id=DEV Print relay ID of the given DEV (/dev/hidrawXX) in udev-compatible format -q, --quiet Be quiet -?, --help Give this help list --usage Give a short usage message -V, --version Print program version Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options. Without ACTION, the actual state of all relays is printed to stdout. ACTION can be one of: RELID_N=[0|1] to switch the N-th relay off or on RELID_0=NEWID to change relay ID Report bugs to https://github.com/darrylb123/usbrelay/issues. … <#m1245572597775667863> On Wed, Sep 27, 2023, 4:31 PM ArashiCZ @.> wrote: I tried to use atleast the "Sudo usbrelay" that i installed with apt, which works perfectly by the way with "| sed" and locating lines (relay) after the line with "Number of Relays" but it behaves strangly. It doesn't catch the line with the serial numbers. I would like to avoid this by using the python extension. Would someone help me a guide me how to build the library for python. I'm planing to use it my upcoming project that is build upon these usb relays (home automation), is it possible to just copy the library after building it to differnt pi ? (same hw). Thank you. — Reply to this email directly, view it on GitHub <#106 (comment) https://github.com/darrylb123/usbrelay/issues/106#issuecomment-1736783000>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTSUVM2NQVCTMEDKONTSEDX4PB5BANCNFSM6AAAAAA5IAT3UQ https://github.com/notifications/unsubscribe-auth/ABTSUVM2NQVCTMEDKONTSEDX4PB5BANCNFSM6AAAAAA5IAT3UQ . You are receiving this because you commented.Message ID: @.*>

Yes, I looked at the help, but as i posted before, I cannot build the library according to the instructions. @.:~/python_tests/usbrelay/usbrelay-master/usbrelay_py $ make make: No rule to make target '../libusbrelay.so.1.1', needed by 'all'. Stop.

— Reply to this email directly, view it on GitHub https://github.com/darrylb123/usbrelay/issues/106#issuecomment-1736832538, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTSUVIL6KB7UBZS4OYRMXDX4PGZXANCNFSM6AAAAAA5IAT3UQ . You are receiving this because you were mentioned.Message ID: @.***>

ArashiCZ commented 11 months ago

You have to build the main library first. Run make in the top level directory first then sudo make install, then cd to usbrelay_py and run make and sudo make install. On Wed, Sep 27, 2023 at 5:13 PM ArashiCZ @.> wrote: The documentation to build usbrelay and python extension is in the readme on GitHub. If you installed the package, you should be able to check the manual page. Also, the option flags are output with the -h flag: $ usbrelay -h usbrelay: invalid option -- 'h' Try usbrelay --help' or usbrelay --usage' for more information. @. ~]$ usbrelay --help Usage: usbrelay [OPTION...] [ACTION...] Control or query USB HID relays. -d, --debug Produce debugging output -e, --export-id=DEV Print relay ID of the given DEV (/dev/hidrawXX) in udev-compatible format -q, --quiet Be quiet -?, --help Give this help list --usage Give a short usage message -V, --version Print program version Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options. Without ACTION, the actual state of all relays is printed to stdout. ACTION can be one of: RELID_N=[0|1] to switch the N-th relay off or on RELID_0=NEWID to change relay ID Report bugs to https://github.com/darrylb123/usbrelay/issues. … <#m1245572597775667863> On Wed, Sep 27, 2023, 4:31 PM ArashiCZ @.> wrote: I tried to use atleast the "Sudo usbrelay" that i installed with apt, which works perfectly by the way with "| sed" and locating lines (relay) after the line with "Number of Relays" but it behaves strangly. It doesn't catch the line with the serial numbers. I would like to avoid this by using the python extension. Would someone help me a guide me how to build the library for python. I'm planing to use it my upcoming project that is build upon these usb relays (home automation), is it possible to just copy the library after building it to differnt pi ? (same hw). Thank you. — Reply to this email directly, view it on GitHub <#106 (comment) <#106 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTSUVM2NQVCTMEDKONTSEDX4PB5BANCNFSM6AAAAAA5IAT3UQ https://github.com/notifications/unsubscribe-auth/ABTSUVM2NQVCTMEDKONTSEDX4PB5BANCNFSM6AAAAAA5IAT3UQ . You are receiving this because you commented.Message ID: @.> Yes, I looked at the help, but as i posted before, I cannot build the library according to the instructions. @.:~/python_tests/usbrelay/usbrelay-master/usbrelay_py $ make make: No rule to make target '../libusbrelay.so.1.1', needed by 'all'. Stop. — Reply to this email directly, view it on GitHub <#106 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTSUVIL6KB7UBZS4OYRMXDX4PGZXANCNFSM6AAAAAA5IAT3UQ . You are receiving this because you were mentioned.Message ID: @.***>

Oh, I'm sorry @darrylb123 . That totaly went over my head, Will do that asap and let you know.

Thank you.