robocorp / rcc

Repeatable, movable and isolated Python environments for your automation. 🚀
https://robocorp.com/docs/
Apache License 2.0
461 stars 97 forks source link

RCC can still provide the wrong `PYTHON_EXE` #27

Closed fabioz closed 2 years ago

fabioz commented 2 years ago

See: https://github.com/robocorp/robotframework-lsp/issues/583 for details.

vjmp commented 2 years ago

@fabioz

Can you provide something more. On that log there is no call for rcc ht vars or anything that can hint what is going on. No variables visible.

Except that all seem to be installed by "scoop" and python is executed from C:\Users\mathis\scoop\shims\python3.exe (note the "shims" folder, that can be very nasty thing, shims can override almost anything).

So can we get that environment info, that rcc passed to language server? What is value of "PYTHON_EXE" for example?

Also it seems that VS Code is installed thru scoop. Is there now also shim for VS Code and even worse, is there some rcc shim, which tries to circumvent our path settings and persist on using everything scoop? Based on my quick view on scoop, it tries to do its own "sandboxing".

fabioz commented 2 years ago

PYTHON_EXE is C:\Users\mathis\scoop\shims\python3.exe (which is what the language server uses to execute python and what must be fixed).

The PATH is:

C:\Users\mathis\AppData\Local\robocorp\holotree\b1f3c244e_9679c063;C:\Users\mathis\AppData\Local\robocorp\holotree\b1f3c244e_9679c063\Library\mingw-w64\bin;C:\Users\mathis\AppData\Local\robocorp\holotree\b1f3c244e_9679c063\Library\usr\bin;C:\Users\mathis\AppData\Local\robocorp\holotree\b1f3c244e_9679c063\Library\bin;C:\Users\mathis\AppData\Local\robocorp\holotree\b1f3c244e_9679c063\Scripts;C:\Users\mathis\AppData\Local\robocorp\holotree\b1f3c244e_9679c063\bin;C:\Users\mathis\scoop\persist\vscode\data\extensions\robocorp.robocorp-code-0.27.1\bin;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\Git\cmd;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\NVIDIA Corporation\Nsight Compute 2019.5.0;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\dotnet;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Users\mathis\scoop\apps\vscode\current\bin;C:\Users\mathis\scoop\apps\nodejs\current\bin;C:\Users\mathis\scoop\apps\nodejs\current;C:\Users\mathis\scoop\apps\openjdk8-redhat\current\bin;C:\Users\mathis\scoop\apps\openjdk\current\bin;C:\Users\mathis\scoop\apps\maven\current\bin;C:\Users\mathis\scoop\apps\openjdk11\current\bin;C:\Users\mathis\.poetry\bin;C:\Users\mathis\scoop\shims;C:\Users\mathis\AppData\Local\Microsoft\WindowsApps;C:\Users\mathis\scoop\persist\vscode\data\extensions\robocorp.robocorp-code-0.27.1\bin\C:\Users\mathis\AppData\Local\Microsoft\WindowsApps

Do you need something else?

fabioz commented 2 years ago

I think the problem is that in:

https://github.com/robocorp/rcc/blob/9581710c199b470df261c0d6436535bde168382d/conda/robocorp.go#L89 it tries to find python3 and then python (and it finds python3 in the shims in the environment).

I think it should never search the whole environment for python, rather, it should only search the holotree paths...

vjmp commented 2 years ago

So, holotree is first in search path. So is holotree missing python executables totally, or why are they not found? So if they are not in holotree, then where should rcc then use them?

What is in conda.yaml (is it written so, that it does not install python at all) and does it also fail in your system, or just in that scoop system? And what version of python is requested there?

fabioz commented 2 years ago

They are not found because there's only python.exe in the holotree and it searched for python3.exe before.

conda.yaml ships with the extension and has:

channels:
  - conda-forge
dependencies:
  - python=3.8.10
  - pip=20.1
  - pip:
    - robocorp-inspector==0.5.0
    - robotframework==4.1

It probably fails in all systems which have a python3.exe in the PATH (in this case the user has installed: https://scoop.sh/ which adds shims to auto-install python, so, any user with that installed would likely not be able to use RCC).