Python version in worker

Hello,
I’m trying to use viktor in Windows, and I’m using a local worker which consists in a Python script that generates some json files.
I had Python3.8 installed, but I installed also 3.13 to run viktor.

Now the problem I encounter: the python script running in the worker requires the package ‘requests’, which is currently listed on ‘requirements.txt’ in the app. Despite that, the worker (which points to python313 executable) won’t find requests and it’s giving “Module not found error”.

I solved on my machine by installing the package with pip3.13 install requests, but this is clearly a complication in redistributing the app and this got me confused:

  1. does the worker runs in isolation mode (venv)?
  2. if answer to 1. is NO, how do you automatize the required packages to install on client? I supposed I cannot use requirements.txt, since existing one does not affect worker.
    Is the best practice to package an executable?
  3. if answer to 1. is YES, how to investigate why it’s not working with declared prerequisites?

thanks in advance

Hi Johnny,

The generic worker does not look at the packages listed in the requirements.txt file. It runs the executable you define in the config.yaml file and therefore can only use the built-in Python packages and the ones installed on the system the way you solved it. I would however advise to set up a virtual env, install the required packages in it, and point to the venv Python instead. So your config.yaml will look something like

executables:
  python:
    path: 'C:\Users\Johnny\Documents\viktor\venv\Scripts\python.exe'
    ...

Thanks, clear now!