donaldzou / WGDashboard

Simple dashboard for WireGuard VPN written in Python & Vue.js
https://donaldzou.github.io/WGDashboard-Documentation/
Apache License 2.0
1.65k stars 254 forks source link

Python Version does not get updated #422

Open Raukze opened 1 month ago

Raukze commented 1 month ago

Describe The Problem I tried to update wireguard's dashboard today (./wgd.sh update), but it fails because the installed Python version is too low. I would have expected the update script to also update my Python version if it is below the minimum required version.

Expected Error / Traceback

root@wireguard:/etc/wgdashboard/src# ./wgd.sh update
[WGDashboard] OS: debian
[WGDashboard] ✔ Python is installed
[WGDashboard] ✗ Could not find a compatible version of Python. Current Python is Python 3.9.2.
[WGDashboard] WGDashboard required Python 3.10, 3.11 or 3.12. Halting install now.
Terminated

To Reproduce LXC-Container in Proxmox created via https://tteck.github.io/Proxmox/#wireguard-lxc Running ./wgd.sh update

OS Information:

DaanSelen commented 1 month ago

Hello Raukze, I think updating Python itself is kind of a big ask if you just want to update your WGDashboard, because there are a lot of changes between Python versions. therefore it is really riskful to suddenly update the Python version.

But if you see this differently! Please tell me how we can improve this!

Raukze commented 1 month ago

The point I want to make is that ./wgd.sh installs Python if it is not already installed. Therefore, I would have expected it to also update the version of Python when I use the update command of ./wgd.sh. I mean, I also understand your point that it is risky, but in my case I have a dedicated LCX container in Proxmox running only wireguard and WGDashboard. Maybe an optional flag would be a way to let the user decide. What do you think?

Raukze commented 1 month ago

To add to that. I tried manually updating the Python version to 3.10.0 with the following commands from here

wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz && \
tar -xvf Python-3.10.0.tgz && \
cd Python-3.10.0 && \
sudo ./configure --enable-optimizations && \
sudo make && \
sudo make altinstall

I then added the symlink ln -s /usr/local/bin/python3.10 /usr/local/bin/python3

When running the ./wgd.sh update I get the following errors:

root@wireguard:/etc/wgdashboard/src# ./wgd.sh update
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.10/urllib/request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.10/urllib/request.py", line 519, in open
    response = self._open(req, data)
  File "/usr/local/lib/python3.10/urllib/request.py", line 541, in _open
    return self._call_chain(self.handle_open, 'unknown',
  File "/usr/local/lib/python3.10/urllib/request.py", line 496, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.10/urllib/request.py", line 1419, in unknown_open
    raise URLError('unknown url type: %s' % type)
urllib.error.URLError: <urlopen error unknown url type: https>
------------------------------------------------------------
| Are you sure you want to update to the ? (Y/N): Y
| Shutting down WGDashboard...                             |
| Downloading  from GitHub...                            |
| Upgrading pip                                            |
| Installing latest Python dependencies                    |
| Update Successfully!                                     |
------------------------------------------------------------

I then tried running ./wgd.sh start which also is no success:

root@wireguard:/etc/wgdashboard/src# ./wgd.sh start
[WGDashboard] WireGuard is already installed.
------------------------------------------------------------
[WGDashboard] Starting WGDashboard with Gunicorn in the background.
[WGDashboard] Creating Python Virtual Environment under ./venv
sudo: ./venv/bin/gunicorn: command not found

it seems to be stuck in the script after that output.

donaldzou commented 1 month ago

Hi, please try the step 1,2 and 3 on here "How to update?" and see if it works?

Raukze commented 1 month ago

Damn I just restored the backup. Will try the whole update progress later again. Thanks!

Raukze commented 1 month ago

Update is successful:

root@wireguard:/etc/wgdashboard/src# ./wgd.sh update
------------------------------------------------------------
| Are you sure you want to update to the v4.0.4? (Y/N): Y
| Shutting down WGDashboard...                             |
| Downloading v4.0.4 from GitHub...                            |
| Upgrading pip                                            |
| Installing latest Python dependencies                    |
| Update Successfully!                                     |
------------------------------------------------------------

But when trying to start:

root@wireguard:/etc/wgdashboard/src# ./wgd.sh start
------------------------------------------------------------
[WGDashboard] Starting WGDashboard with Gunicorn in the background.
[WGDashboard] Creating Python Virtual Environment under ./venv
sudo: ./venv/bin/gunicorn: command not found

and it stops there.

barryboom commented 1 month ago

reported a few weeks ago that the upgrade process does not work moving from v3 to v4 but as yet still no resoloution but some troubleshooting links it back to bcrypt

donaldzou commented 1 month ago

Hi @Raukze , you mind follow these steps instead of using ./wgd.sh update?

  1. Change your directory to wgdashboard

    cd wgdashboard/src
  2. Update the dashboard

    git pull https://github.com/donaldzou/WGDashboard.git --force
  3. Install

    sudo ./wgd.sh install
DaanSelen commented 1 month ago

@donaldzou the updating method is through GitHub correct?

donaldzou commented 3 weeks ago

@donaldzou the updating method is through GitHub correct?

Yes that's correct.

BigFidel commented 2 weeks ago

I am having this exact same issue. I am not engineer so I am unsure how to solve the issue. I first tried with ./wgd.sh update but that failed to work, and then I tried the git pull method. Neither way resolves my issues. I thought it looked like a simple fix but updating Python seems to be more than annoying.

`root@wireguard:/etc/wgdashboard/src# ./wgd.sh install

[WGDashboard] Starting to install WGDashboard [WGDashboard] OS: debian [WGDashboard] ✔ Python is installed [WGDashboard] ✗ Could not find a compatible version of Python. Current Python is Python 3.9.2. [WGDashboard] WGDashboard required Python 3.10, 3.11 or 3.12. Halting install now. Terminated root@wireguard:/etc/wgdashboard/src# ./wgd.sh start [WGDashboard] WireGuard is already installed.

[WGDashboard] Starting WGDashboard with Gunicorn in the background. ./wgd.sh: line 59: ./venv/bin/activate: No such file or directory sudo: ./venv/bin/gunicorn: command not found [WGDashboard] Checking if WGDashboard w/ Gunicorn started successfully [WGDashboard] WGDashboard w/ Gunicorn started successfully

root@wireguard:/etc/wgdashboard/src# ./wgd.sh stop

[WGDashboard] WGDashboard is not running.

root@wireguard:/etc/wgdashboard/src# ./wgd.sh debug

[WGDashboard] WireGuard is already installed. [WGDashboard] Starting WGDashboard in the foreground. Traceback (most recent call last): File "/etc/wgdashboard/src/dashboard.py", line 18, in import bcrypt ModuleNotFoundError: No module named 'bcrypt' ------------------------------------------------------------`

DaanSelen commented 2 weeks ago

I am having this exact same issue. I am not engineer so I am unsure how to solve the issue. I first tried with ./wgd.sh update but that failed to work, and then I tried the git pull method. Neither way resolves my issues. I thought it looked like a simple fix but updating Python seems to be more than annoying.

`root@wireguard:/etc/wgdashboard/src# ./wgd.sh install

[WGDashboard] Starting to install WGDashboard

[WGDashboard] OS: debian [WGDashboard] ✔ Python is installed [WGDashboard] ✗ Could not find a compatible version of Python. Current Python is Python 3.9.2. [WGDashboard] WGDashboard required Python 3.10, 3.11 or 3.12. Halting install now. Terminated root@wireguard:/etc/wgdashboard/src# ./wgd.sh start [WGDashboard] WireGuard is already installed.

[WGDashboard] Starting WGDashboard with Gunicorn in the background.

./wgd.sh: line 59: ./venv/bin/activate: No such file or directory sudo: ./venv/bin/gunicorn: command not found [WGDashboard] Checking if WGDashboard w/ Gunicorn started successfully [WGDashboard] WGDashboard w/ Gunicorn started successfully

root@wireguard:/etc/wgdashboard/src# ./wgd.sh stop

[WGDashboard] WGDashboard is not running.

root@wireguard:/etc/wgdashboard/src# ./wgd.sh debug

[WGDashboard] WireGuard is already installed. [WGDashboard] Starting WGDashboard in the foreground. Traceback (most recent call last): File "/etc/wgdashboard/src/dashboard.py", line 18, in import bcrypt ModuleNotFoundError: No module named 'bcrypt' ------------------------------------------------------------`

Do you for any reason NEED python3.9.2? Otherwise you can try to install python3

On apt systems

sudo apt install python3.11

and then try again! Let me know how that goes.

BigFidel commented 2 weeks ago

Trying on Proxmox in an LXC container but it only sees up to 3.92.

donaldzou commented 2 weeks ago

Trying on Proxmox in an LXC container but it only sees up to 3.92.

Hi @BigFidel , if you look over the documentation, when I tested on Debian 11 I had to manually build Python 3.10 from source, maybe that's case?

Installation

BigFidel commented 2 weeks ago

Thank you for your help! Unfortunately I can’t confirm because I took the easy route and created a new container with the latest code. All working now. Only questions I have are about the app you built.

Really enjoy your work, thank you!

donaldzou commented 2 weeks ago

That’s great!

Sure, do you mean the desktop app?


From: BigFidel @.> Sent: Saturday, November 9, 2024 11:36:58 AM To: donaldzou/WGDashboard @.> Cc: Donald Zou @.>; Mention @.> Subject: Re: [donaldzou/WGDashboard] Python Version does not get updated (Issue #422)

Thank you for your help! Unfortunately I can’t confirm because I took the easy route and created a new container with the latest code. All working now. Only questions I have are about the app you built.

Really enjoy your work, thank you!

— Reply to this email directly, view it on GitHubhttps://github.com/donaldzou/WGDashboard/issues/422#issuecomment-2466023009, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGARNUKVWYBXAY2HXQRJRKDZ7V7NVAVCNFSM6AAAAABPURM37WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINRWGAZDGMBQHE. You are receiving this because you were mentioned.Message ID: @.***>

BigFidel commented 2 weeks ago

Yeah honestly I don’t understand the UI! I’ll mess with it more (exhausted here) before bugging you more. I’ll probably play with it tomorrow and figure it out.

donaldzou commented 2 weeks ago

No problem! If you wish, you could join our discord server and we can chat from there:

https://discord.gg/MXDBpuRB

Get Outlook for iOShttps://aka.ms/o0ukef


From: BigFidel @.> Sent: Saturday, November 9, 2024 11:40:51 AM To: donaldzou/WGDashboard @.> Cc: Donald Zou @.>; Mention @.> Subject: Re: [donaldzou/WGDashboard] Python Version does not get updated (Issue #422)

Yeah honestly I don’t understand the UI! I’ll mess with it more (exhausted here) before bugging you more. I’ll probably play with it tomorrow and figure it out.

— Reply to this email directly, view it on GitHubhttps://github.com/donaldzou/WGDashboard/issues/422#issuecomment-2466026401, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGARNUJQ3OOYZQJE2H53PHLZ7V74HAVCNFSM6AAAAABPURM37WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINRWGAZDMNBQGE. You are receiving this because you were mentioned.Message ID: @.***>