You are not logged in.

#1 2020-01-07 14:41:36

Registered: 2014-07-09
Posts: 37

[Solved]Which is the best way to install python backage?


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- 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?

Last edited by mbates (2020-01-07 16:24:55)


#2 2020-01-07 14:54:01

From: London
Registered: 2014-02-20
Posts: 5,463

Re: [Solved]Which is the best way to install python backage?

Use the package manager. Make your own packages if they're not in the repositories.

See also


#3 2020-01-07 15:24:12

Registered: 2018-08-18
Posts: 45

Re: [Solved]Which is the best way to install python backage?

ThIf you are installing an application system-wide - pacman and like Head_on_a_Stick said - make your own packages if anything is missing.

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).

Last edited by romstor (2020-01-07 15:36:09)


#4 2020-01-07 15:27:22

From: Pasadena, CA
Registered: 2009-07-13
Posts: 17,278

Re: [Solved]Which is the best way to install python backage?

I generally agree with Head_on_a_Stick's recommendation.   There are some exceptions; for example, if a program requires a specific version of a module, or if you are packaging programs for the purpose of uploading them to PyPI.

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.

Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
How to Ask Questions the Smart Way


#5 2020-01-07 16:26:04

Registered: 2014-07-09
Posts: 37

Re: [Solved]Which is the best way to install python backage?

Thanks for the help.

I know what to do now.


Board footer

Powered by FluxBB