Closed PNixx closed 4 years ago
I believe this may be caused by initializing upp with Python2 (instead of Python3). Can you paste the output of
cat /home/nixx/.local/bin/upp
$ cat /home/nixx/.local/bin/upp
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from upp.upp import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())
I install a new ubuntu and install
sudo apt install git build-essential libgtk-3-dev build-essential python3 python3-pip libpci-dev && pip3 install upp
before make powerupp. After make, run from terminal for see logs.
Thanks. Can you run upp from terminal (just type upp
)?
Edit: if upp works, can you also paste the output of pip3 show upp
?
$ pip3 show upp
Name: upp
Version: 0.0.7
Summary: Uplift Power Play
Home-page: https://github.com/sibradzic/upp
Author: Samir Ibradžić
Author-email: None
License: UNKNOWN
Location: /home/nixx/.local/lib/python3.6/site-packages
Requires: click, python-registry
Pushed a new branch that I think should fix this, please try and let me know.
No, I see same error
Ok, so likely not an issue with Python 2/3 (as was easily reproducible from my end, although not very logical) but probably an issue with missing library paths. Try this commit and see if it helps (not a fix, just need to understand what is going on).
Yes, it works! Thanks
Do you have any thoughts on this @sibradzic ? For some reason that I have not fully understood yet, when starting upp via "bash -c ..." the PYTHONPATH, ie. the site-packages path where the upp library is located, is not available on a few systems (older Ubuntu?). The only way I seem to be able to set it up from powerupp is by immediately prepending the upp commands sent via Bash with PYTHONPATH=(each possible python version/site-packages) as in the test above, manually pre-setting the PYTHONPATH does not help as far as I can tell.
Do you see any better way to make sure the library path is found? Setting the path(s) in the upp bin, like import site site.addsitedir('/site-packages-path')
seems to work as well, but this file is created automatically by pip and not adjustable afaik?
I think the main issue here is calling local user installed pip Python stuff with sudo. As I've stated in https://github.com/sibradzic/upp/blob/master/README.md, this weird workaround should make things work: sudo -E env "PATH=$PATH" upp --help
. @PNixx, try calling out upp
as I mention locally first to see if it helps, as this could be distro-specific.
@sibradzic Thanks, the env trick does not seem to help in this case though (in fact it causes this very issue for me). I'm running upp as user with sudo -u, but I think the sudo call may very well have something to do with it if invokes a new shell but without the users paths, this would explain why it is not possible to set up before the very last call. Maybe adding an -i switch will invoke the new user shell from sudo with proper paths? Can you try this @PNixx
Yes, latest commit https://github.com/azeam/powerupp/commit/e2ae4f48bf0cfd1ae4945e7e88458850487ae59c works fine.
@PNixx perfect, adding this to main branch, thanks to both of you!
After click apply current I see in the terminal:
Ubuntu 18.04.4