Pabot in venv uses System Python

Hi,

I have create a venv from Python 3.9 and install robotframework 4.1 and robotframework-pabot 2.0.1 in it.

Then I call:
<path_to_my_venv>\Scripts\pabot --pabotlib --processes ....

The thing is pabot claims, that robot cannot be found. When I add robotframework to the system python, then I get an robot exception that pabot is an unknown library - which is crazy, since pabot started robot in the first place.

So obviously, my pabot in venv “breaks” out and tries to execute on system python. Is there a way I can “overrule” this?

Running on Windows with Python 3.9

Regards,
Markus

1 Like

You have to check the PATH environment variable, so that finds first the commands in <path_to_my_venv>\Scripts\ . I would keep that in a cmd file to run before using commands.
SET PATH=<path_to_my_venv>\Scripts;%PATH%

1 Like

Thank you @HelioGuilherme66 .

I cannot identify what messes up PATH by upgrading Python and RF modules. But modifying PATH as you posted solved it.

1 Like

While it may have solved it, it probably created a bunch of problems…now, that specific venv is in your system’s PATH. So odds are that if you create another venv, isolation is broken and packages in that new venv could access modules in the other venv that was added to PATH.

It sounds to me that pabot’s behavior (trying to use system Python from venv) is actually a bug that should be addressed.

My system with the messed up PATH is a legacy windows server that is at least a decade old. It never got properly administrated, every software was installed adhoc by whoever needed it. I even found relicts if old python 2 installations on the PATH.

Unless someone with a modern setup can recreate this issue, I would not put too much thought into this.