blinkstick-python icon indicating copy to clipboard operation
blinkstick-python copied to clipboard

ModuleNotFoundError: No module named 'usb'

Open bobejo opened this issue 1 year ago • 0 comments

Hi

I'm using a blinkstick nano on Ubuntu 22.04 and getting the following problem when using the library:

>>> from blinkstick import blinkstick Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/username/.local/lib/python3.10/site-packages/blinkstick/blinkstick.py", line 11, in <module> import usb.core ModuleNotFoundError: No module named 'usb' When checking the setup.py file it looks like it gathers the needed library based on the system it builds on and not where it will run. So on ubuntu it always installs pywinusb instead of pyusb.

Shouldnt it look something more like this?

- if sys.platform == "win32":
-     os_requires = [
-         "pywinusb"
-     ]
- else:
-     os_requires = [
-         "pyusb>=1.0.0"
-     ]

setup(
    name='BlinkStick',
    author='Arvydas Juskevicius',
    author_email='[email protected]',
    packages=find_packages(),
    scripts=["bin/blinkstick"],
    url='http://pypi.python.org/pypi/BlinkStick/',
    license='LICENSE.txt',
    description='Python package to control BlinkStick USB devices.',
    long_description=read('README.rst'),
-   install_requires=os_requires,
+  install_requires=['pywinusb;sys_platform=="win32"', 'pyusb>=1.0.0;sys_platform!="win32"'],
)

bobejo avatar Nov 01 '23 13:11 bobejo