auto-cpufreq supports Intel, AMD, ARM architectures when installed using auto-cpufreq-installer. Hence I wanted to extend architecture support for snap package, I did this by adding following block to snapcraft.yaml.
architectures:
- build-on: [amd64]
run-on: [amd64, i386, armhf, arm64]
However, when I install auto-cpufreq snap package with these changes on arm64 (Raspberry PI 4 model B) I get following error:
sudo auto-cpufreq --live
Traceback (most recent call last):
File "/snap/auto-cpufreq/82/bin/auto-cpufreq", line 14, in <module>
from auto_cpufreq.core import *
File "/snap/auto-cpufreq/82/lib/python3.8/site-packages/auto_cpufreq/core.py", line 9, in <module>
import psutil
File "/snap/auto-cpufreq/82/lib/python3.8/site-packages/psutil/__init__.py", line 99, in <module>
from . import _pslinux as _psplatform
File "/snap/auto-cpufreq/82/lib/python3.8/site-packages/psutil/_pslinux.py", line 26, in <module>
from . import _psutil_linux as cext
ImportError: cannot import name '_psutil_linux' from partially initialized module 'psutil' (most likely due to a circular import) (/snap/auto-cpufreq/82/lib/python3.8/site-packages/psutil/__init__.py)
Did anyone run into similar error and/or do you have any suggestions on how to resolve it? These same changes work fine on amd64.
Thanks!
The correct architectures setting you want is :
architectures:
- build-on: amd64
- build-on: i386
- build-on: arm64
- build-on: armhf
Thanks, snap architecture pages can be misleading in this sense.
Regardless, even with architecture settings set as:
architectures:
- build-on: amd64
- build-on: i386
- build-on: arm64
- build-on: armhf
I still end up getting the same error:
sudo auto-cpufreq --live
Traceback (most recent call last):
File "/snap/auto-cpufreq/82/bin/auto-cpufreq", line 14, in <module>
from auto_cpufreq.core import *
File "/snap/auto-cpufreq/82/lib/python3.8/site-packages/auto_cpufreq/core.py", line 9, in <module>
import psutil
File "/snap/auto-cpufreq/82/lib/python3.8/site-packages/psutil/__init__.py", line 99, in <module>
from . import _pslinux as _psplatform
File "/snap/auto-cpufreq/82/lib/python3.8/site-packages/psutil/_pslinux.py", line 26, in <module>
from . import _psutil_linux as cext
ImportError: cannot import name '_psutil_linux' from partially initialized module 'psutil' (most likely due to a circular import) (/snap/auto-cpufreq/82/lib/python3.8/site-packages/psutil/__init__.py)
Well this is where I will recommend waiting for the real python experts to arrive, can’t say I know how to debug a circular import dependency problem in Python
Looks like a nightmare related to the installation of psutil and its compiled c libraries, not necessarily anything you did in your own code. Have you tried a fresh clean build of your snap to make sure there aren’t any conflicting files left over in site-packages
? I’m not really sure that’s possible, but that’s what I would try first.
Also, the wild card import from auto_cpufreq.core import *
might be something to look into. It might be triggering some subtle bug in that specific arch.