Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

Installing Python Packages System-Wide

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
7 posts • Page 1 of 1
Author
Message
RandomDSdevel
n00b
n00b
Posts: 46
Joined: Mon Feb 28, 2022 11:11 pm
Location: Kokomo, IN, USA

Installing Python Packages System-Wide

  • Quote

Post by RandomDSdevel » Thu Aug 11, 2022 8:55 pm

I'd like to install git-imerge system-wide. `emerge --search git-imerge` doesn't turn any results up for it in Portage*, but it's available from `pip`. When I went to `pip install git-imerge`, either with or without passing `pip install` its `--root-user-action=ignore`, inside a `sudo -i` session, it printed the following information:

Code: Select all

ERROR: (Gentoo) Please run pip with the --user option to avoid breaking python-exec
`equery uses dev-python/pip` reveals the following:

Code: Select all

[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for dev-python/pip-22.1.2-r1:  
 U I
 + + python_targets_python3_10 : Build with Python 3.10
 - - python_targets_python3_8  : Build with Python 3.8
 - - python_targets_python3_9  : Build with Python 3.9
 - - test                      : Enable dependencies and/or preparations necessary to run tests (usually controlled by 
                                 FEATURES=test but can be toggled independently)
 - - vanilla                   : Do not add extra patches which change default behaviour; DO NOT USE THIS ON A GLOBAL 
                                 SCALE as the severity of the meaning changes drastically
OK, so Gentoo's Portage applies some patches to `pip`, presumably to make it play well/nice with Portage and, as noted above, not step on its toes by default. Hypothetically, I could just create a new plain text file at `/etc/portage/package.use/pip` and add:

Code: Select all

dev-python/pip vanilla
to it, but:
  1. I don't know what else that could do.
  2. I suspect odds are that this isn't recommended practice.
I also saw an old forum thread titled 'strategy for installing python packages not in portage' from November 2014. Its fourth post suggests/recommends using gs-pypi, but it appears unmaintained; development on it looks like it and the 'g-sorcery' tool that it's a backend for stopped in January of 2016. `gs-pypi` was removed from Portage in 2018. Are there any modern, maintained alternatives?

---

* The unofficial third-party Portage and overlays search engine at https://gpo.zugaina.org/ doesn't list any results for `git-imerge`, either.

---

P. S.: Oh, and this is in a Gentoo Windows Subsystem for Linux v2 instance running on 64-bit Windows 10 Pro 21H2, build 19044.1826, with Windows Feature Experience Pack v120.2212.4180.0. My `uname` is:

Code: Select all

… ~ # uname -srvmpio
Linux 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz GenuineIntel GNU/Linux
Top
Mistwolf
Apprentice
Apprentice
Posts: 189
Joined: Wed Mar 07, 2007 2:06 am
Location: Edmonton, AB

  • Quote

Post by Mistwolf » Fri Aug 12, 2022 12:52 am

from the pip Gentoo wiki page (https://wiki.gentoo.org/wiki/Pip):
It is important to understand that packages installed using pip will not be tracked by Portage. This is the case for installing any package through means other than the emerge command. Possible conflicts can be created when installing a Python package that is available in the Portage tree, then installing the same package using pip.

Decide which package manager will work best for the use case: either use emerge or pip for Python packages, but not both. Some Python packages are not available in the Portage tree, in these cases the only option is to use pip. One possibility is to use the --user option to install Python packages in a user's home directory. This will avoid conflicts with Portage. Be wise and make good choices!
The Gentoo way is to create an ebuild for git-imerge and add it to your local repo. git-imerge does have a stand alone package install, pip is not required.
Top
RandomDSdevel
n00b
n00b
Posts: 46
Joined: Mon Feb 28, 2022 11:11 pm
Location: Kokomo, IN, USA

  • Quote

Post by RandomDSdevel » Fri Aug 12, 2022 12:53 am

(Facepalms, feeling slightly dumb.) `pip install --prefix="/usr/local/" git-imerge` from within a `sudo -i` session works. Maybe a proper Portage package would still be better, though…? (Shrugs.)

---

…I stand corrected. From a non`sudo` context, running both `git imerge` and `git imerge help` produces:

Code: Select all

Traceback (most recent call last):  
  File "/usr/local/bin/git-imerge", line 5, in <module>
    from gitimerge import climain
ModuleNotFoundError: No module named 'gitimerge'
Interestingly enough, invoking it via Git's sub-command indirection functionality works, but invoking it directly doesn't:

Code: Select all

-bash: /home/zadmin/.local/bin/git-imerge: No such file or directory
My `$PATH` is:

Code: Select all

~/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/14/bin
Maybe it's got the prior existence of an earlier attempt at a per-user installation (via `pip install --user`) stuck in a cache somewhere? Hmm…

P. S.: Never mind, I got it; the fix was (obviously in hindsight) to run `hash -r`, and that did the trick. Now I'm getting the same `ModuleNotFoundError` I saw when attempting to invoke `git-imerge` through Git.
Top
RandomDSdevel
n00b
n00b
Posts: 46
Joined: Mon Feb 28, 2022 11:11 pm
Location: Kokomo, IN, USA

  • Quote

Post by RandomDSdevel » Fri Aug 12, 2022 1:29 am

A per-user installation (via `pip install --user`) from within a non-`sudo` context (followed by the obligatory `hash -r`) works. I guess I'm sticking with that unless and until I can figure this out.

(Edit: Git can't find `git-imerge` when I attempt to invoke the latter through the former as a sub-command when I've installed the latter this way, though; I have to invoke it as `git-imerge` for my shell to find it.)
Top
Phoenix591
Guru
Guru
Posts: 504
Joined: Mon Sep 17, 2007 3:52 am

  • Quote

Post by Phoenix591 » Fri Aug 12, 2022 2:31 am

Python packages tend to be fairly simple to package, check out the documentation, from a quick look your git thing seems to use setuptools, so I'd see what doing something based on that simple example does.
Top
Phoenix591
Guru
Guru
Posts: 504
Joined: Mon Sep 17, 2007 3:52 am

  • Quote

Post by Phoenix591 » Fri Aug 12, 2022 7:20 am

I got curious about using git-imerge myself, so I did in fact make an ebuild, nice and short too. https://bpa.st/PQ4Q just the bash-completion only seems to work when run as a git subcommand and throws up Gentoo qa warnings (just about the completion)
Top
RandomDSdevel
n00b
n00b
Posts: 46
Joined: Mon Feb 28, 2022 11:11 pm
Location: Kokomo, IN, USA

  • Quote

Post by RandomDSdevel » Fri Aug 12, 2022 7:25 pm

Thank you very much, Phoenix591! Let me know if you end up submitting that or a revision of it to the main Portage ebuild repository or to another one, like GURU. Meanwhile, I think I'll follow the wiki guide(s) for using ebuilds locally for now.

(I might've tried writing one and contributing it myself, but I was anxious it might be a bit more involved than that and my SSH key's stuck on a backup of a machine that's still temporarily out of commission at the moment.)
Top
Post Reply

7 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy