I know what to do now.
]]>So, my extensions to HoaS's advice:
In order of preference:
Use pacman
Use a virtual environment and install using pip to that environment
Use pip install --user
Do not use # pip install. It will bite you later.
]]>If you are developing, create virtual environment in your project (or any other really) folder with:
$ cd ~/myproj
$ python -m venv venv
After, make sure you activate your virtual environment:
. venv/bin/activate
Once it is activated (!), pip install away. That will only install the packages for a project in the project folder, but not system wide. Using pip system-wide is not a good idea unless you know what you are doing (in which case you should really create PKGBUILD and install it that way).
]]>See also https://xkcd.com/1987/
]]>I could use pip to install python packages. And for some popular packages, such as numpy, it is recommanded to use
pacman -S python-numpy
instead of
pip install numpy
As far as I know, the packages installed by pacman have no dependency problems of python version.
If the python package is a standalone package, I could search in pacman first. But most packages require other packages, whichi I could not check before the installation.
For example,
pip install OptGBM
would install optuna and lightgbm, neither of them could be found in pacman. But they require
Successfully installed Mako-1.1.0 MarkupSafe-1.1.1 PrettyTable-0.7.2 alembic-1.3.2 cliff-2.17.0 cmd2-0.9.22 colorlog-4.1.0 pbr-5.4.4 pyperclip-1.7.0 python-editor-1.0.4 sqlalchemy-1.3.12 stevedore-1.31.0 tqdm-4.41.1 typing-3.7.4.1 wcwidth-0.1.8
all of which will be install by pip automatically. And all of the python packages could be found by pacman -Ss, such as extra/python-mako, python-sqlalchemy, community/python-pyperclip and python-alembic.
In this case, which is the best way to install OptGBM with python-XXXXX? pacman ? pip? or conda?
]]>