[Bug]: Doesn't install properly on Arch due to non-existent package
soleofthesea opened this issue · 31 comments
Describe the bug
The script attempts to install python3-smbus2
which does not exist in the Arch repos, instead it is found in the AUR (under python-smbus
).
Also, despite pacman
returning an error the script just continues.
Expected behavior
Either the script manages to auto-install the package or aborts with an error message
Relevant log output
No response
Desktop
- Program version [master]
- Distro [e.g. Arch Linux]
- Kernel [6.6.9]
@soleofthesea Thank you for creating the issue. It is wrong dependency. It is not the equivalent package python-smbus2?
I use import:
from smbus2 import SMBus, i2c_msg
Can be reopened
trying to run install.sh
on my zenbook ux3404 q420v on arch gives the same error aforementioned. installing python-smbus2
manually and running the script again, results in the error once again.
Please post here output of install attempt. Package does not exist python-smbus2
? Or what an error do you mean?
It's because pacman
doesn't look at the AUR so as far as it's concerned python-smbus2
still doesn't exist.
Cleanest solution Temporary workaround; it is no longer recommended to use pip
to install modules globally would probably be to build straight from source, something like
pacman -S git
git clone https://github.com/kplindegaard/smbus2
cd smbus2
python - pip install .
the error im referring to is the following
error: target not found: python-smbus2
Something went wrong when installing packages via package manager
also, i've tried building from source like @soleofthesea mentioned but it seems to bounce back an invalid syntax error.
Might also need python-setuptools
.
@soleofthesea What about refactoring the code to the mentioned previous version? That is available on Arch without any obstructions? I mean python-smbus
. The driver only needs to write to the i2c
register, nothing else.
The master branch has been hard reset.
the script seems to still give the error, but ignores it and continues on with the script. the script preforms normally and installs, but doesn't seem to work for me. (no backlighting & no numpad functions). might just be an issue on my end though, someone else should give it a try.
@dvdoll Could you please follow up:
$ pacman -S git
$ git clone https://github.com/kplindegaard/smbus2
$ cd smbus2
$ python - pip install .
With current state of the master, whether it helps light up NumberPad.
>>> pip install .
File "<stdin>", line 1
pip install .
^^^^^^^
SyntaxError: invalid syntax
>>>
Ahem
So about that syntax error...apologies, typo.
Correct command should be python -m pip install .
no worries. it happens. after running that command, it said pip wasn't found, so i ran sudo pacman -S python-pip
, ran python -m pip install .
and received the following.
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try 'pacman -S
python-xyz', where xyz is the package you are trying to
install.
If you wish to install a non-Arch-packaged Python package,
create a virtual environment using 'python -m venv path/to/venv'.
Then use path/to/venv/bin/python and path/to/venv/bin/pip.
If you wish to install a non-Arch packaged Python application,
it may be easiest to use 'pipx install xyz', which will manage a
virtual environment for you. Make sure you have python-pipx
installed via pacman.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
Yes, because of this pip
is not the way how solve this problem. What about to use previous package? Can you confirm me the previous package can be installed? python-smbus
the only packages i can find are python-smbus2
and python-smbus-git
which are both aur packages.
What @dvdoll said. https://archlinux.org/packages/?sort=&q=smbus&maintainer=&flagged=
As I understand it error: externally-managed-environment
is only of concern if there is an equivalent package in Arch's repos, because a pacman -Syu
might override pip
and vice versa. So while a bit alarmist it should be safe to ignore it for this instance... at least until a proper substitute can be found, anyway.
@soleofthesea Could you please post here exactly the same commands what I can use? Or do not you want make PR? With pip
solution.
Well, about that... it might be OK to ignore the error for now just to get the driver to run but you're not really supposed to do that.
(This is recent change in Linux so I forgot, so please ignore my earlier comment about it being a "solution")
@dvdoll Could you please test whether this helps. Please try first way via yay
, try driver then uninstall via yay -Rns python-smbus2
, and please try even the second option via $ makepkg
@dvdoll @soleofthesea Please, test the branch
@soleofthesea @dvdoll How I can check whether $ yay
(https://github.com/Jguer/yay) is installed? Is it possible like this $ yay 2>/dev/null
? Then $ echo $?
returns 0
in the case is installed and 1
when is not?
Probably, but yay
is not the only AUR helper, though. https://wiki.archlinux.org/title/AUR_helpers
And what happens if the user does not have any of them?
I think it might be simpler to just create a Python venv
at this point.
And what happens if the user does not have any of them?
Is used makepkg -si
Probably
Probably? Could you please open the terminal and try that? Thank you
I think it might be simpler to just create a Python venv at this point.
Pull request is welcome
Probably? Could you please open the terminal and try that? Thank you
If the script is going to manually build from AUR via makepkg -si
then writing additional code to use yay
is redundant. Like buying instant coffee when you already have a coffee maker.
If the script is going to manually build from AUR via makepkg -si then writing additional code to use yay is redundant. Like buying instant coffee when you already have a coffee maker.
Did you check the code in the mentioned branch? yay
is at this moment commited only as preferred variant over makepkg -si
as using AUR helper has benefits. Please focus more on the topic or write nothing, thank you.
Alright, fair point. But there should be handling for paru
and pamac
too; those are pretty popular helpers as well.
Also I'm currently on mobile, so I'll respond later once I'm able to test the code.
I have to agree with you, it looks like there is no obstacle why not use Python3 virtual environment. Init for you to test is pushed to this branch.
My insights:
apt
packagepython3-virtualenv
have dependencypython3-pip
&python3-setuptools
pip3
is a symlink topip
but for sure I usepip3
apt
packagepython3-virtualenv
has advantage overpython3.10-env
because has no specific version in the name- Because this driver currently depends on the latest
Python3
(because of that I decided not to fix pip packages in filerequirements.txt
to specific versions and reason why driver has not fixed version ofPython3
is because packagepython3-devel
is available across distributions and specific packages like `python3.10 are not), a virtual environment has to be created like this:
$ virtualenv --python=$(python3 --version | cut -d" " -f2) /usr/share/asus-numberpad-driver/.env
# python3 -m venv /usr/share/asus-numberpad-driver/.venv (needs package python3.10-env and because of that was not used)
Side effects:
- Can be removed code for installing
asyncore
dependency for who usesPython3
version bigger or equal to3.12.0
because as pip module it is just one row inrequirement.txt
file does not matter whichPython3
version is used - in case lower then is downloaded nothing, pip handles it (original issue #153)
@soleofthesea @dvdoll Merged to the master. Can be reopened.
EDIT: only pin the previous solution without Python3 virtual environment virtualenv
# because package python3-smbus2 is available only on AUR
#
# https://github.com/asus-linux-drivers/asus-numberpad-driver/issues/156
if [[ $(yay 2>/dev/null)]]; then
yay -S python-smbus2
else
git clone https://aur.archlinux.org/python-smbus2.git ~/python-smbus2
cd ~/python-smbus2
# -i it calls pacman -U <package>
# -s instructs pacman to resolve dependencies and install missing packages
makepkg -si
fi