Skip to content

ModuleNotFoundError: No module named 'usb' #91

Description

@bobejo

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='arvydas@arvydas.co.uk',
    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"'],
)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions