View previous topic :: View next topic |
Author |
Message |
RandomDSdevel n00b
Joined: 28 Feb 2022 Posts: 37 Location: Kokomo, IN, USA
|
Posted: Thu Aug 11, 2022 8:55 pm Post subject: Installing Python Packages System-Wide |
|
|
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: | ERROR: (Gentoo) Please run pip with the --user option to avoid breaking python-exec |
`equery uses dev-python/pip` reveals the following:
Code: | [ 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: | dev-python/pip vanilla |
to it, but:
- I don't know what else that could do.
- 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: | … ~ # 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 |
|
|
Back to top |
|
|
Mistwolf Apprentice
Joined: 07 Mar 2007 Posts: 189 Location: Edmonton, AB
|
Posted: Fri Aug 12, 2022 12:52 am Post subject: |
|
|
from the pip Gentoo wiki page (https://wiki.gentoo.org/wiki/Pip):
Quote: | 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. |
|
Back to top |
|
|
RandomDSdevel n00b
Joined: 28 Feb 2022 Posts: 37 Location: Kokomo, IN, USA
|
Posted: Fri Aug 12, 2022 12:53 am Post subject: |
|
|
(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: | 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: | -bash: /home/zadmin/.local/bin/git-imerge: No such file or directory |
My `$PATH` is:
Code: | ~/.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. |
|
Back to top |
|
|
RandomDSdevel n00b
Joined: 28 Feb 2022 Posts: 37 Location: Kokomo, IN, USA
|
Posted: Fri Aug 12, 2022 1:29 am Post subject: |
|
|
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.) |
|
Back to top |
|
|
Phoenix591 Guru
Joined: 17 Sep 2007 Posts: 483
|
Posted: Fri Aug 12, 2022 2:31 am Post subject: |
|
|
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. |
|
Back to top |
|
|
Phoenix591 Guru
Joined: 17 Sep 2007 Posts: 483
|
Posted: Fri Aug 12, 2022 7:20 am Post subject: |
|
|
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) |
|
Back to top |
|
|
RandomDSdevel n00b
Joined: 28 Feb 2022 Posts: 37 Location: Kokomo, IN, USA
|
Posted: Fri Aug 12, 2022 7:25 pm Post subject: |
|
|
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.) |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|