The right way for ArchLinux
The right way to install PYTHON packages in ArchLinux is using PACMAN! To install packages to Python3 you have to use
sudo pacman -S python-'package'
If you want to install packages from Python2, you have to use
sudo pacman -S python2-'package'
Most python packages are in the ArchLinux repositories and the packages that are not in AUR (ArchLinux User Repositories) - for these packages you have to download the PKGBUILD file and compile. After that, you have to use PACMAN to finish the installation
sudo pacman -U 'compiled-package'
The second right way for ArchLinux
When the package isn't in the AUR or the PKGBUILD isn't working, you can use PIP to install it to Python3
sudo pip install 'python-package'
sudo pip2 install 'python-package'
BE AWARE: 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 (
sudo pacman -Suy), will raise a conflict error. You always have to prefer the first option above.To solve conflict problems, just uninstall
pip package and install they equivalent package on
pip uninstall 'python-package').
You could give a chance to
virtualenv or even
If you are planning to develop some python application or python package your better option is use virtual environments.
For python packaging applications you should try
poetry it is current better option to manage application from start to finish. It is a much better option than
Another more simple option is use
python-virtualenv. This can bring portability to your code and maintain old packages as well. Install it with
sudo pacman -S python-virtualenv
and try this
virtualenv -p /usr/bin/python3 yourenv
pip install package-name
When you create this environment
yourenv, you will setup
pip to install packages only into this environment, not to the entire system.
These other links can be useful with you want to learn more about managing packages on Linux with
Installing Python Packages from a Jupyter Notebook
Code Python on ArchLinux
If you follow these rules, your ArchLinux will not break and won't have dependency problems between PACMAN and PIP.
Hope it's useful!