PythonSDK on Devuan64

Hello,
I have a Pi-Top Laptop of the first generation with an 8GB Pi4. As it has 8GB of RAM I use Devuan arm64 as OS. I am not able to install the PythonSDK via apt, because the package is made for armhf. Trying manually with “pip3 install pitop” fails. Unfortinately I can not post the log file because I am not allowed to post more than 2 links, and the log is full of them - here is the log without the links:

Collecting pitop
Using cached LINK …
Collecting pitopcommon (from pitop)
Using cached LINK …
Collecting scipy (from pitop)
Using cached LINK files.pythonhosted.org/packages/16/48/ff7026d26dfd92520f00b109333e22c05a235f0c9115a5a2d7679cdf39ef/scipy-1.6.0.tar.gz
Installing build dependencies: started
Installing build dependencies: still running…
Installing build dependencies: still running…
Installing build dependencies: still running…
Installing build dependencies: still running…
Installing build dependencies: still running…
Installing build dependencies: finished with status ‘done’
Collecting monotonic (from pitop)
Using cached LINK …
Collecting python-sonic (from pitop)
Using cached LINK …
Collecting zmq (from pitop)
Using cached LINK …
Collecting gpiozero (from pitop)
Using cached LINK …
Collecting RPi.GPIO (from pitop)
Using cached LINK …
Collecting pyserial (from pitop)
Using cached LINK …
Collecting PyV4L2Camera (from pitop)
Using cached LINK …
Collecting matplotlib (from pitop)
Using cached LINK …
Complete output from command python setup.py egg_info:
Processing numpy/random/_bounded_integers.pxd.in
Processing numpy/random/mtrand.pyx
Traceback (most recent call last):
File “/tmp/easy_install-zjnzc588/numpy-1.20.0rc2/tools/cythonize.py”, line 59, in process_pyx
from Cython.Compiler.Version import version as cython_version
ModuleNotFoundError: No module named ‘Cython’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/easy_install-zjnzc588/numpy-1.20.0rc2/tools/cythonize.py", line 235, in <module>
    main()
  File "/tmp/easy_install-zjnzc588/numpy-1.20.0rc2/tools/cythonize.py", line 231, in main
    find_process_files(root_dir)
  File "/tmp/easy_install-zjnzc588/numpy-1.20.0rc2/tools/cythonize.py", line 222, in find_process_files
    process(root_dir, fromfile, tofile, function, hash_db)
  File "/tmp/easy_install-zjnzc588/numpy-1.20.0rc2/tools/cythonize.py", line 188, in process
    processor_function(fromfile, tofile)
  File "/tmp/easy_install-zjnzc588/numpy-1.20.0rc2/tools/cythonize.py", line 64, in process_pyx
    raise OSError('Cython needs to be installed in Python as a module')
OSError: Cython needs to be installed in Python as a module
Running from numpy source directory.
/tmp/easy_install-zjnzc588/numpy-1.20.0rc2/setup.py:485: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
  run_build = parse_setuppy_commands()
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 154, in save_modules
    yield saved
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 250, in run_setup
    _execfile(setup_script, ns)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 45, in _execfile
    exec(code, globals, locals)
  File "/tmp/easy_install-zjnzc588/numpy-1.20.0rc2/setup.py", line 513, in <module>
  File "/tmp/easy_install-zjnzc588/numpy-1.20.0rc2/setup.py", line 493, in setup_package
  File "/tmp/easy_install-zjnzc588/numpy-1.20.0rc2/setup.py", line 290, in generate_cython
    "cycler>=0.10",
RuntimeError: Running cythonize failed!

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-install-rxfxg1vd/matplotlib/setup.py", line 298, in <module>
    cmdclass=cmdclass,
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 144, in setup
    _install_setup_requires(attrs)
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 139, in _install_setup_requires
    dist.fetch_build_eggs(dist.setup_requires)
  File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 724, in fetch_build_eggs
    replace_conflicting=True,
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 782, in resolve
    replace_conflicting=replace_conflicting
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1065, in best_match
    return self.obtain(req, installer)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1077, in obtain
    return installer(requirement)
  File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 791, in fetch_build_egg
    return cmd.easy_install(req)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 704, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 730, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 915, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1183, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1169, in run_setup
    run_setup(setup_script, args)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 253, in run_setup
    raise
  File "/usr/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/usr/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 166, in save_modules
    saved_exc.resume()
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 141, in resume
    six.reraise(type, exc, self._tb)
  File "/usr/lib/python3/dist-packages/setuptools/_vendor/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 154, in save_modules
    yield saved
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 250, in run_setup
    _execfile(setup_script, ns)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 45, in _execfile
    exec(code, globals, locals)
  File "/tmp/easy_install-zjnzc588/numpy-1.20.0rc2/setup.py", line 513, in <module>
  File "/tmp/easy_install-zjnzc588/numpy-1.20.0rc2/setup.py", line 493, in setup_package
  File "/tmp/easy_install-zjnzc588/numpy-1.20.0rc2/setup.py", line 290, in generate_cython
    "cycler>=0.10",
RuntimeError: Running cythonize failed!

Edit setup.cfg to change the build options; suppress output with --quiet.

BUILDING MATPLOTLIB
  matplotlib: yes [3.3.3]
      python: yes [3.7.3 (default, Jul 25 2020, 13:03:44)  [GCC 8.3.0]]
    platform: yes [linux]
 sample_data: yes [installing]
       tests: no  [skipping due to configuration]
      macosx: no  [Mac OS-X only]

Cythonizing sources

----------------------------------------

It seems there is a module named cython missing …

Any suggestions?

Thanks&Cheers
Peter

Hi @DEACTIVATED69352686,

Let’s try installing from source to see what errors we get that way, run this:

cd ~/
git clone https://github.com/pi-top/pi-top-Python-Common-Library
cd pi-top-Python-Common-Library
pip3 install -e .
cd ~/
git clone https://github.com/pi-top/pi-top-Python-SDK.git
cd pi-top-Python-SDK
pip3 install -e .

I’m not familiar with that OS or if this will work, but it’s worth a shot!

Also, if you get another cython error try running pip3 install cython

Hi Duwudi,

thanks for Your suggestions. I did that (pip3 install cython and then the first pip3 install -e . and the clone of the pi-top-Python-SDK) It worked without errors. When I try the second pip3 install -e . (the one about the pi-top-Python-SDK) I get something I can not post here because as a new user I am only allowed to post 2 links, and the forum finds many of them, so I put the log here:

http://www.l4a.org/compilingerrors.pi-top-SDK.txt

it seems there are several libraries missing for the compilation, but I can’t identfy or find out where to get them.

Cheers&Thanks
Peter

Has anybody a suggestion about another try to compile PythonSDK? See the errors in compilingerrors.pi-top-SDK.txt in the previous post.
Cheers Peter

@DEACTIVATED69352686 try sudo apt-get install libv4l-dev

Hello duwudi,
thanks for the response. I have come quite far now with the following recipe, most of it being Your ideas:

sudo apt install gfortran libv4l-dev liblapack-dev

pip3 install cython
pip3 install scipy
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade Pillow
python3 -m pip install zmq

cd ~/
git clone https://github.com/pi-top/pi-top-Python-Common-Library
cd pi-top-Python-Common-Library
pip3 install -e .
cd ~/
git clone https://github.com/pi-top/pi-top-Python-SDK.git
cd pi-top-Python-SDK
pip3 install -e .

This ends up with a PythonSDK without any more errors.

When I type “pi-top devices hub”, though, or “pi-top battery” I get the error that there is no response from pt-device-manager. Of course that package is not installed because of the arm64 architecture, which was the beginning of all and the reason trying to install the pi-top PythonSDK from source.

So I am stucked again … do You have any suggestions?

Cheers
Peter

@DEACTIVATED69352686 yeah we don’t have pt-device-manager available to install except via apt and there’s no 64-bit version - this will be supported in the future but it’s not a priority for now. Are you looking to just get the battery readings or something more?

I feel like I could have saved everyone a lot of time by mentioning this earlier :sweat_smile:
If this is the only thing blocking you, then perhaps I can attempt to bring forward an experimental 64-bit build of the device manager. No promises, though!

@pi-topMIKE yeah I didn’t realise it was all functions wanted, just thought it was the basic SDK

Hello all,

thanks for Your remaks and offers.

I really do need battery check only (and perhaps a shutdown including power off - but that would be purely luxurious).

But if I type “pi-top battery” I am told “Error on pitop-battery.run: Resource temporarily unavailable”. If I type “pi-top devices” I get “Unable to get device type from pt-device-manager: Resource temporarily unavailable”. This happens both as root or unpriviledged user.

As I can’t find any file on the system named pitop-battery.run I do not know what to do.

An experimental package pt-device-manager for arm64 would probably not help, because there are many dependencies - and Devuan uses sysv as an init system and has no systemd (which pt-device-manager uses). But a 64bit pt-device-manager would perhapsly help with Pi OS - I could experiment with that as well because I have it on another sdcard.

Actually the pt-device-manager seems to be a pure Python script - I do not quite understand why the architecture is armhf at all - I would have named it as an “all” package instead of “armhf” - and the several dependencies look the same, as far as I have managed to look after them.

Cheers
Peter

1 Like

Error output

This is happening simply because you do not have the device manager installed.

Devuan support

You’re right that the package currently specifically handles systemd only. However, if you know how to also include support for sysv in the same package, I would be happy to accept that into the source!

For your purposes, you could simply set up the entrypoint to run on boot, and you have successfully replaced the systemd part of the package. Everything else should run, and you should get battery information!

Architecture: all

It seems that you are absolutely right about the fact that the architecture of the package could be defined as all! I guess there was some confusion on our end when we were labelling these packages!

We have already adopted this on our SDK (PR here), and I should be able to do something similar to the device manager shortly!

This is a huge improvement for us, so I really appreciate your input!

2 Likes

Here is the latest ‘all’ build of the device manager: https://transfer.sh/Q4ijQ/pt-device-manager_4.1.1-5.gbp0267c7_all.deb

This will likely be going into our apt repository soon, but thought you might want it sooner.

Let me know how you get on :slight_smile:

2 Likes

Hello pi-topMike,

I managed to install the pt-device-manager
with
dpkg --force-depends -i pt-device-manager_4.1.1-5.gbp0267c7_all.deb.
I received the following remarks about missing packages:
pt-device-manager hängt ab von python3-pitopcommon; aber:

  • Paket python3-pitopcommon ist nicht installiert.*
  • pt-device-manager hängt ab von python3-systemd; aber:*
  • Paket python3-systemd ist nicht installiert.*
  • pt-device-manager hängt ab von python3-zmq; aber:*
  • Paket python3-zmq ist nicht installiert.*
  • pt-device-manager hängt ab von python3-smbus; aber:*
  • Paket python3-smbus ist nicht installiert.*
  • pt-device-manager hängt ab von python3-spidev; aber:*
  • Paket python3-spidev ist nicht installiert.*
    (sorry about the German locale - “hängt ab” means “depends”, “ist nicht installiert” means “is not installed”.)

When I start pt-device-manager with
/usr/lib/pt-device-manager/pt-device-manager &
I get the following:
raceback (most recent call last):

  • File “/usr/lib/pt-device-manager/pt-device-manager”, line 14, in *
  • from ptdm_controller import Controller*
  • File “/usr/lib/pt-device-manager/ptdm_controller.py”, line 5, in *
  • from systemd.daemon import notify*
    ModuleNotFoundError: No module named ‘systemd.daemon’

When I try to install other packages, apt tells me to do an apt --fix-broken install, and it always ends up in the removal of pt-device-manager.

So at the moment I have no more ideas.

Cheers&Thanks
Peter

python3-pitopcommon needed to be switched to all as well: https://transfer.sh/701kp/python3-pitopcommon_0.8.1-8.gbp3531e2_all.deb

With both debs in the same location, and no other debs, you can run:

sudo apt install ./*.deb

This should resolve dependencies automatically for you!

Helle Mike,

that nearly worked. I could solve some dependencies including the raspi-config package I managed to get from https://archive.raspberrypi.org/debian/pool/main/r/raspi-config/raspi-config_20200601_all.deb. Still missing is the python3-spidev package, which is not in debian … Of course it is in https://files.pythonhosted.org/packages/62/56/de649e7d95f9fcfaf965a6eb937b4a46bc77ef21487c99cde1a7a0546040/spidev-3.5.tar.gz, but it is no package and will not resolve the dependency.

Cheers
Peter

Any suggestions about the python3-spidev package?

Cheers
Peter

So when we needed a Debian package from a Python module, we have traditionally used py2deb.

However, I would probably recommend fpm now, as it seems much simpler. Check out its GitHub Wiki pages for examples on how it works, and see how you get on!

Let me know if you need more help!

1 Like

OK. I am not a Debian package builder and will not become one.
So I will live with a Pi-Top without battery status control.
Thanks for bothering.
Peter

My Pi-Top battery has died some days ago. So I am no longer a Pi-Top user and quit the forum now.
Cheers
Peter