devDucks / astroarch

ArchLinux for astrophotography - made for raspberrypis, can run also on x64 machines
MIT License
47 stars 6 forks source link

1.9 update and libcamera problems #95

Open ripkrizbi opened 1 month ago

ripkrizbi commented 1 month ago

Hi, I've updated to the 1.9 and got reports thet the indi camera driver is failing. I tried diagnosing the libcamera, ran the libcamera-hello, and I got the error about the missing libavcodec.so.60. Apparently the avcodec lib was bumped up to 6.1 in the archlinux update and now the libcamera-rpi breaks (and consequently the indi-pylibcamera, which depends on the libcamera-rpi). Any help is much appreciated in getting the camera to work again! Many thanks for your continuous support!

MattBlack85 commented 1 month ago

thanks for the report! Having some rest at the moment after a small surgery, if I will find some time, I will recompile the driver in the upcoming week, thanks for the patience in advance!

Mattia

ripkrizbi commented 1 month ago

Best wishes for the recovery! Take your time!

I investigated a bit more and there seems to be another issue, the indi-pylibcamera depends on libcamera-rpi, which is identical (at least in version) to the installed libcamera, but it triggers the uninstall of libcamera and install of libcamera-rpi, and in the process an outdated python-libcamera is installed which breaks the indi driver. On top of that, the rpicam-apps does not seem to be installed by default with the stack, together with all dependencies. Just to add a bit to the problem :)

Grazie e buon recupero!

MattBlack85 commented 3 weeks ago

hi @ripkrizbi, I recompiled everything and it seems to be working, whenever you have time to update it woudl be great to get a feedback, thanks!

ripkrizbi commented 3 weeks ago

Thank you Mattia!

I did a quick test with a completely fresh install, followed by update-astroarch, then pacman -S indi-pylibcamera

This prompted me to remove libcamera- in favour of libcamera-rpi- and initially it misses to install the rpicam-apps and its dependency (you may wish to add it explicitely to PKGBUILD) libpisp, which I installed manually.

After that, a quick test with libcamera-hello seems to be working.

The INDI part does not work (indiserver -v indi_pylibcamera), as the python-* packages are all compiled for the version 3.11 and the current python version in the new arch is 3.12, so all the installed dependencies are not visible to indiserver's python.

While you were in recovery I tried to recompile the whole stack myself (Arch is not my home territory :) ) and have made it to work, except some of the python depndencies, which I had to brute-force install via pip (could not get the python stuff to compile :( via PKGBUILD :( ). I have saved this install on a separate SD card and I can look up all the dependencies if you want me to, I think I needed to install additional python packages on top of the ones you provide in the stack. If I remember correctly, the very new release of python-libcamera2 has additional stuff it requires.

Additional question - why do you maintain the separate libcamera-rpi set of packages? The ones that come with the libcamera available through extra repo are more up to date (and you can remove one level of complexity by just using the distro packages if I'm correct)...

Thank you for the great support in resolving this, let me know if I can be of any further help!

MattBlack85 commented 3 weeks ago

thanks @ripkrizbi you are absolutely right, I missed some deps in PKGBUILD, I packaged it only once (this week was the second) and the procedure is not perfect, thanks to your inputs it will be :)

I will recompile pylibcamera today against py3.12

to your main question, libcamera (https://git.libcamera.org/libcamera/libcamera.git/) officially supports v4l2 cameras but doesn't support specific rpi cameras, that's why the raspi folks mantain a fork (https://github.com/raspberrypi/libcamera) that adds a bunch of raspi camera specifics.

There was an idea (still on the table) to replace completely (and for good) the normal version of libcamera with the one for the raspi. In my mind it makes sense but I am unsure if this won't break other libcamera "normal" stuff and that's why it's not been done so far

ripkrizbi commented 3 weeks ago

Many many thanks!

All clear about the libcamera-rpi.

Please make sure you recompile all the python-* dependencies for the stack, as I mentioned there were quite a few, and some I was unable to compile as packages :(

Thank you once again for the great support, this really makes a difference!

MattBlack85 commented 2 weeks ago

@ripkrizbi installing now indi-pylibcamera should bring in anything needed.

I checked the python dependencies but as far as I can tell, the latest versions of the ones I have within my repo have all been compiled against 3.12

ripkrizbi commented 2 weeks ago

Thanks Mattia!

unfortunately, some of the deps you maintain are still compiled for 3.11: simplejpeg, av, exifread, kmsxx

I compiled the simplejpeg and bumped it to the most recent version (1.7.4), attached is the PKGBUILD PKGBUILD.simplejpeg.txt (I had to compile it within the venv because there is no arch package for python-cmake, I'm sure there is a simple solution to this but I was unable to find it :) )

I'm struggling to compile the av at the moment as there seem to be some incompatibilities with the new ffmpeg. So I had to brute-force it (pip install av --break-system-packages). Same for kmsxx (pip install rpi-kms --break-system-packages)

after these updates, I'm able to start the indiserver with the indi_pylibcamera module.

albmef commented 1 week ago

Hi i tried installing indi-pylibcamera in astroarch 1.9.0 on a pi4, passed the resolved conflicts with libcamera, but it does not work.

i tested my HQ camera + PI4_4GB with an ASTROBERRY sdcard and it works with the rpicam driver

here's is what i get when i try to launch the server by hand. i tried to fix that by installing the missing python packages one by one but i stumble on the missing "simplejpeg" one that i'm not able to fix.

any (easy) workaround?

Please Help ! regards,

~ » indiserver indi_pylibcamera
2024-09-05T19:39:06: startup: indiserver indi_pylibcamera 2024-09-05T19:39:06: Driver indi_pylibcamera: Traceback (most recent call last): 2024-09-05T19:39:06: Driver indi_pylibcamera: File "/usr/bin/indi_pylibcamera", line 33, in 2024-09-05T19:39:06: Driver indi_pylibcamera: sys.exit(load_entry_point('indi-pylibcamera==2.6.4', 'console_scripts', 'indi_pylibcamera')()) 2024-09-05T19:39:06: Driver indi_pylibcamera: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-09-05T19:39:06: Driver indi_pylibcamera: File "/usr/bin/indi_pylibcamera", line 25, in importlib_load_entry_point 2024-09-05T19:39:06: Driver indi_pylibcamera: return next(matches).load() 2024-09-05T19:39:06: Driver indi_pylibcamera: ^^^^^^^^^^^^^^^^^^^^ 2024-09-05T19:39:06: Driver indi_pylibcamera: File "/usr/lib/python3.12/importlib/metadata/init.py", line 205, in load 2024-09-05T19:39:06: Driver indi_pylibcamera: module = import_module(match.group('module')) 2024-09-05T19:39:06: Driver indi_pylibcamera: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-09-05T19:39:06: Driver indi_pylibcamera: File "/usr/lib/python3.12/importlib/init.py", line 90, in import_module 2024-09-05T19:39:06: Driver indi_pylibcamera: return _bootstrap._gcd_import(name[level:], package, level) 2024-09-05T19:39:06: Driver indi_pylibcamera: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-09-05T19:39:06: Driver indi_pylibcamera: File "", line 1387, in _gcd_import 2024-09-05T19:39:06: Driver indi_pylibcamera: File "", line 1360, in _find_and_load 2024-09-05T19:39:06: Driver indi_pylibcamera: File "", line 1331, in _find_and_load_unlocked 2024-09-05T19:39:06: Driver indi_pylibcamera: File "", line 935, in _load_unlocked 2024-09-05T19:39:06: Driver indi_pylibcamera: File "", line 995, in exec_module 2024-09-05T19:39:06: Driver indi_pylibcamera: File "", line 488, in _call_with_frames_removed 2024-09-05T19:39:06: Driver indi_pylibcamera: File "/usr/lib/python3.12/site-packages/indi_pylibcamera/indi_pylibcamera.py", line 12, in 2024-09-05T19:39:06: Driver indi_pylibcamera: from picamera2 import Picamera2 2024-09-05T19:39:06: Driver indi_pylibcamera: File "/usr/lib/python3.12/site-packages/picamera2/init.py", line 9, in 2024-09-05T19:39:06: Driver indi_pylibcamera: from .picamera2 import Picamera2, Preview 2024-09-05T19:39:06: Driver indi_pylibcamera: File "/usr/lib/python3.12/site-packages/picamera2/picamera2.py", line 26, in 2024-09-05T19:39:06: Driver indi_pylibcamera: from picamera2.encoders import Encoder, H264Encoder, MJPEGEncoder, Quality 2024-09-05T19:39:06: Driver indi_pylibcamera: File "/usr/lib/python3.12/site-packages/picamera2/encoders/init.py", line 6, in 2024-09-05T19:39:06: Driver indi_pylibcamera: from .jpeg_encoder import JpegEncoder 2024-09-05T19:39:06: Driver indi_pylibcamera: File "/usr/lib/python3.12/site-packages/picamera2/encoders/jpeg_encoder.py", line 3, in 2024-09-05T19:39:06: Driver indi_pylibcamera: import simplejpeg 2024-09-05T19:39:06: Driver indi_pylibcamera: ModuleNotFoundError: No module named 'simplejpeg' 2024-09-05T19:39:06: Driver indi_pylibcamera: read: Connection reset by peer

MattBlack85 commented 5 days ago

@albmef as @ripkrizbi made me noticing, there are some deps that are broken. Will try to fix them asap to have the package ready to be working with no additional steps

albmef commented 4 days ago

thanks ! Feel free to ask for any quick/extensive test if needed i own a PI4_4GB fitted with an HQ cam i can't wait to take nice night sky pictures with ;) regards, bob

MattBlack85 commented 4 days ago

@ripkrizbi I got all but exif recompiled, are you able to tell me what package requires it and which version? I think we are using exifread but just noticed there is also an exif package and got confused

ripkrizbi commented 4 days ago

@MattBlack85 first of all, thank you for all the effort in maintaining the distro and the extra packages! I'm fully aware how much effort it takes to do such a thing, especially on a voluntary basis, and just want to tell you how much I appreciate it!

I quickly checked, and can confirm that the packages I needed to make the indi_pylibcamera driver work were the simplejpeg, avand kmsxx. As I was going through the packages you maintain I noticed that the exifread was still in 3.11 so I included it into the list, thinking that it may be a dependency for something else.

So, at least for my issue, exifread is not required.

On a side note, how frequent are your bleeding-edge libindi/drivers/kstars builds? Do you have an automated process for periodic rebuilds? I'm trying to do a fresh git-based recompile because there may be a fix for my mount in the indilib after the official 2.0.9...

albmef commented 4 days ago

Hi thanks for your kind support today i upgraded arch and the new boost lib version 1.86.0 broke rpicam-apps (see my new issue https://github.com/devDucks/astroarch/issues/105) currently i'm performing some test with HQ camera, for my astro setup, so i needed a quick and dirty fix regards, bob

MattBlack85 commented 3 days ago

@ripkrizbi thanks for your words 🙇

For bleeding edge, I don't push it very often, I don't have enough horse power with my building machine to have it running periodically. My build box is a pi4. The best thing would be to have a github actions running daily and in theory, that could work but only for indi. Kstars is a beast and it takes hours to compile on github actions or a raspberrypi 4. I workaround that when I package the new official versions by using distcc but that's it, no fancy automation😋

I am planning to replace my build box with 2/3 Raspi 5 2Gi, that would probably help since the cluster would run 24/7 and have 16 powerful arm cpu to use, but when it is gonna happen I really have no idea 🫠