cortictechnology / cep

CEP is a software platform designed for users that want to learn or rapidly prototype using standard A.I. components.
MIT License
167 stars 21 forks source link

Not able to access setup site #21

Closed philmurp closed 2 years ago

philmurp commented 2 years ago

I am using VMWare Workstation since I dont have a Pi 4 and they are very hard to come by right now. I am running latest Pi OS; was able to download the CEP packages with success and Desktop rebooted.

I am able to SSH into the Pi so I believe that confirms we are on the same LAN and able to access the Pi. However, every time I run:

http://<raspberry_pi_hostname>.local/setup

I get an error "Connection was Reset". Tried on Chrome and Edge browsers. Any idea why I cant access the setup site, do I need to run any commands on the Pi desktop to trigger it to act like server?

Thanks!

michaelhwn commented 2 years ago

Hi @philmurp, I haven't tried to run on a VM yet. But you can try to access the setup page using the IP address directly:

http://<ip_of_vm>/setup

If the VM is accessible within the local network, this approach should work.

philmurp commented 2 years ago

Not working with that, I am using same IP as I do with SSH (with success) and I get the "Site Cant Be Reached" "Connection was Reset"

Not sure how I can access from SSH but not for this purpose. Is there any code I can run to test it was properly installed?

michaelhwn commented 2 years ago

Hi @philmurp, can you use the following commands to check if the CAIT webapp and CURT backend is running properly in the VM?

sudo journalctl -u cait_webapp.service sudo journalctl -u curt_containers.service

It is possible that these services are not running in the VM, and that could explain why you cannot access the web app.

philmurp commented 2 years ago

Thanks, looks like it isnt running as per image. Guess it didnt totally install correctly.

Capture

michaelhwn commented 2 years ago

Right, the services aren't starting. If you could copy and paste the error message here (the red lines), I may be able to help check what packages are missing in your image.

philmurp commented 2 years ago

Repasted image: Capture_2

michaelhwn commented 2 years ago

Ah, bash is missing. The CEP's installation script uses bash to execute commands, you can install bash before running the installation script:

sudo apt-get install bash -y

philmurp commented 2 years ago

I double checked, and ran your install code; says bash is already the newest version (5.0-4). Rebooted and same error.

is there a way to check the file, online it says it could be from incorrect shebang pattern? https://stackoverflow.com/questions/16987961/bin-bash-no-such-file-or-directory

michaelhwn commented 2 years ago

Can you type this and check where is bash located:

which bash

philmurp commented 2 years ago

Result is: /bin/bash

I set the default of Auto Login = Login as user 'pi' / not sure if that matters

michaelhwn commented 2 years ago

I see, the problem is that the services use /usr/bin/bash to launch the startup scripts. In your image, bash is located at /bin/bash instead. This is a bit different from a standard Raspberry Pi OS installation. You will need to edit these files in order to run CEP in your image:

sudo nano /etc/systemd/system/cait_webapp.service sudo nano /etc/systemd/system/cait_webapp.service

In both files, find the line starts with ExecStart= and change /usr/bin/bash To /bin/bash. After that save and close the files. Restart the image and it should run.

philmurp commented 2 years ago

Thanks for all the help! Saw service started but some other issues;

First image for CAIT line Second image for CURT line CAIT CURT

michaelhwn commented 2 years ago

This error is caused by a missing Python package, it should be installed through pip during the setup process. I think there were some errors during the installation process, it would be great if you can try to install again and capture the errors during the process.

philmurp commented 2 years ago

I try to re-run install script: First off I get this warning: Capture

philmurp commented 2 years ago

I am running despite this warning; will update once it completes

michaelhwn commented 2 years ago

Sure, ignoring this warning is safe in this case as the docker command was initially installed through this script. This line installs the Python packages that you were missing before, so if there are any errors happen, they should be related to pip. Please let me know if you observe any pip errors during the setup process.

philmurp commented 2 years ago

This time I am able to access initial setup screen, but not fully loading and some performance issues. I will try later today without anything else open. But at this point it may be my computer power/emulator issue

michaelhwn commented 2 years ago

Glad to know it's getting closer. For sure there can be some uncertainties when using an emulator to run the software. Please free feel to let me know if you need more help in debugging this approach.

philmurp commented 2 years ago

Will do, if I could just find a Raspberry Pi to buy I would have done that, but they have been out of stock for a while now. Any chance OrangePi, BananaPi type boards work with this software as alternate?

michaelhwn commented 2 years ago

Right, the chip shortage issue really affects a lot of things. I haven't tested with any of the Pi-alternative boards. However, from a technical perspective, since CEP is designed for running in a 32-bit Debian-based OS on a 64-bit Arm processor, with some efforts, it is very probable that it will run on those boards. But I cannot estimate the scope of work to do that, you will need to make sure the correct packages and dependencies of CEP are working well on those boards. If you want to go down this path, I am happy to offer some advice and help when you encounter issues.

philmurp commented 2 years ago

It seems to be working ok so far; but when using OAK D camera plugged in it says no OAK D device detected even though I can see it in my emulator window.

Do I need to download the DepthAI packages first? I thought they were included in this install but maybe not.

michaelhwn commented 2 years ago

No, you shouldn't need to manually install the DepthAI packages. All of the dependencies are installed into the corresponding Docker containers. Where did it say no OAK-D device is detected? Did it say that on the setup page, or on the programming page?

philmurp commented 2 years ago

It showed up during setup (although I couldnt run a preview but I think that is because of my slow connection); then during programming I am getting the pop-up error when I try and setup something with OAK-D.

My emulated Pi gets results when I run lsusb and since I detected it during setup I think its an initialization issue not detection issue. Capture

michaelhwn commented 2 years ago

I see, all of the DepthAI related packages are installed in the vision Docker container, and that may not be running properly. Within your VM, please run the following command and post the output messages here:

sudo journalctl -u curt_containers.service -f

philmurp commented 2 years ago

Attached here: 1

michaelhwn commented 2 years ago

Thanks for the log @philmurp. But it only shows the log of the homeassistant Docker container, did you see any logs that start with the name curt_vision?

philmurp commented 2 years ago

Nothing yet, I tried to leave the window open and re-run the cortic interface but still nothing starting with curt_vision. Maybe its not even starting?

Is it possible it has to do with my bash location? I did change the files like you mentioned above to get rid of /usr

This is what I get with setup: I can see the camera, but it never finishes "Retrieving Device Information" or shows me a preview: Capture

michaelhwn commented 2 years ago

Right, I think the Docker containers are not running at all. We will need to see what happened when the containers were starting. To do that, you will need to open two terminals in the VM, in one of the terminals (let's call it the log terminal) enter sudo journalctl -u curt_containers.service -f and leave it printing the logs. In another terminal, you can enter sudo systemctl restart curt_containers.service. The log terminal should now show the Docker containers are being stopped and restarted. Please capture that log and post it here.

philmurp commented 2 years ago

Capture2 Capture

michaelhwn commented 2 years ago

The logs of the containers look ok so far, were there any messages that look like "Connected to broker..." and "Subscribing to topic..."? These messages indicate whether the MQTT broker was started successfully and if the different modules could connect to it.

philmurp commented 2 years ago

There is a "Fatal Python error: (pygame parachute) Segmentation Fault next to "curt_voice_1"

Also later on "error during setup Capture of component zeroconf" next to" homeassistant.setup"

philmurp commented 2 years ago

but then further down curt_vision_1 says "vision connected to broker with result code 0" and vision subscribed to cait/conf and cait/task

michaelhwn commented 2 years ago

I think there are multiple problems here:

  1. The emulated audio hardware is not compatible with the CEP's voice module. This can only be solved by installing the proper driver within the voice container. This can be a tedious process as you need to figure out which driver to install, and you also need to maintain a local version of the voice container in your machine.
  2. Although the OAK-D device is being detected, it cannot be properly used by the vision module within the VM. This may have something to do with the emulated USB hardware.

Both of these problems will need quiet a bit of effort to investigate. It may be better for you to wait until an actual Raspberry Pi 4B board is available, then run CEP on the actual hardware. If you really want to get it working in the VM, I suggest you to focus on getting the OAK-D device working first. It may have something to do with USB passthrough and permission settings related to the VM software you are using.

philmurp commented 2 years ago

Thanks for all the help, I will poke around VMWare settings a bit more.

I do have a Jetson Nano board; but it is 64 bit and runs on JetPack OS, so not sure how it will work. Might be worth a shot, not sure if you have heard anyone try this on that board.

michaelhwn commented 2 years ago

You are welcome @philmurp. If you want to try on the Jetson Nano. I recommend you to wait for a day or two as I am currently updating CEP to support the 64-bit Raspberry Pi OS.

michaelhwn commented 2 years ago

Hi @philmurp, I have tested that even the current version of CEP will work on 64bit Raspberry Pi OS. As long as the Docker containers can be run on the 64-bit OS you have, CEP should work. However, I suggest you to use the dev branch when you try setting it up. To check out the dev branch, please perform the following steps:

git clone https://github.com/cortictechnology/cep.git
cd cep
git checkout dev
philmurp commented 2 years ago

Thanks, ok just tried it on the Jetson Nano.

I got errors in the install, then once done I ran the code above to check if service was running (after updating the bash location) and got the extra two errors 20220316_173513 20220316_191117 .

michaelhwn commented 2 years ago

Hi @philmurp, the errors in the last picture are due to an incomplete setup process. You will need to fix the errors that happened in the setup and make sure the setup can finish properly. From the setup errors, I think you can look into 2 things:

  1. NPM seems to be complaining about the platform being Linux-4.9.253-tegra, you should check if there are workarounds for NPM to accept this platform and continue with the package installation.
  2. pip3 is not found, you may need to manually install pip3 into the OS before running the setup script.
philmurp commented 2 years ago

Thanks I was able to install NPM and pip3; still getting the attached error. It seems like online maybe the pip3 still isnt updated enough?

Still looking for some answers but thought I would post in case you recognize solution: Capture

philmurp commented 2 years ago

Made some updates to pip3 and seems like that error is gone, I am currently processing the setup, one error so far as below.

From initial searches it looks like this is from pip setuptools being higher than 58, so trying to see if I can install setuptools to an older version. Do you think this is a showstopper that needs to be fixed?

Capture

michaelhwn commented 2 years ago

Hi @philmurp, I found this problem in stackoverflow, maybe you can try the solution in it.

philmurp commented 2 years ago

Thanks I was able to install at version 57.5.0; currently downloading.

Fingers crossed no errors yet, I will report back.

philmurp commented 2 years ago

So I was able to install with no errors; but when running the service, I still get below image. Capture

michaelhwn commented 2 years ago

Hi @philmurp, this indicates that the environment variable in this line is not being set correctly during the setup process. The setup process set this variable for the root user in this line. You may want to make sure that this variable is set properly in /root/.bashrc. If it is set, then you will need to make sure the CAIT_WEB_PATH variable is really pointing to the correct path (<root_of_cep>/src/cait/cortic_webapp/).

philmurp commented 2 years ago

Pic below: 1) Seems like this portion was added several times, should I make only one copy of each vairable (and one of the PYTHONPATHS is bigger than the others

2) should I remove /home/phil and just go straight to cep/src/cait/cortic_webapp/ because that is how I navigate from command line to get to this file

Capture

philmurp commented 2 years ago

I did those updates, same error. But when I navigate via command window I can find those files along the path specified.

Capture

michaelhwn commented 2 years ago

It seems you have run the setup script multiple times. I would suggest starting the setup from scratch on a newly flashed OS again in the following order:

  1. Flash a new OS installation.
  2. Apply all of the fixes/tweaks you have done before to make sure the setup script run properly.
  3. Clone the CEP project.
  4. Run the setup.

If you just want a quick try, then yes, you should just keep one copy of each variable. And you should keep /home/phil as this is the part of the full path to the <root_of_cep>.

philmurp commented 2 years ago

Still having same issue; could it be this "E:" that comes up; it isnt in red color so I usually glanced over it.

Since its not Raspberry Pi I wouldnt expect my Jetson would have those headers; if you think that might be an issue I can see what options there are to install those specific headers.

Capture

michaelhwn commented 2 years ago

The error is due to this line. On a Raspberry Pi OS, this is needed to make sure the ReSpeaker driver can be properly installed in a later stage. If you don't have the intention to use the speech-related features of CEP. you can comment out this line in the setup script and perform the setup again.

philmurp commented 2 years ago

Still getting the missing file error; but the path is correct in bash file. Looking online I saw some posts about how permissions on the file location might be causing an issue.

I am still trying to figure out exactly what to fix on my example; but thought I would share if you think this might be a good path to follow for potential fix.

https://stackoverflow.com/questions/70668977/uwsgi-failed-to-open-python-file-root-wsgi-py-django