ankraft / ACME-oneM2M-CSE

An open source CSE Middleware for Education.
https://acmecse.net/
BSD 3-Clause "New" or "Revised" License
23 stars 16 forks source link

installing ACME in RPI 32bit - dependency error - tree-sitter-languages #165

Open Alan888-dev opened 1 month ago

Alan888-dev commented 1 month ago

Hello, I have been trying to install ACME in a 32 bit RPI but it fails because of (at least) dependency related with

tree-sitter-languages==1.10.2

Is there any docker/container image we can use in 32 bit RPI or any solution to overcome the installing error?

Thank you.

A.

ankraft commented 1 month ago

I am sorry, but sometimes the dependencies change their requirements. Especially "tree-sitter-languages" depends on a lot of other repositories.

Could you try the solution that is mentioned at the end of this issue: https://github.com/oracle/graalpython/issues/378 ? Run it before the pip install -r requirements.txt and pip should then use the already installed package.

Docker: there is a Dockerfile in the tools/Docker directory that might be a good start. Unfortunately, I haven't updated the image on docker hub, yet.

Update

I tried it on an old RP3 with Python 3.11.4 and it works:

  1. Install ACME by locally cloning the repo.
  2. Install tree-sitter-languages manually:
    pip install wheel Cython
    pip install --no-build-isolation git+https://github.com/grantjenks/py-tree-sitter-languages@v1.10.2
  3. Install the rest of the packages:
    pip install -r requirements.txt
  4. Wait

I guess I have to update the Raspberry Pi HowTo.

ankraft commented 1 month ago

Could you please confirm that this solution solves your issue? Or did you find a better solution?

Alan888-dev commented 1 month ago

Did not solve the problem. Now I am trying to compile Geos lib for version 3.8 but it is being an hard time (mainly because RPI zero is not very fast)... On laptop is everything well and the only difference for the RPI is the Geos version (laptop 3.8 and RPI 3.9)

ankraft commented 1 month ago

Ah, the geos library. At some point it was not available on RPis anymore. I remember now. And yes, everything takes forever on the zero. Make sure you do a backup of the SD card when you finished...

Would you be so kind to write down the steps that are required to compile and install it? I like to add this as an extra step to RPi HowTo as well.

Alan888-dev commented 1 month ago

I am still trying... After compiling the GEOS 3.8.0 (the same I have in my laptop where ACME runs well) now I see the error: undefined symbol: GEOSDifferencePrec_r when: python -m acme

Alan888-dev commented 1 month ago

After compiling geos 3.8.0:

$geos-config --version returns: 3.8.0

$python -m acme

returns: undefined symbol: GEOSDifferencePrec_r...


Then:

$apt-get install libgeos-dev $geos-config --version returns 3.9.0

$python -m acme

Returns: undefined symbol: GEODensify_r

ankraft commented 1 month ago

I just checked the installation on my RPi3. Perhaps this helps?

Debian: 11.8 (via cat /etc/debian_version) Python: 3.11.4 (via python3.11 --version) shapely: 2.04 (via pip list) geos: 3.9.0 (via geos-config --version)

Alan888-dev commented 1 month ago

I am trying now on a Raspberry Pi 2 B (to have a faster network / by cable). The difference to your RPI3 I think is the 32/64 bit (a part from RAM) Even though, I am going to find out if it is possible to use the versions of your installation and see what happens... By the way did you installed ACME using requirements.txt or just python -m pip install acmecse ?

ankraft commented 1 month ago

I have an old RPi zero W somewhere here. If I find time tomorrow I will try. I know that there are some limitations regarding dates and 32-bit timestamps I run into in the past, but I haven't tried to run ACME on that zero for some time.

Regarding installation method: Both. And both work fine. Maybe the Python 3.11 makes a difference?

Thank you very much for your patiences and perseverance!

Alan888-dev commented 1 month ago

I would like to make some tests and ... to ACME in a low resource SBC so I started by trying the RPI Zero W. However I realized that some installing operations got failed because the network "time-out"/"read-error". Then I move to RPI 2B to use the network cable... However GEOS takes almost 12 hours to compile. I also tried python 3.11 via apt get and via source code compilation (also more os less 12 hours to compile :-) and many other versions)... But I am still trying

ankraft commented 1 month ago

I will try in parallel. I started the python 3.11.4 compile four hours ago on the RPi Zero W, and it's ongoing. I haven't even start with GEOS...

Alan888-dev commented 1 month ago

Great! I have just compiled the 3.11.4. Geos is already installed in the right version... I am dealing now with shapely.

Alan888-dev commented 1 month ago

RPI 1b:

Geos => 3.9.0 already

PYTHON 3.11.4: wget (...)python 3.11.4 tar xf file.tar.xz ./configure make sudo make install python3 --version 3.11.4

python3 -m pip install shapely==2.0.4 Uninstalled v2.0.6 and installed v2.0.4

python -m pip install acmecse python -m pip install --upgrade acmecse acmecse Error: undefined symbol: GEOSDensify_r

Then

git clone https://github.com/ankraft/ACME-oneM2M-CSE.git cd ACME-oneM2M-CSE python3 -m pip install -r requirements.txt Error: No matching distribution found for tree-sitter-languages==1.10.2

Then: python3 -m pip install wheel Cython python3 -m pip install --no-build-isolation git+https://github.com/grantjenks/py-tree-sitter-languages@v1.10.2 python3 -m acme Error: undefined symbol: GEOSDensify_r

Then: python3 -m pip install -r requirements.txt python3 -m acme Error: undefined symbol: GEOSDensify_r

acmecse Error: undefined symbol: GEOSDensify_r

No way...

ankraft commented 1 month ago

I am very sorry that after all these efforts the results are still the same. Perhaps there is a problem with the old 32 bit systems? But I have the GEOS lib running fine on my RPi3 test system. I am still compiling on the old RPi zero and let you know. Whenever it is finished...

In case you just want to try and the newer features are not that important you may try to clone an older version of ACME? This one (https://github.com/ankraft/ACME-oneM2M-CSE/releases/tag/0.12.0) is the last one that doesn't use shapely etc for geo-location stuff.

In the meantime I installed the latest raspian version and now try that one. python 3.11 comes pre-installed, but will try to use a fresh install as well of Python 3.11.10.

ankraft commented 1 month ago

I got it working.

RPi Zero W with a fresh Raspian 12 "bookworm", lite version (w/o desktop). This version comes with Python 3.11.2 installed.

Nothing else was necessary to install or compile. ACME should run fine, except the text UI. There is a race condition that happens because the RPi Zero is too slow. I have to investigate how to handle this issue.

Alan888-dev commented 1 month ago

Let me return to RPI Zero and try these actions... Thanks

Alan888-dev commented 1 month ago

Everything goes well except: bin/acmecse which shows: Error during import: Package 'textual.widgets' has no class 'TextArea'.

I have installed all requirements from requirements.txt with success but...

Can you share the package version for textual.widgets you are using, please?

ankraft commented 1 month ago

Did you execute bin/pip install -U textual That should update the library to the version that contains that module. The latest one for textual is 0.81, I think.

There is another small problem with the bash shell's environment variables that is buggering this release (basically environment variables that contain a $ sign. I usually use the fish shell and never noticed this before. I will create a new release tomorrow. Sorry for that.

Alan888-dev commented 1 month ago

I re-executed all the steps again and now it is working. I am using HTTP interface to remotely interact with ACME on the RPI zero and I have just created some AEs, executed some retrieve operations and it is working well.

Thank you so much!

ankraft commented 1 month ago

Great news! Glad to be of help.

This also gave me some more details to add to the RPi how-to.