RuntimeError: Could not find simulation files

Hello. I am attempting to setup the simulator backend. I have followed the installation documentation and have a created a virtual environment running on a raspberry pi. When I get to the point of calling the lh.setup() command I get a RuntimeError stating that the simulation files cannot be found. Do you have any suggestions on how I might resolve this error?

Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    lh.setup()
  File "//home/pi/tfb/lib/python3.9/site-packages/pylabrobot/liquid_handling/liquid_handler.py", line 106, in setup
    self.backend.setup()
  File "//home/pi/tfb/lib/python3.9/site-packages/pylabrobot/liquid_handling/backends/simulation/simulator_backend.py", line 104, in setup
    self._run_file_server()
  File "//home/pi/tfb/lib/python3.9/site-packages/pylabrobot/liquid_handling/backends/simulation/simulator_backend.py", line 112, in _run_file_server
    raise RuntimeError("Could not find simulation files. Please run from the root of the "
INFO:websockets.server:server listening on 127.0.0.1:2121
RuntimeError: Could not find simulation files. Please run from the root of the repository.

Hi, happy to help. Could you share your code and from where you run Python?

Hi Rick. Thanks! From Terminal I am designating the source location for the virtual environment and launching IDLE Shell. From there I’ve entered the commands from the simulator documentation:

Terminal -

pi@raspberrypi:~ $ source /home/pi/tfb/bin/activate
(tfb) pi@raspberrypi:~ $ python -m idlelib

IDLE -

Python 3.9.2 (default, Mar 12 2021, 04:06:34) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license()" for more information.
>>> from pylabrobot.liquid_handling import LiquidHandler
INFO:opentrons_shared_data.load:Using packaged shared data path: //home/pi/tfb/lib/python3.9/site-packages/opentrons_shared_data/data
>>> from pylabrobot.liquid_handling.backends.simulation.simulator_backend import SimulatorBackend
>>> 
>>> from pylabrobot.liquid_handling.resources.hamilton import STARLetDeck
>>> sb = SimulatorBackend()
>>> lh = LiquidHandler(backend=sb, deck=STARLetDeck())
>>> lh.setup()
Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    lh.setup()
  File "//home/pi/tfb/lib/python3.9/site-packages/pylabrobot/liquid_handling/liquid_handler.py", line 106, in setup
    self.backend.setup()
  File "//home/pi/tfb/lib/python3.9/site-packages/pylabrobot/liquid_handling/backends/simulation/simulator_backend.py", line 104, in setup
    self._run_file_server()
  File "//home/pi/tfb/lib/python3.9/site-packages/pylabrobot/liquid_handling/backends/simulation/simulator_backend.py", line 112, in _run_file_server
    raise RuntimeError("Could not find simulation files. Please run from the root of the "
INFO:websockets.server:server listening on 127.0.0.1:2121
Simulation server started at http://127.0.0.1:2121RuntimeError: Could not find simulation files. Please run from the root of the repository.

Oops, my bad. I just deployed the fixed version. Running pip install pylabrobot --upgrade should fix it.

Thanks again for reporting!

(Just to explain what happened: I forgot to upload the simulator’s html/css/js files to PyPI, it defaults to Python only, meaning the pip-version was not able to find those)

That did the trick! Thanks for the explanation. I haven’t used python in quite awhile so I’m excited to refamiliarize myself with it on our Starlet.

Great!