Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Installation on Raspberry Pi OS? #25

Closed
phkus opened this issue Mar 21, 2022 · 7 comments
Closed

Installation on Raspberry Pi OS? #25

phkus opened this issue Mar 21, 2022 · 7 comments

Comments

@phkus
Copy link

phkus commented Mar 21, 2022

I'd first tried to install the conceptarium on the preinstalled 32-bit Pi OS, which failed because I could not get Streamlit to run.

Then I've tried it with the new 64-bit version of Pi OS. Streamlit works now, but the Pytorch-version linked in the readme could not be installed.

Have you managed to install the conceptarium on Raspberry Pi OS? If not, which OS have you been using, so that I can try that out?

@paulbricman
Copy link
Owner

Yes, I'm actually using it on a Raspberry Pi 4 with 8GB. Because it's ARM, simply including pytorch it in the requirements doesn't work for some reason. I installed pytorch from this custom wheel: https://github.com/ljk53/pytorch-rpi/blob/master/torch-1.9.0a0%2Bgitd69c22d-cp39-cp39-linux_aarch64.whl. You can also build it from scratch, but it takes unnecessarily long.

⚠️ If you're toying with Raspberry Pi 3 (1GB RAM iirc), the conceptarium will most likely NOT work because there's not enough RAM.
⚠️ Also, expect things to be a tad slow on a Raspberry :). I have some optimizations in mind but they'll come over time.

Let me know how the setup goes.

@phkus
Copy link
Author

phkus commented Mar 22, 2022

Ah, I'd forgotten to mention which Pi I'm using: I have a Pi 400 because it's currently so difficult to get your hands on a normal Pi 4. Therefore I only have 4GB RAM. Today I installed Ubuntu 20.10 and also increased the Swap memory in case it's about the RAM.

Trying to install Pytorch from https://github.com/ljk53/pytorch-rpi once again failed, but the wheel from https://github.com/Qengineering/PyTorch-Raspberry-Pi-64-OS apparently worked (also PyTorch 1.9.0). The conceptarium installation also seems to have worked, although I had to manually install quite a few dependencies.

Now the backend is running, and streamlit with the browser interface is also working. But I cannot login with localhost:8000 + a new token, and there is no "knowledge" folder created anywhere on my system.

This is the log in the backend terminal:

INFO: 127.0.0.1:51220 - "GET /custodian/check HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/home/philipp/.local/lib/python3.9/site-packages/starlette/middleware/base.py", line 41, in call_next
message = await recv_stream.receive()
File "/home/philipp/.local/lib/python3.9/site-packages/anyio/streams/memory.py", line 81, in receive
return self.receive_nowait()
File "/home/philipp/.local/lib/python3.9/site-packages/anyio/streams/memory.py", line 74, in receive_nowait
raise EndOfStream
anyio.EndOfStream

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/philipp/.local/lib/python3.9/site-packages/uvicorn/protocols/http/h11_impl.py", line 366, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/home/philipp/.local/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in call
return await self.app(scope, receive, send)
File "/home/philipp/.local/lib/python3.9/site-packages/fastapi/applications.py", line 261, in call
await super().call(scope, receive, send)
File "/home/philipp/.local/lib/python3.9/site-packages/starlette/applications.py", line 112, in call
await self.middleware_stack(scope, receive, send)
File "/home/philipp/.local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 181, in call
raise exc
File "/home/philipp/.local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 159, in call
await self.app(scope, receive, _send)
File "/home/philipp/.local/lib/python3.9/site-packages/starlette/middleware/base.py", line 63, in call
response = await self.dispatch_func(request, call_next)
File "/home/philipp/.local/lib/python3.9/site-packages/slowapi/middleware.py", line 56, in dispatch
response = await call_next(request)
File "/home/philipp/.local/lib/python3.9/site-packages/starlette/middleware/base.py", line 44, in call_next
raise app_exc
File "/home/philipp/.local/lib/python3.9/site-packages/starlette/middleware/base.py", line 34, in coro
await self.app(scope, request.receive, send_stream.send)
File "/home/philipp/.local/lib/python3.9/site-packages/starlette/exceptions.py", line 82, in call
raise exc
File "/home/philipp/.local/lib/python3.9/site-packages/starlette/exceptions.py", line 71, in call
await self.app(scope, receive, sender)
File "/home/philipp/.local/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in call
raise e
File "/home/philipp/.local/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in call
await self.app(scope, receive, send)
File "/home/philipp/.local/lib/python3.9/site-packages/starlette/routing.py", line 656, in call
await route.handle(scope, receive, send)
File "/home/philipp/.local/lib/python3.9/site-packages/starlette/routing.py", line 259, in handle
await self.app(scope, receive, send)
File "/home/philipp/.local/lib/python3.9/site-packages/starlette/routing.py", line 61, in app
response = await func(request)
File "/home/philipp/.local/lib/python3.9/site-packages/fastapi/routing.py", line 227, in app
raw_response = await run_endpoint_function(
File "/home/philipp/.local/lib/python3.9/site-packages/fastapi/routing.py", line 160, in run_endpoint_function
return await dependant.call(**values)
File "/home/philipp/conceptarium/backend/./main.py", line 158, in check_custodian
return auth(authorization.credentials, True)
File "/home/philipp/conceptarium/backend/./security.py", line 17, in auth
json.dump(records, open(path, 'w'))
FileNotFoundError: [Errno 2] No such file or directory: '../knowledge/records.json'

There's also an error in the frontend, but I'm assuming the problem is in the backend again?

What I've tried is simply paste the "knowledge" folder from the conceptarium on my Mac in the home directory and access that, but I get exactly the same results.

@phkus
Copy link
Author

phkus commented Mar 22, 2022

Update: I've got it now! My imported knowledge folder should have gone into the base conceptarium directory, not the main user folder as was the case with the Docker version.

Still: Shouldn't it have created such a folder for me when I first try to log in?

First impression is that it's slower, but perfectly usable. I'll try to set up remote access in the next few days.

@paulbricman
Copy link
Owner

Ah, I'd forgotten to mention which Pi I'm using: I have a Pi 400 because it's currently so difficult to get your hands on a normal Pi 4. Therefore I only have 4GB RAM.

I totally get that, I bought one a couple weeks ago in part for the same reason! I don't plan on using it for a few months, but was worried it'd also go out of stock by then.

The conceptarium installation also seems to have worked, although I had to manually install quite a few dependencies.

Would it be possible to history your way back to those and paste them here? I tried adding stuff to the various requirements.txt, but I might have missed some stuff still.

Still: Shouldn't it have created such a folder for me when I first try to log in?

Huh, yeah it should be created if it's not there, I'll open up a new issue for that and try to replicate it.

First impression is that it's slower, but perfectly usable. I'll try to set up remote access in the next few days.

Awesome!

@phkus
Copy link
Author

phkus commented Mar 23, 2022

Would it be possible to history your way back to those and paste them here? I tried adding stuff to the various requirements.txt, but I might have missed some stuff still.

In fact they were listed in the requirements.txt, but in my case still not installed automatically. Here are the ones that could then be installed with a simple pip install:

  • orjson
  • secrets
  • uvicorn
  • fastapi
  • feedgen
  • ics

I also had to manually install sentence transformers 2.1.0. 2.0.0 did not work.

@phkus
Copy link
Author

phkus commented Mar 23, 2022

One other thing: I'd installed streamlit manually before starting the installation, because that was the requirement that hadn't worked at all on the 32-bit OS. So that could be another one that's not installed directly.

If I remember correctly streamlit and orjson had to be manually installed for the Docker instance as well.

@paulbricman
Copy link
Owner

Oh maybe the first pytorch issues in requirements.txt led to those other packages not being tackled at all? I see they're all in their respective requirements, and the docker image is built via github actions to bake those dependencies in the image. Anyway, closing this for now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants