anselal / antminer-monitor

Cryptocurrency ASIC mining hardware monitor using a simple web interface
GNU General Public License v3.0
228 stars 145 forks source link

Update Flask or requirements.txt #194

Open Garuda2703 opened 2 years ago

Garuda2703 commented 2 years ago

Hi so i recently just found this project and wanted to install it, but when i try to make the database it gives me this error Traceback (most recent call last): File "manage.py", line 1, in <module> from flask.cli import FlaskGroup File "/usr/local/lib/python3.8/dist-packages/flask/__init__.py", line 19, in <module> from jinja2 import Markup, escape ImportError: cannot import name 'Markup' from 'jinja2' (/usr/local/lib/python3.8/dist-packages/jinja2/__init__.py) do anyone know how to fix this?, thanks!

anselal commented 2 years ago

Hi there, thnx for using AntminerMonitor. Did you install all the requirements from requirements.txt? As I can see you ain't using a virtual environment.

Garuda2703 commented 2 years ago

Yes i already install all the required packages from requirements.txt, and yes im not using a virtual environment

anselal commented 2 years ago

I think the issue is due the Jinja2 version. The latest version is 3.x but Flask 1.x needs Jinja2 2.x. This said, please uninstall Jinja2 v3 and install a previous version like this

pip install jinja2==2.11.3

Garuda2703 commented 2 years ago

Okay, imma try that

Garuda2703 commented 2 years ago

Ok so after trying that suggestion, im now getting this error root@T4:~/antminer-monitor# pip3 install jinja2==2.11.3 Requirement already satisfied: jinja2==2.11.3 in /usr/local/lib/python3.8/dist-packages (2.11.3) Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python3.8/dist-packages (from jinja2==2.11.3) (2.1.1) root@T4:~/antminer-monitor# python3 manage.py create-db Traceback (most recent call last): File "manage.py", line 3, in <module> from flask.cli import FlaskGroup File "/usr/local/lib/python3.8/dist-packages/flask/__init__.py", line 14, in <module> from jinja2 import escape File "/usr/local/lib/python3.8/dist-packages/jinja2/__init__.py", line 12, in <module> from .environment import Environment File "/usr/local/lib/python3.8/dist-packages/jinja2/environment.py", line 25, in <module> from .defaults import BLOCK_END_STRING File "/usr/local/lib/python3.8/dist-packages/jinja2/defaults.py", line 3, in <module> from .filters import FILTERS as DEFAULT_FILTERS # noqa: F401 File "/usr/local/lib/python3.8/dist-packages/jinja2/filters.py", line 13, in <module> from markupsafe import soft_unicode ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/usr/local/lib/python3.8/dist-packages/markupsafe/__init__.py)

anselal commented 2 years ago

According to https://github.com/pallets/markupsafe/issues/284 you have to do python -m pip install markupsafe==2.0.1

Garuda2703 commented 2 years ago

After doing that now im getting this error, Traceback (most recent call last): File "manage.py", line 3, in <module> from flask.cli import FlaskGroup File "/usr/local/lib/python3.8/dist-packages/flask/__init__.py", line 19, in <module> from . import json File "/usr/local/lib/python3.8/dist-packages/flask/json/__init__.py", line 15, in <module> from itsdangerous import json as _json ImportError: cannot import name 'json' from 'itsdangerous' (/usr/local/lib/python3.8/dist-packages/itsdangerous/__init__.py)

anselal commented 2 years ago

All those are not errors caused by the app itself but are dependency errors. I need to update the app or the requirements.txt

Garuda2703 commented 2 years ago

hmm, okay so for now what do i need to do?

anselal commented 2 years ago

You can search online for the error. Just search for the import error at the end. No need to search for the whole output. Or wait for an update

Garuda2703 commented 2 years ago

okay, gotcha

Garuda2703 commented 2 years ago

and now it seems to works, thanks!

Garuda2703 commented 2 years ago

oh and also when i try to use the "miner discovery" feature it didnt seems to work

anselal commented 2 years ago

There is a discovery in the app

Garuda2703 commented 2 years ago

when trying to use the miner discovery it just loading loading and after it finishes theres nothing happening

Garuda2703 commented 2 years ago

it just print this error image

smwbev commented 1 year ago

@anselal Hello

c:\monitor>python manage.py create-db Traceback (most recent call last): File "c:\monitor\manage.py", line 5, in <module> from antminermonitor.app import create_app File "c:\monitor\antminermonitor\app.py", line 3, in <module> from antminermonitor.blueprints.asicminer import antminer, antminer_json File "c:\monitor\antminermonitor\blueprints\asicminer\__init__.py", line 1, in <module> from antminermonitor.blueprints.asicminer.views.antminer import antminer File "c:\monitor\antminermonitor\blueprints\asicminer\views\antminer.py", line 13, in <module> from antminermonitor.blueprints.asicminer.models import Miner File "c:\monitor\antminermonitor\blueprints\asicminer\models\__init__.py", line 1, in <module> from .miner import Miner File "c:\monitor\antminermonitor\blueprints\asicminer\models\miner.py", line 2, in <module> from antminermonitor.database import Base File "c:\monitor\antminermonitor\database.py", line 7, in <module> engine = create_engine(SQLALCHEMY_DATABASE_URI, convert_unicode=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<string>", line 2, in create_engine File "C:\Users\owl_dv\AppData\Local\Programs\Python\Python311\Lib\site-packages\sqlalchemy\util\deprecations.py", line 277, in warned return fn(*args, **kwargs) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^ File "C:\Users\owl_dv\AppData\Local\Programs\Python\Python311\Lib\site-packages\sqlalchemy\engine\create.py", line 693, in create_engine raise TypeError( TypeError: Invalid argument(s) 'convert_unicode' sent to create_engine(), using configuration SQLiteDialect_pysqlite/QueuePool/Engine. Please check that the keyword arguments are appropriate for this combination of components.

anselal commented 1 year ago

Did this happen on a new installation without adding any miners ?

smwbev commented 1 year ago

It’s new, clean installation on windows 10 (on parallels) Earlier I tried it in macos, but it didn't work either (

anselal commented 1 year ago

It’s new, clean installation on windows 10 (on parallels) Earlier I tried it in macos, but it didn't work either (

Thanks for the feedback. I will look into it

smwbev commented 1 year ago

Thanks for the feedback. I will look into it I will now record a video of a clean installation in windows 11

anselal commented 1 year ago

this new requirements file should do the work. Just run pip install -r newrequirements.txt and the app should be up and running

newrequirements.txt

anselal commented 1 year ago

it just print this error image

Are your miners supported by the software ? Can I ask which models are in your subnet ?

smwbev commented 1 year ago

this new requirements file should do the work. Just run pip install -r newrequirements.txt and the app should be up and running

newrequirements.txt

1. Clean w11 2. install python-3.11.2-amd64 (https://www.python.org/ftp/python/3.11.2/python-3.11.2-amd64.exe) 3. Clone master repo 4. python -m pip install -r newrequirements.txt

DEPRECATION: infinity is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559

DEPRECATION: validators is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559 Running setup.py install for validators ... done

5. python manage.py create-db

Traceback (most recent call last): File "C:\monitor\manage.py", line 5, in from antminermonitor.app import create_app File "C:\monitor\antminermonitor\app.py", line 3, in from antminermonitor.blueprints.asicminer import antminer, antminer_json File "C:\monitor\antminermonitor\blueprints\asicminer__init.py", line 1, in from antminermonitor.blueprints.asicminer.views.antminer import antminer File "C:\monitor\antminermonitor\blueprints\asicminer\views\antminer.py", line 13, in from antminermonitor.blueprints.asicminer.models import Miner File "C:\monitor\antminermonitor\blueprints\asicminer\models\init__.py", line 1, in from .miner import Miner File "C:\monitor\antminermonitor\blueprints\asicminer\models\miner.py", line 2, in from antminermonitor.database import Base File "C:\monitor\antminermonitor\database.py", line 7, in engine = create_engine(SQLALCHEMY_DATABASE_URI, convert_unicode=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 2, in create_engine File "C:\Users\owl_dv\AppData\Local\Programs\Python\Python311\Lib\site-packages\sqlalchemy\util\deprecations.py", line 277, in warned return fn(*args, **kwargs) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^ File "C:\Users\owl_dv\AppData\Local\Programs\Python\Python311\Lib\site-packages\sqlalchemy\engine\create.py", line 693, in create_engine raise TypeError( TypeError: Invalid argument(s) 'convert_unicode' sent to create_engine(), using configuration SQLiteDialect_pysqlite/QueuePool/Engine. Please check that the keyword arguments are appropriate for this combination of components.


PS C:\monitor> python -m pip install -r newrequirements.txt Collecting alembic==1.9.3 Downloading alembic-1.9.3-py3-none-any.whl (210 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 210.6/210.6 kB 13.4 MB/s eta 0:00:00 Collecting click==8.1.3 Downloading click-8.1.3-py3-none-any.whl (96 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 96.6/96.6 kB 5.4 MB/s eta 0:00:00 Collecting decorator==5.1.1 Downloading decorator-5.1.1-py3-none-any.whl (9.1 kB) Collecting dnspython==2.3.0 Downloading dnspython-2.3.0-py3-none-any.whl (283 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 283.7/283.7 kB 17.1 MB/s eta 0:00:00 Collecting email-validator==1.3.1 Downloading email_validator-1.3.1-py2.py3-none-any.whl (22 kB) Collecting Flask==2.2.2 Downloading Flask-2.2.2-py3-none-any.whl (101 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 101.5/101.5 kB ? eta 0:00:00 Collecting Flask-Login==0.6.2 Downloading Flask_Login-0.6.2-py3-none-any.whl (17 kB) Collecting Flask-Migrate==4.0.4 Downloading Flask_Migrate-4.0.4-py3-none-any.whl (20 kB) Collecting Flask-SQLAlchemy==3.0.3 Downloading Flask_SQLAlchemy-3.0.3-py3-none-any.whl (24 kB) Collecting Flask-WTF==1.1.1 Downloading Flask_WTF-1.1.1-py3-none-any.whl (12 kB) Collecting greenlet==2.0.2 Downloading greenlet-2.0.2-cp311-cp311-win_amd64.whl (192 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 192.5/192.5 kB 12.1 MB/s eta 0:00:00 Collecting gunicorn==20.1.0 Downloading gunicorn-20.1.0-py3-none-any.whl (79 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 79.5/79.5 kB 4.6 MB/s eta 0:00:00 Collecting idna==3.4 Downloading idna-3.4-py3-none-any.whl (61 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.5/61.5 kB 3.2 MB/s eta 0:00:00 Collecting importlib-metadata==6.0.0 Downloading importlib_metadata-6.0.0-py3-none-any.whl (21 kB) Collecting importlib-resources==5.10.2 Downloading importlib_resources-5.10.2-py3-none-any.whl (34 kB) Collecting infinity==1.5 Downloading infinity-1.5.tar.gz (5.4 kB) Preparing metadata (setup.py) ... done Collecting intervals==0.9.2 Downloading intervals-0.9.2-py3-none-any.whl (8.5 kB) Collecting isort==5.12.0 Downloading isort-5.12.0-py3-none-any.whl (91 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 91.2/91.2 kB 5.1 MB/s eta 0:00:00 Collecting itsdangerous==2.1.2 Downloading itsdangerous-2.1.2-py3-none-any.whl (15 kB) Collecting Jinja2==3.1.2 Downloading Jinja2-3.1.2-py3-none-any.whl (133 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.1/133.1 kB 7.7 MB/s eta 0:00:00 Collecting Mako==1.2.4 Downloading Mako-1.2.4-py3-none-any.whl (78 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.7/78.7 kB 4.6 MB/s eta 0:00:00 Collecting MarkupSafe==2.1.2 Downloading MarkupSafe-2.1.2-cp311-cp311-win_amd64.whl (16 kB) Collecting python-dotenv==0.21.1 Downloading python_dotenv-0.21.1-py3-none-any.whl (19 kB) Collecting six==1.16.0 Downloading six-1.16.0-py2.py3-none-any.whl (11 kB) Collecting SQLAlchemy==2.0.3 Downloading SQLAlchemy-2.0.3-cp311-cp311-win_amd64.whl (1.9 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.9/1.9 MB 13.8 MB/s eta 0:00:00 Collecting typing-extensions==4.4.0 Downloading typing_extensions-4.4.0-py3-none-any.whl (26 kB) Collecting validators==0.20.0 Downloading validators-0.20.0.tar.gz (30 kB) Preparing metadata (setup.py) ... done Collecting Werkzeug==2.2.2 Downloading Werkzeug-2.2.2-py3-none-any.whl (232 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 232.7/232.7 kB 14.8 MB/s eta 0:00:00 Collecting WTForms==3.0.1 Downloading WTForms-3.0.1-py3-none-any.whl (136 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 136.5/136.5 kB 7.9 MB/s eta 0:00:00 Collecting WTForms-Components==0.10.5 Downloading WTForms_Components-0.10.5-py2.py3-none-any.whl (15 kB) Collecting yapf==0.32.0 Downloading yapf-0.32.0-py2.py3-none-any.whl (190 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 190.2/190.2 kB ? eta 0:00:00 Collecting zipp==3.13.0 Downloading zipp-3.13.0-py3-none-any.whl (6.7 kB) Collecting colorama Downloading colorama-0.4.6-py2.py3-none-any.whl (25 kB) Requirement already satisfied: setuptools>=3.0 in c:\users\owl_dv\appdata\local\programs\python\python311\lib\site-packages (from gunicorn==20.1.0->-r newrequirements.txt (line 12)) (65.5.0) Installing collected packages: yapf, infinity, zipp, typing-extensions, six, python-dotenv, MarkupSafe, itsdangerous, isort, intervals, importlib-resources, idna, gunicorn, greenlet, dnspython, decorator, colorama, WTForms, Werkzeug, validators, SQLAlchemy, Mako, Jinja2, importlib-metadata, email-validator, click, WTForms-Components, Flask, alembic, Flask-WTF, Flask-SQLAlchemy, Flask-Login, Flask-Migrate DEPRECATION: infinity is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559 Running setup.py install for infinity ... done DEPRECATION: validators is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559 Running setup.py install for validators ... done Successfully installed Flask-2.2.2 Flask-Login-0.6.2 Flask-Migrate-4.0.4 Flask-SQLAlchemy-3.0.3 Flask-WTF-1.1.1 Jinja2-3.1.2 Mako-1.2.4 MarkupSafe-2.1.2 SQLAlchemy-2.0.3 WTForms-3.0.1 WTForms-Components-0.10.5 Werkzeug-2.2.2 alembic-1.9.3 click-8.1.3 colorama-0.4.6 decorator-5.1.1 dnspython-2.3.0 email-validator-1.3.1 greenlet-2.0.2 gunicorn-20.1.0 idna-3.4 importlib-metadata-6.0.0 importlib-resources-5.10.2 infinity-1.5 intervals-0.9.2 isort-5.12.0 itsdangerous-2.1.2 python-dotenv-0.21.1 six-1.16.0 typing-extensions-4.4.0 validators-0.20.0 yapf-0.32.0 zipp-3.13.0

[notice] A new release of pip available: 22.3.1 -> 23.0 [notice] To update, run: python.exe -m pip install --upgrade pip PS C:\monitor> python manage.py create-db Traceback (most recent call last): File "C:\monitor\manage.py", line 5, in from antminermonitor.app import create_app File "C:\monitor\antminermonitor\app.py", line 3, in from antminermonitor.blueprints.asicminer import antminer, antminer_json File "C:\monitor\antminermonitor\blueprints\asicminer__init__.py", line 1, in from antminermonitor.blueprints.asicminer.views.antminer import antminer File

smwbev commented 1 year ago

in txt log error.txt

anselal commented 1 year ago

I am using python3.8. Not sure if the app can run in python3.11

anselal commented 1 year ago

Also the file antminermonitor/database.py

replace this engine = create_engine(SQLALCHEMY_DATABASE_URI, convert_unicode=True)

with this engine = create_engine(SQLALCHEMY_DATABASE_URI)

smwbev commented 1 year ago

I am using python3.8.

ok. Python 3.8.10 - May 3, 2021

smwbev commented 1 year ago

replace this engine = create_engine(SQLALCHEMY_DATABASE_URI, convert_unicode=True)

with this engine = create_engine(SQLALCHEMY_DATABASE_URI)

PS C:\monitor> python manage.py create-db 'FLASK_ENV' is deprecated and will not be used in Flask 2.3. Use 'FLASK_DEBUG' instead. 'FLASK_ENV' is deprecated and will not be used in Flask 2.3. Use 'FLASK_DEBUG' instead. [INFO] Database successfully created. PS C:\monitor>

anselal commented 1 year ago

Nice, this is just a warning. I have fixed it in my local copy of the app. Now follow the instruction to run the app. I would appreciate any other feedback in the Discussion tab

smwbev commented 1 year ago

Also the file antminermonitor/database.py

replace this engine = create_engine(SQLALCHEMY_DATABASE_URI, convert_unicode=True)

with this engine = create_engine(SQLALCHEMY_DATABASE_URI)

Thank you, everything works How to add fresh Antminer models?