Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing on Ubuntu 24.04 ?? #59

Open
sharpie78 opened this issue Aug 24, 2024 · 12 comments
Open

Installing on Ubuntu 24.04 ?? #59

sharpie78 opened this issue Aug 24, 2024 · 12 comments

Comments

@sharpie78
Copy link

Hello

Wondering if you can help me get this installed on Ubuntu 24.04 please ?
I'm basically an end user of Linux and can't figure this out. It's probably really easy for those who understand the inner workings of Linux but I'm struggling....
Following the instructions for installation worked fine on 22.04 but i believe there's been a change with pip since version 23.04 that means they no longer work. see below...

~$ sudo pip install indiweb
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

I'm not sure how to proceed here as I know nothing about virtual environments or python in general. Any help to get indiweb installed greatly appreciated.
:-)

@bluthen
Copy link

bluthen commented Sep 3, 2024

Can do what it says:

Option 1) add "--break-system-packages"

Options 2) Use a virtual environment.

I like pipenv for virtual environments:

sudo apt-get install pipenv
cd
mkdir indiweb
cd indiweb
pipenv --python=`which python3`
pipenv install indiweb
pipenv run indi-web -v

If you want to make it autostart on boot with systemd you can follow the instructions in the README but you this for indiwebmanager.service instead:

Make sure to switch out {user} for your username in the two places it is below.

[Unit]
Description=INDI Web Manager
After=multi-user.target

[Service]
Type=idle
# MUST SET YOUR USERNAME HERE.
User={user}
WorkingDirectory=/home/{user}/indiweb
ExecStart=/usr/bin/pipenv run indi-web -v
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

@sharpie78
Copy link
Author

@bluthen - Excellent. Thank-you for that.

I was dubious as to whether I should just "break-system-packages" or not so I held off on that. It sounds ominous to an end user with limited experience.

I followed the instructions using pipenv and it works perfectly. Thank-you very much. My SQM is now available and connects.

Thanks again :-)

@gehelem
Copy link

gehelem commented Sep 7, 2024

Hi,
same problem here
Solution provided by @bluthen gives this


`Creating a virtualenv for this project...
Pipfile: /home/gilles/indiweb/Pipfile
Using /usr/bin/python3 (3.12.3) to create virtualenv...
⠹ Creating virtual environment...created virtual environment CPython3.12.3.final.0-64 in 173ms
creator CPython3Posix(dest=/home/gilles/.local/share/virtualenvs/indiweb-aZpCWuia, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, via=copy, app_data_dir=/home/gilles/.local/share/virtualenv)
added seed packages: pip==24.0
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

✔ Successfully created virtual environment!
Virtualenv location: /home/gilles/.local/share/virtualenvs/indiweb-aZpCWuia
Creating a Pipfile for this project...
Installing indiweb...
Resolving indiweb...
Added indiweb to Pipfile's [packages] ...
✔ Installation Succeeded
Pipfile.lock not found, creating...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success!
Locking [dev-packages] dependencies...
Updated Pipfile.lock (508e8111a29250031b8a7a08341b72f5229355ad471f9d0a051db6225adfaf3b)!
Installing dependencies from Pipfile.lock (dfaf3b)...
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
Traceback (most recent call last):
File "/home/gilles/.local/share/virtualenvs/indiweb-aZpCWuia/bin/indi-web", line 5, in
from indiweb.main import main
File "/home/gilles/.local/share/virtualenvs/indiweb-aZpCWuia/lib/python3.12/site-packages/indiweb/main.py", line 11, in
from importlib_metadata import version
ModuleNotFoundError: No module named 'importlib_metadata'`


So i tried to add importlib_metadata

gilles@ubn2404:~/indiweb$ pipenv install importlib_metadata Installing importlib_metadata... Resolving importlib_metadata... Added importlib-metadata to Pipfile's [packages] ... ✔ Installation Succeeded Pipfile.lock (dfaf3b) out of date, updating to (6ef1a5)... Locking [packages] dependencies... Building requirements... Resolving dependencies... ✔ Success! Locking [dev-packages] dependencies... Updated Pipfile.lock (732f03a4aa9d5a446fabfb3b1df65e53d5353e19694b151fb5fe8078216ef1a5)! Installing dependencies from Pipfile.lock (6ef1a5)... To activate this project's virtualenv, run pipenv shell. Alternatively, run a command inside the virtualenv with pipenv run. gilles@ubn2404:~/indiweb$


indiwebmanager seems alive, but when i open my browser


image

gilles@ubn2404:~/indiweb$ pipenv run indi-web -v
2024-09-06 11:00:13,190 - DEBUG: command line arguments: {'indi_port': 7624, 'port': 8624, 'host': '0.0.0.0', 'fifo': '/tmp/indiFIFO', 'conf': '/home/gilles/.indi', 'xmldir': '/usr/share/indi/', 'verbose': True, 'logfile': None, 'server': 'standalone'}
2024-09-06 11:00:13,192 - INFO: using Bottle as standalone server
Traceback (most recent call last):
File "/home/gilles/.local/share/virtualenvs/indiweb-aZpCWuia/bin/bottle.py", line 993, in _handle
out = route.call(**args)
^^^^^^^^^^^^^^^^^^
File "/home/gilles/.local/share/virtualenvs/indiweb-aZpCWuia/bin/bottle.py", line 2024, in wrapper
rv = callback(*a, **ka)
^^^^^^^^^^^^^^^^^^
File "/home/gilles/.local/share/virtualenvs/indiweb-aZpCWuia/lib/python3.12/site-packages/indiweb/main.py", line 140, in main_form
return template(os.path.join(views_path, 'form.tpl'), profiles=profiles,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gilles/.local/share/virtualenvs/indiweb-aZpCWuia/bin/bottle.py", line 4492, in template
TEMPLATES[tplid] = adapter(name=tpl, lookup=lookup, **settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gilles/.local/share/virtualenvs/indiweb-aZpCWuia/bin/bottle.py", line 4075, in init
self.filename = self.search(self.name, self.lookup)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gilles/.local/share/virtualenvs/indiweb-aZpCWuia/bin/bottle.py", line 4090, in search
raise depr(0, 12, "Use of absolute path for template name.",
TypeError: exceptions must derive from BaseException


Any ideas ?

@bluthen
Copy link

bluthen commented Sep 7, 2024

It looks like indi-web doesn't pin it dependency versions. And a new version of bottle (0.13.x) came out recently(days ago) that triggered this issue.

For a quick workaround from where you left off:

cd
cd indiweb
pipenv install bottle==0.12.25
pipenv run indi-web -v

@guilleortas
Copy link

that's exactly the issue I was having, thank you for the tip about the version of bottle

@guilleortas
Copy link

guilleortas commented Sep 14, 2024

I'm afraid this still doesn't fix the incompatibility issues. May I open a new issue with this?

This is what I get when starting indi-web:

Bottle v0.12.25 server starting up (using WSGIRefServer())...
Listening on http://0.0.0.0:8624/
Hit Ctrl-C to quit.

192.168.1.105 - - [14/Sep/2024 16:09:35] "GET / HTTP/1.1" 200 39295
192.168.1.105 - - [14/Sep/2024 16:09:35] "GET /api/profiles/Simulators/labels HTTP/1.1" 200 62
192.168.1.105 - - [14/Sep/2024 16:09:35] "GET /api/profiles/Simulators/remote HTTP/1.1" 200 2
192.168.1.105 - - [14/Sep/2024 16:09:35] "GET /api/profiles/Simulators HTTP/1.1" 200 79
192.168.1.105 - - [14/Sep/2024 16:09:35] "GET /api/server/status HTTP/1.1" 200 43
Traceback (most recent call last):
File "/home/astromaker/.local/lib/python3.11/site-packages/bottle.py", line 876, in _handle
return route.call(**args)
^^^^^^^^^^^^^^^^^^
File "/home/astromaker/.local/lib/python3.11/site-packages/bottle.py", line 1759, in wrapper
rv = callback(*a, **ka)
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/indiweb/main.py", line 395, in get_indihub_status
is_running = indihub_agent.is_running()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/indiweb/indihub_agent.py", line 57, in is_running
if self.__async_cmd:
^^^^^^^^^^^^^^^^
AttributeError: 'IndiHubAgent' object has no attribute '_IndiHubAgent__async_cmd'
192.168.1.105 - - [14/Sep/2024 16:09:35] "GET /api/indihub/status HTTP/1.1" 500 766

@bluthen
Copy link

bluthen commented Sep 14, 2024

@guilleortas
I think you can make whatever issue you want. This isn't my project, I was just trying to help.

It isn't still usuable even with that error? Or are you specifically trying to use IndiHub?

@gehelem
Copy link

gehelem commented Sep 19, 2024

@bluthen your previous tip solved the problem for me.
thank you !

@guilleortas
Copy link

@guilleortas I think you can make whatever issue you want. This isn't my project, I was just trying to help.

It isn't still usuable even with that error? Or are you specifically trying to use IndiHub?

It seems to still be useable, so I'm calling it good enough

@lschopitea
Copy link

For this environment:
(venv) lsc@maksutov:~/indiwebmanager$ pip freeze
bottle==0.13.1
certifi==2024.8.30
charset-normalizer==3.4.0
idna==3.10
importlib_metadata==8.5.0
indiweb==0.1.8
psutil==6.0.0
requests==2.32.3
urllib3==2.2.3
zipp==3.20.2

This patch fixes that issue:
diff --git a/indiweb/main.py b/indiweb/main.py
index 871f71b..71cc135 100644
--- a/indiweb/main.py
+++ b/indiweb/main.py
@@ -139,7 +139,7 @@ def main_form():
saved_profile = request.get_cookie('indiserver_profile') or 'Simulators'

 profiles = db.get_profiles()
  • return template(os.path.join(views_path, 'form.tpl'), profiles=profiles,
  • return template('form.tpl', template_lookup=[views_path], profiles=profiles,
    drivers=drivers, saved_profile=saved_profile,
    hostname=hostname)

Bottle does not like absolute paths any more.

Sorry, I have not ever submitted a PR to github. Thought this was safer.

@lschopitea
Copy link

Sorry, let's try:

diff --git a/indiweb/main.py b/indiweb/main.py
index 871f71b..71cc135 100644
--- a/indiweb/main.py
+++ b/indiweb/main.py
@@ -139,7 +139,7 @@ def main_form():
         saved_profile = request.get_cookie('indiserver_profile') or 'Simulators'
 
     profiles = db.get_profiles()
-    return template(os.path.join(views_path, 'form.tpl'), profiles=profiles,
+    return template('form.tpl', template_lookup=[views_path], profiles=profiles,
                     drivers=drivers, saved_profile=saved_profile,
                     hostname=hostname)
 

@jfwells
Copy link

jfwells commented Nov 18, 2024

Sorry, let's try:

diff --git a/indiweb/main.py b/indiweb/main.py
index 871f71b..71cc135 100644
--- a/indiweb/main.py
+++ b/indiweb/main.py
@@ -139,7 +139,7 @@ def main_form():
         saved_profile = request.get_cookie('indiserver_profile') or 'Simulators'
 
     profiles = db.get_profiles()
-    return template(os.path.join(views_path, 'form.tpl'), profiles=profiles,
+    return template('form.tpl', template_lookup=[views_path], profiles=profiles,
                     drivers=drivers, saved_profile=saved_profile,
                     hostname=hostname)
 

This fix worked for me with indi webmanager on Raspberry Pi Bookworm with latest Bottle. Thank you!

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

No branches or pull requests

7 participants
@bluthen @guilleortas @jfwells @gehelem @lschopitea @sharpie78 and others