toradex / vscode-torizon-templates

VS Code Torizon Integrated Development Environment Templates
MIT License
14 stars 20 forks source link

python3: Fix and improve pip install on host and containers #195

Closed andreriesco closed 4 months ago

andreriesco commented 4 months ago

Remove --system-break-packages from pip install and add requirements-local.txt to separate the host pip dependencies from the debug container ones (requirements-debug.txt).

microhobby commented 4 months ago

@brunoaamello adding you as reviewer, since you point out this.

brunoaamello commented 4 months ago

Hello @andreriesco,

The addition of the requirements-local.txt file is a bit different than what I did on https://github.com/toradex/torizon-samples/pull/18. There I install the packages on requirements-local.txt and requirements-debug.txt on the local venv.

I see your implementation as better, as it gives the user more control over the packages installed on each circumstance. the reason I brought this up is so this difference is known.

brunoaamello commented 4 months ago

Regarding the removal of the --break-system-packages flag, this change is great and welcome. The effect is that this template will not work locally unless a virtual environment is created. Have you confirmed if this is the case?

andreriesco commented 4 months ago

Regarding the removal of the --break-system-packages flag, this change is great and welcome. The effect is that this template will not work locally unless a virtual environment is created. Have you confirmed if this is the case?

Actually it does work if no virtual environment is created (maybe on Debian 12/Ubuntu 24 it is not possible anymore to install python packages outside a venv, so the user will be forced to create one). The --break-system-packages allows a pip installation of a package outside a venv (meaning directly on the host) even if there is already this package installed on the system through apt, therefore "breaking" this system packages installed through apt. By removing it, an error happens if the user tries to pip install a package that is already installed by apt.

andreriesco commented 4 months ago

About the requirements-local.txt, I implemented this way in this commit exactly for what you said of having more over the packages installed on each circumstances