Python Environment on KNEO Pi¶
KNEO Pi provides a robust Python development environment with Python3
pre-installed. Please follow the guidelines below to manage Python packages effectively and avoid potential conflicts.
Important
When you are using pip
the same installation folder is shared with pacman
and most of time, especially when you are updating all system packages, will raise a conflict error, such as version mismatches and broken dependencies. You always have to prefer the first option above. To solve conflict problems, just uninstall pip package and install they equivalent package on pacman.
Installing Python Packages with Pacman¶
To search and install Python packages using pacman, run:
Search for a package from Arch User Repository (AUR)
Install the package: This ensures that system-wide packages are managed correctly and conflicts are minimized.Resolving Conflicts¶
If you have installed packages using pip
and encounter conflicts, follow these steps to resolve them:
Uninstall the conflicting pip package:
Install the equivalent package using pacman: This approach ensures that the system maintains stability by using the pacman package manager for system-wide installations.Using Virtual Environments with pip
¶
To safely use pip
for installing additional Python packages without affecting the system, it is recommended to use a virtual environment. See Python official documentation for more details.
Create a virtual environment:
Activate the virtual environment: Install packages within the virtual environment: Deactivate the virtual environment when done: By using virtual environments, you can safely manage project-specific dependencies without interfering with the system’s Python environment.Our Recommendation
- Use
pacman
for system-wide Python package management to avoid conflicts. - For project-specific packages, always use virtual environments created with
python-virtualenv
to manage dependencies safely. - Resolve conflicts by switching from
pip
topacman
for system-wide packages.