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, one thing to check if it is a permission error is to first make sure the file is indeed in the correct position and the environment variable is properly set. You can check if the environment variable is set by running:

sudo su
echo $CAIT_WEB_PATH

This should show you a path where the system thinks the wsgi.py is located. Then please make sure the file is really there. If it is, then it could be the permission issue you found. We can continue from there. But if it isn't, then it is still a setup process issue.

philmurp commented 2 years ago

File is present at the path specified; and my permissioning looks fine.

I am stumped on this one, some users online said could be python isnt in the same directory; not sure how that works I didnt do anything unique when downloading. I also made chmod command on the wsgi.py just in case but no help there.

Capture

So when I navigate to this path; and run it manually I get permission denied error: Capture

Then with Sudo it runs but there is other error of TypeError Capture

michaelhwn commented 2 years ago

Hi @philmurp, the cait_webapp service uses root to run the webserver from the wsgi.py script, you would need to use sudo python3 wsgi.py to test if that is working.

philmurp commented 2 years ago

Not file found with that code: Capture

michaelhwn commented 2 years ago

Oh sorry @philmurp, I missed that you have used sudo in one of your screenshots. The error seems to be indicating that there are some API inconsistencies between the Python version in your system and the Python version CEP was written in. In Raspberry Pi OS (bullseye), the Python version is 3.9.2. While in your system, you are using Python 3.6. You may want to update the Python in your system to at least 3.9 and test again.

philmurp commented 2 years ago

I upgraded to 3.9.11. Also aliased both python and python3 = python3.9. Which worked based on picture below.

Same error: Capture ![Uploading Capture.PNG…]()

philmurp commented 2 years ago

New error when I navigate to the file and then run it: Capture

michaelhwn commented 2 years ago

Hi @philmurp, can you confirm if the python3 version in root is also upgraded to 3.9? You can check by running

sudo su
python3 --version

Regarding the new error, this is because the setup process was run with the previously installed Python 3.6 version, therefore, all of the necessary packages were installed for Python 3.6 only. You may need to do the setup 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. Upgrade Python version to 3.9.
  4. Clone the CEP project.
  5. Run the setup.
philmurp commented 2 years ago

Ah the sudo su, then python3 --version = 3.6.9.

Any idea how to fix that? I guess my alias in .bashrc isnt applied in root. Capture

michaelhwn commented 2 years ago

The quick way is to perform the alias operation you did before, but this time, do it under the root account:

sudo su
<perform python alias>
philmurp commented 2 years ago

Nice ok I got it to be 3.9.11 after I go to root. And now if I try to run wsgi.py manually, I get error no module names markupsafe.

So sounds like I need to perform a fresh re-install with python3.9 installed beforehand

michaelhwn commented 2 years ago

Yup, hope that solves your issues.

philmurp commented 2 years ago

So installed with no errors but same issue once I reboot: Capture

Does the beginning of the install indicate anything to you? This always comes up prior to installing everything: Capture

michaelhwn commented 2 years ago

Hi @philmurp, for the first screenshot, it seems the Python packages weren’t correctly installed for the Python 3.9 that you installed. For the second screenshot, you don’t need to run the setup using sudo. You can just run bash setup.sh.

philmurp commented 2 years ago

Not sure what went wrong with the Python3.9 install; I still dont know why it cant find the wsgi.py under normal conditions but then I can navigate there and run it.

Are you saying python3.9 didnt install correctly because once I get to wsgi.py it shows "flask" missing?

philmurp commented 2 years ago

Given there are so many dependencies I might need to fix, I found this online Armbian.

Seems like its Debian style OS that can be used on ARM boards like Jetson Nano. Any thoughts on if its worth a shot?

docs.armbian.com/User-Guide_Getting-Started/

michaelhwn commented 2 years ago

I would say if the latest Armbian operating system is based on the latest Debian (Bullseye), there should be less dependency issues. And since it is a system closer than the latest Raspberry Pi OS, it may worth a try.

philmurp commented 2 years ago

Any chance me installing in the "git checkout dev" branch is causing issues?

michaelhwn commented 2 years ago

The dev branch's setup script is the same as the main branch. Since the problem happens during the setup process, it is not likely that was caused by the dev branch.

philmurp commented 2 years ago

Yeah not sure where its going wrong; the initial problem of python3: cant open file 'wsgi.py' : [Errno 2] No such file or directory is confusing me because the path is correct and I can clearly get to it.

Feel like I am somehow in a different directory or something.

One thing in the below, it looks like my Python is in /usr/bin/python3 while my bash is in /bin/bash. Looking into if that means anything that the bash doesnt have /usr but Python does Capture

philmurp commented 2 years ago

Some more interesting findings: I see in root root looks like maybe it is python2.7 still.

Perhaps I have to run code "sudo su" before all my installs/tweaks to ensure at root python is installed? Capture

michaelhwn commented 2 years ago

I think for Linux, the root/default Python version is closely related to the operating system. So there is a chance that the operating system you are using needs an upgrade in order to use Python 3.9 as the root/default Python. Or you may even need to use other Linux distros that come with a newer Python version.

michaelhwn commented 2 years ago

The last screenshot you showed did suggest the root python3 still points to the 3.6 version though, which means the linking you did wasn't working for the root.

philmurp commented 2 years ago

But I am aliasing python3 -> python3.9; so it should be running python3.9 whenever called like that.

I think because my last screenshot I was opening the actual python3 folder so it shows python 3.6 but if the aliasing is working properly that version should never get used

michaelhwn commented 2 years ago

You can check which python3 is being used by running which python3 in both the user account and root account (after sudo su). This way you can confirm if the alias is working.

philmurp commented 2 years ago

I found this page: https://www.itsupportwale.com/blog/how-to-upgrade-to-python-3-9-0-on-ubuntu-18-04-lts/ with some steps after install to update alternatives, maybe that will be better than alias.

Capture

That at least changed the error, so maybe I will reinstall from scratch again: Capture

michaelhwn commented 2 years ago

Yes, it looks like the default python version is 3.9.11 now. If this method is used before the setup process, then all packages installed during the setup process should be done with Python 3.9 then.

philmurp commented 2 years ago

Good news the install for sure used Pyhton3.9 because a lot more modules were being downloaded.

Bad news, some more errors. I am looking through fixing them:

/usr/bin/aarch64-linux-gnu-gcc error: No Python.h file or directory came up about 4 times: Online I see I should download the dev version of Python: sudo apt install libpython3.9-dev, so I will try this. Capture

Not sure about this error; when building wheel for opencv-contrib-python: Maybe this is Ninja related like the below? Capture

OpenCV install error: Cant find Ninja: Going to try and download the Ninja tool Capture

Could not find python2, seems online I can ignore this warning. Capture

philmurp commented 2 years ago

Fixed above, re-ran setup but still back to same error of cant find wsgi,py and when I manually navigate flask is missing.

Going to start from scratch again with the new python3.9-dev install before initial setup run to test again.

michaelhwn commented 2 years ago

Python2 should be installed already within the operating system you are using, so that's a weird error. But you are right to install the python3.9-dev package for the missing Python.h error. And the fact that there is only the Python error during the OpenCV installation/compilation process is a good sign, meaning all of the other OpenCV dependencies were installed.

philmurp commented 2 years ago

Still same cant direct to file error. I think it must be something due to my $PATH vs SUDO environment or something. Just cant figure this out

michaelhwn commented 2 years ago

Hi @philmurp, in the setup script, starting at this line, it adds the corresponding paths to the environmental variables to the root environment. The only reason I can think of for your issue is that these lines were being executed, or they were not suitable for your operating system. You can investigate a bit into this to make sure the path was added correctly during the setup process by these lines.

philmurp commented 2 years ago

Hello, I tried installing with Armbian image on the Jetson Nano; same error as before:

Note: I installed as root first since that was default, then once it reset it brought me to my user profile so after checking it didnt work I installed again not in root. That is second picture.

After installing only in root: wsgi issue

After installing in user profile: wsgi issue2

Trying to run WSGI manually: wsgi3

wsgi4

philmurp commented 2 years ago

Hello, any alternative to Raspberry Pi 4? Still cant find any in stock.