AdaptiveScale / lxdui

LXDUI is a web UI for the native Linux container technology LXD/LXC
Apache License 2.0
715 stars 154 forks source link

Dependency error on Ubuntu22/python3.10 #372

Open abhipil opened 1 year ago

abhipil commented 1 year ago

Steps to reproduce:

$ git clone https://github.com/AdaptiveScale/lxdui.git
$ cd lxdui
$ python3 -m venv .env
$ source .env/bin/activate
$ python3 setup.py install
$ python3 run.py start
Traceback (most recent call last):
  File "/home/user/lxdui/run.py", line 1, in <module>
    from app.cli.cli import lxdui
  File "/home/user/lxdui/app/cli/cli.py", line 6, in <module>
    from app.api import core
  File "/home/user/lxdui/app/api/core.py", line 3, in <module>
    from flask import Flask, redirect
  File "/home/user/lxdui/.env/lib/python3.10/site-packages/Flask-1.0-py3.10.egg/flask/__init__.py", line 19, in <module>
    from jinja2 import Markup, escape
ImportError: cannot import name 'Markup' from 'jinja2' (/home/user/lxdui/.env/lib/python3.10/site-packages/Jinja2-3.1.2-py3.10.egg/jinja2/__init__.py)

Here's pip freeze -

$ python3 -m pip freeze
certifi==2022.6.15
cffi==1.15.1
chardet==3.0.4
click==6.7
cryptography==37.0.4
Flask==1.0
Flask-JWT==0.3.2
Flask-Login==0.4.1
idna==2.7
itsdangerous==2.1.2
Jinja2==3.1.2
jsonschema==2.6.0
LXDUI==2.1.2
MarkupSafe==2.1.1
netaddr==0.7.19
pbr==5.10.0
psutil==5.6.6
ptyprocess==0.7.0
pycparser==2.21
PyJWT==1.4.2
pylxd==2.2.7
pyOpenSSL==17.5.0
python-dateutil==2.8.2
requests==2.20.0
requests-toolbelt==0.9.1
requests-unixsocket==0.3.0
six==1.16.0
terminado==0.8.1
tornado==5.0.2
tornado_xstatic==0.3
urllib3==1.24.3
Werkzeug==2.2.2
ws4py==0.5.1
XStatic==1.0.1
XStatic-term.js==0.0.7.0
PeerCohere commented 1 year ago

Same issue Ubuntu 22.04 server and skipped 3. [Optional] Create a virtual environment for testing. Skip this step if you want to install it globaly on your system.

Completely fresh install of ubuntu and LXD, specifically for testing LXD dashboards

maarten256 commented 1 year ago

Affects me too, on Ubuntu 22.04.

PeerCohere commented 1 year ago

Don't use this in a production enviroment. The owner should mark this as a dead project if they don't want to support it for free. No shame in that, but make it clear whats to be expected.

timonych commented 1 year ago

Hi Everyone!

I have made requirements.txt with correct dependencies for python 3.10 Have checked on OpenSUSE 15.4 and Alpine Linux 3.17 with Python 3.10 and there is no critical error.

attr==0.3.2
attrs==22.2.0
bcrypt==4.0.1
certifi==2022.12.7
cffi==1.15.1
chardet==3.0.4
charset-normalizer==3.0.1
click==8.1.3
cryptography==36.0.2
Flask==2.1.3
Flask-JWT-Extended==3.18.0
Flask-Login==0.4.1
idna==2.7
itsdangerous==2.0.1
Jinja2==3.1.2
jsonschema==2.6.0
LXDUI==2.2
MarkupSafe==2.1.2
netaddr==0.8.0
pbr==5.11.1
psutil==5.9.4
ptyprocess==0.7.0
pycparser==2.21
PyJWT==1.7.1
pylxd==2.3.1
pyOpenSSL==17.5.0
pyrsistent==0.19.3
python-dateutil==2.8.2
PyYAML==3.11
requests==2.20.0
requests-toolbelt==0.10.1
requests-unixsocket==0.3.0
six==1.16.0
terminado==0.17.1
tornado==6.2
tornado_xstatic==0.3
urllib3==1.24.3
Werkzeug==2.0.3
ws4py==0.5.1
XStatic==1.0.1
XStatic-term.js==0.0.7.0
maarten256 commented 1 year ago

I found I could not get it to work with the requirements.txt suggested by timonych. That's more an indication of my failure to understand how this is supposed to work than anything else.

Just in case anybody stumbles across this conversation, I did finally find a way to get lxdui to work. As was mentioned by PeerCohere above, the "AdaptiveScale" version (this repo) is not maintained. However, https://github.com/gr8linux/lxdui/tree/master is (at least as recently as Jan 2023).

So I threw away my checkout of lxdui (just to make sure I started "clean") and checked out that version instead.

Suffice to say that didn't work (to my frustration); which wasn't an issue with gr8linux' version, but rather my messed-up python environment. After some digging, I found that uninstalling all packages I'd previously installed in my attempts to get lxdui to work (from various repos as well as my own stumbling around) was the way to go; that way I was able to install lxdui (from the gr8linux repo) with all the correct dependencies and it works.

I took the requirements.txt from gr8linux and created a file (pkg.txt) with just the package names, and used "pip3 uninstall" to get rid of all those:

for pkg in $(cat pkg.txt); do
echo $pkg
sudo pip3 uninstall -y $pkg
done

Then, for good measure I did the same with the packages that timonych had suggested. Then I ran sudo python3 setup.py install, followed by sudo lxdui start, and to my amazement it actually ran, without failing on something or other.

I have to say I did try the virtualenv first (which worked, and led me to believe I could also make this work outside of the venv). Now that I have it installed with sudo, I can actually install lxdui.service and have this run normally with my systems.

YMMV; this worked for me but may not for others. I did spend a few hours beating my head against the wall trying to get this sorted to my liking. Python 3.10.6 on Ubuntu 22.04.2.

jetroni commented 2 months ago

Tagging #379 as it is the same issue.