Getting started and encountering "ModuleNotFoundError"

Hi all,

I’m sorry to ask something so basic, but I’ve installed pylabrobot, but get an error when attempting to import anything.

When I call

from pylabrobot.centrifuge import Centrifuge

I get the error:

ModuleNotFoundError: No module named ‘pylabrobot.centrifuge’

Same with the liquid handler class. Why am I getting this error? I’ve looked all over for some step I’m missing, but as far as I can tell, I’ve installed the software normally, but it gives an error when I try to run the first line of example code for any operation. Any advice?

Thanks!

welcome to the forum!

first, did you install from pypi or from git? pypi is outdated and i recommend installing from source. Installation — PyLabRobot documentation

PyPi. I ran into problems trying to install from git, but I’ll try again and report back. Thanks.

what issue? lmk if i can help

I need to check my notes, as it was a week or two ago, but I will definitely try soon and come back with updates. Thanks so much for your assistance!

1 Like

Alright. I tried to install through git again and this time it worked! However now I’m trying to find guidance on how to actually connect to and initialize an Agilent VSpin centrifuge.

I can load the specific module, but I’m getting to an error here:

$ from pylabrobot.centrifuge import Centrifuge, VSpin
$ cf = Centrifuge(name = ‘centrifuge’, backend = VSpin(bucket_1_position=0), size_x= 1, size_y=1, size_z=1)
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\gross001\Projects\Pylabrobot\pylabrobot\pylabrobot\centrifuge\vspin.py”, line 34, in init
self.dev = Device(lazy_open=True, device_id=device_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\gross001\Projects\Pylabrobot\env\Lib\site-packages\pylibftdi\device.py”, line 201, in init
self.fdll = self.driver.fdll
^^^^^^^^^^^^^^^^
File “C:\Users\gross001\Projects\Pylabrobot\env\Lib\site-packages\pylibftdi\driver.py”, line 192, in fdll
self._fdll = self._load_library(“libftdi”)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\gross001\Projects\Pylabrobot\env\Lib\site-packages\pylibftdi\driver.py”, line 151, in _load_library
raise LibraryMissingError(
pylibftdi._base.LibraryMissingError: libftdi library not found (search: [‘ftdi1’, ‘libftdi1’, ‘ftdi’, ‘libftdi’])
$

The key error here appears to be LibraryMissingError
pylibftdi._base.LibraryMissingError: libftdi library not found (search: [‘ftdi1’, ‘libftdi1’, ‘ftdi’, ‘libftdi’])

Any idea what this means? Thanks.

1 Like

great to hear plr now runs!

sorry about the lack of documentation on installation for the centrifuge. i have yet to update it.

there are two things to do on windows:

  1. install libftdi. this is a library needed to communicate with the device
    a. download the libftdi dlls from here: picusb - Browse Files at SourceForge.net. i got this one: libftdi1-1.5_devkit_x86_x64_19July2020.zip (download link)
    b. in your virtualenv, look for the Scripts folder.
    c. copy the dlls named “libftdi1.dll” and “libusb-1.0.dll” into the python/dlls folder (in the bin64 folder) into the Scripts folder.

  2. use zadig to replace the driver of the device you are using with libusbk. i have instructions for this on the website: Installation — PyLabRobot documentation. substitute ‘ml_star’ with agilent centrifuge. happy to help if you have questions

This is very helpful.

I did step 1 and tested the command. I’m no longer getting the missing library error from before!

I haven’t yet attempted step 2, as I’m concerned about modifying my USB-related drivers. Is it safe? I’m worried some USB device might behave differently and I won’t know how to change it back.

I really appreciate your help, and I’d be happy to compose some documentation if you can help me get to the point where I can issue commands to the centrifuge and loader. Is there are rough starting guide of any kind? This is as far as I’ve gotten so far:

$ cf = Centrifuge(name = ‘centrifuge’, backend = VSpin(bucket_1_position=0), size_x= 1, size_y=1, size_z=1)
Traceback (most recent call last):
File “”, line 1, in
TypeError: Centrifuge.init() got an unexpected keyword argument ‘name’

yes, very easily reversible (see instructions on the same page) i have done it many times

if you’re worried, you could consider getting a dedicated computer (i use $50 raspberry pis for all plr work, works great)

Apologies, the code should be

from pylabrobot.centrifuge import Centrifuge, VSpin
cf = Centrifuge(backend=VSpin(bucket_1_position=0))
await cf.setup()

await cf.start_spin_cycle(g = 800, duration = 60)

fixed with fix centrifuge example · PyLabRobot/pylabrobot@929fafd · GitHub

after this it should work :crossed_fingers:

there is a tiny bit of documentation here: Centrifuges — PyLabRobot documentation, but it wouldn’t hurt to expand that :wink:

1 Like

Once again, thank you so much for the quick and specific response.

I’ve gotten the basic module loaded, and I see the commands running it. But how do I specify the USB serial ports to use for the centrifuge and loader?

Thanks.

python -m pylibftdi.examples.list_devices to find device ids. unplug one or the other to see which is which. then pass the corresponding id in the device_id param to VSpin and Access2.

1 Like

earlier this week i added resource modeling to the centrifuge and loader. when i finish my other project (hope today) I will write a tutorial for the docs. (centrifuge + loader resource modelling by rickwierenga · Pull Request #334 · PyLabRobot/pylabrobot · GitHub)

1 Like

This is all amazing. I’ll try it out and get back to you.

I’m a field service engineer for Agilent (who makes this centrifuge and loader), so I don’t actually have a centrifuge available each day, just when I encounter them in the wild. But I should get a chance today.

Also, is there a way I can contribute to this? I’m very enthusiastic about writing and editing documentation for this kind of project.

1 Like

dude, that’s fantastic!

more documentation is always a great contribution, and this thread is one of the embarrassing examples showing why. we don’t have installation instructions for the vspin up to date. If you’re feeling super motivated, a consolidated version of this thread would be super nice as an addition to the installation guide. The docs are all markdown/notebooks and there is an “Edit on GitHub” link right on every docs page :wink:

I’ll do it! If I get this working, I’ll definitely write up a guide.

Do you have any advice on getting involved with the project? Are there any other developers, and do you hold any developer meetings or office hours when I could discuss the project?

I’ll be a little out of contact during the holidays, but after I get back I’d like to keep this conversation going, and see how I can contribute.

1 Like

thanks in advance! and no pressure, ever. & happy holidays!

make PRs on github and post on the forum! there is no secret :wink:

we had a developer meeting once almost a year ago, but i think the conclusion at that time was that asynchronous communication on github/the forum is more productive. But if there’s interest (we have grown the number of developers/users quite a bit since then) I’d be happy to organize another one to see how people feel. I will make a new post about it.

I guess I am the benevolent dictator of the project, but plr is obviously developed by many people (check the github page). You can recognize developers on the forum by their tag (i apply this tag when someone has a merged PR). Camillo @CamilloMoschner has a special tag. To ‘meet’ people, just continue making posts and people will respond :slight_smile: it’s all just chill

2 Likes

i made a more in-depth tutorial PR after getting this to work myself - super easy to reverse!

3 Likes

I really appreciate this!

It looks good. I have to wait until the next time I encounter a centrifuge to test the serial address lookup method, but in the meantime perhaps you can help with this: the command

from pylabrobot import Centrifuge

Elicits the error “ImportError: cannot import name ‘Centrifuge’ from ‘pylabrobot’ (unknown location)”

Also

from pylabrobot.backends.vspin import VSpin

Elicits "ModuleNotFoundError: No module named ‘pylabrobot.backends’ "

This is on Windows 11 running on Spyder. I can import pylabrobot successfully. Do you have any advice?

o oh the docs were wrong :flushed: apologies

from pylabrobot.centrifuge import Centrifuge, VSpin

# Replace with your specific FTDI device ID and bucket position for profile in Agilent Centrifuge Config Tool.
backend = VSpin(bucket_1_position=6969, device_id="XXXXXXXX")
centrifuge = Centrifuge(
   backend=backend,
   name="centrifuge",
   size_x=1, size_y=1, size_z=1
)

# Initialize the centrifuge.
await centrifuge.setup()

fixed with Update centrifuge.md · PyLabRobot/pylabrobot@079bcc1 · GitHub, takes about 45 min to update on the website

1 Like