Module usb not found

Intro
I’m brand-spanking new to python. The project that I want to use Python for involves extracting information of USB related information of connected devices. The main information that I’m looking for are the USB product, VID and PID and the associated serial port (COM* in Windows, /dev/tty* in Linux (and possibly Mac)…

Question 1
Looking around on the web I found code that uses import usb. Trying to run the code results in the error ModuleNotFoundError: No module named 'usb'.

OK, so I installed the module using pip

C:\Users\bugge\OneDrive\Documents\Python\USBdevices>py -m pip install usb
Collecting usb
  Using cached usb-0.0.83.dev0-py3-none-any.whl.metadata (4.9 kB)
Using cached usb-0.0.83.dev0-py3-none-any.whl (30 kB)
Installing collected packages: usb
Successfully installed usb-0.0.83.dev0

Next I tried again and still get the same error. Where do I go wrong

The minimal reproducable example

import usb

Python version is 3.13.1 on Windows 11 (the Linux part will come later :wink:)

What am I missing?

Question 2
What would be the preferred module/package to achieve what I need for a operating system independent approach? I did find the pyusb package and it might be more suitable than the usb module?


Thanks in advance for your advice and time.



Wim

usb does not seem the right project. It’s home page reads
" United States of Browsers
A project to combine and organize history and bookmarks across multiple browsers and browser profiles."
Perhaps you need pyusb instead.
Ciao,
R

Thanks for the answer. That would answer the second question and I will look at that.

What about the first one?

@barry-scott , apologies for giving you extra work; thanks for editing the topic title.

You can find information about almost all libraries you would need by searching for “python usb library” (substitute relevant terms.)

The ‘usb’ library is not found in this manner, which means it is probably not maintained. If things have been unmaintained sufficiently long they can no longer be installed via pip. I wouldn’t worry about it. Just pip install pyusb. (Which I did find by googling “Python import usb”)

import usb does not work because the project exposes a module named ‘united_states_of_browsers’, not ‘usb’ (see https://github.com/kchawla-pi/united-states-of-browsers)
Many python projects have differen module and package names.
Take pyusb as an example. The package is pyusb, but its main module is named simply ‘usb’
Usually the package documentation shows the module name