This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== G) PIP ====== [[https://pypi.org/project/pip/PyPi]] or **pip** is the **Packager Installer for Python** and it's a great tool to quickly install and manage python tools. Since PIP behaves like a package manager and **will** mess up with your Linux installation, Gentoo folks have devised a cool [[https://wiki.gentoo.org/wiki/Pip|way]] to let you use pip for anything that is not already packaged into Portage, Gentoo packaging system. The basic idea is: you **do not** use pip as root, ever, but you use pip as **user** to install specific packages and tools locally to the user without messing up with other users or the system itself. All you need to do is emerge pip: <code bash> emerge pip </code> and enable pip usage for specific users. ===== Enabling PIP per user ===== Create a file called **~/.config/pip/pip.conf** in your user home folder. You will need to create the sub-folders, probably. The content of the file must be: <file - pip.conf> [global] break-system-packages = true user = true </file> and that's it! Now **pip** and specifically **pip install** will work just fine for your user. **Do not do this for user root**. ===== Virtual Environments ==== V'envs are pretty common using PIP, to create a venv with your user type: <code bash> su - user python -m venv my_venv source my_venv/bin/activate </code> You might want to put at the end of your **~/bashrc**: <code bash> source ~/my_venv/bin/activate </code> for automatic loading of venv variables. Also, PIP will most probably require you to modify your venv setting. Open **~/my_venv/pyvenv.cfg** and set //include-system-site-packages = true//, like this: <code> include-system-site-packages = true </code> And, last, you most probably **want** to add ~/.local/bin to your path, by adding at the end of your user **.bashrc** the following line: <code bash> export PATH=$PATH:~/.local/bin </code> ===== OpenRC and venv ===== You don't really need to ativate the venv. You can run the full path to the executable under the **bin** folder of the venv while being in the root folder of the venv, as your CWD. So: <code> #!/sbin/openrc-run # Copyright 2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 name="start a venv stuff" description="start a venv stuff" pidfile="/run/myservice.pid" command_background=true command="/path/to/venv/bin/python" # or any other executable in your venv command_args="-m my_python_app_to_run" command_user="conduwuit:conduwuit" start_pre() { cd /path/to/venv } </code>