Меню

Pip install eel ошибка

Ошибка при установке пакета eel через команду в командной строке: pip install eel.
Вообще не могу установить ни один пакет, уже переустановил все пакеты Visual C++, версию pip и даже сам Python.
До этого пользовался только компилятором mingw (говорят что может в нем быть причина ошибки.

Сама ошибка:
ERROR: Command errored out with exit status 1:
command: ‘c:userspunkoappdatalocalprogramspythonpython39python.exe’ ‘c:userspunkoappdatalocalprogramspythonpython39libsite-packagespip’ install —ignore-installed —no-user —prefix ‘C:UserspunkoAppDataLocalTemppip-build-env-881nuxfioverlay’ —no-warn-script-location —no-binary :none: —only-binary :none: -i https://pypi.org/simple — ‘setuptools >= 40.8.0’ wheel ‘Cython >= 3.0a5’ ‘cffi >= 1.12.3 ; platform_python_implementation == ‘»‘»‘CPython'»‘»» ‘greenlet >= 0.4.17 ; platform_python_implementation == ‘»‘»‘CPython'»‘»»
cwd: None
Complete output (33 lines):
Collecting setuptools>=40.8.0
Using cached setuptools-50.3.0-py3-none-any.whl (785 kB)
Collecting wheel
Using cached wheel-0.35.1-py2.py3-none-any.whl (33 kB)
Collecting Cython>=3.0a5
Using cached Cython-3.0a6-py2.py3-none-any.whl (1.0 MB)
Collecting cffi>=1.12.3
Using cached cffi-1.14.3-cp39-cp39-win_amd64.whl (179 kB)
Collecting greenlet>=0.4.17
Using cached greenlet-0.4.17.tar.gz (61 kB)
Collecting pycparser
Using cached pycparser-2.20-py2.py3-none-any.whl (112 kB)
Using legacy ‘setup.py install’ for greenlet, since package ‘wheel’ is not installed.
Installing collected packages: setuptools, wheel, Cython, pycparser, cffi, greenlet
Running setup.py install for greenlet: started
Running setup.py install for greenlet: finished with status ‘error’
ERROR: Command errored out with exit status 1:
command: ‘c:userspunkoappdatalocalprogramspythonpython39python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘C:\Users\punko\AppData\Local\Temp\pip-install-tystk9hm\greenlet\setup.py'»‘»‘; __file__='»‘»‘C:\Users\punko\AppData\Local\Temp\pip-install-tystk9hm\greenlet\setup.py'»‘»‘;f=getattr(tokenize, ‘»‘»‘open'»‘»‘, open)(__file__);code=f.read().replace(‘»‘»‘rn'»‘»‘, ‘»‘»‘n'»‘»‘);f.close();exec(compile(code, __file__, ‘»‘»‘exec'»‘»‘))’ install —record ‘C:UserspunkoAppDataLocalTemppip-record-y9jl407ninstall-record.txt’ —single-version-externally-managed —prefix ‘C:UserspunkoAppDataLocalTemppip-build-env-881nuxfioverlay’ —compile —install-headers ‘C:UserspunkoAppDataLocalTemppip-build-env-881nuxfioverlayIncludegreenlet’
cwd: C:UserspunkoAppDataLocalTemppip-install-tystk9hmgreenlet
Complete output (11 lines):
running install
running build
running build_ext
building ‘greenlet’ extension
creating build
creating buildtemp.win-amd64-3.9
creating buildtemp.win-amd64-3.9Release
D:Program Files (x86)Microsoft Visual Studio 14.0VCBINx86_amd64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:userspunkoappdatalocalprogramspythonpython39include -Ic:userspunkoappdatalocalprogramspythonpython39include -ID:Program Files (x86)Microsoft Visual Studio 14.0VCINCLUDE -ID:Program Files (x86)Microsoft Visual Studio 14.0VCATLMFCINCLUDE -IC:Program Files (x86)Windows Kits10include10.0.10240.0ucrt /Tcgreenlet.c /Fobuildtemp.win-amd64-3.9Releasegreenlet.obj
greenlet.c
c:userspunkoappdatalocalprogramspythonpython39includepyconfig.h(201): fatal error C1083: ЌҐ г¤ Ґвбп ®вЄалвм д ©« ўЄ«о祭ЁҐ: basetsd.h: No such file or directory,
error: command ‘D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe’ failed with exit code 2
—————————————-
ERROR: Command errored out with exit status 1: ‘c:userspunkoappdatalocalprogramspythonpython39python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘C:\Users\punko\AppData\Local\Temp\pip-install-tystk9hm\greenlet\setup.py'»‘»‘; __file__='»‘»‘C:\Users\punko\AppData\Local\Temp\pip-install-tystk9hm\greenlet\setup.py'»‘»‘;f=getattr(tokenize, ‘»‘»‘open'»‘»‘, open)(__file__);code=f.read().replace(‘»‘»‘rn'»‘»‘, ‘»‘»‘n'»‘»‘);f.close();exec(compile(code, __file__, ‘»‘»‘exec'»‘»‘))’ install —record ‘C:UserspunkoAppDataLocalTemppip-record-y9jl407ninstall-record.txt’ —single-version-externally-managed —prefix ‘C:UserspunkoAppDataLocalTemppip-build-env-881nuxfioverlay’ —compile —install-headers ‘C:UserspunkoAppDataLocalTemppip-build-env-881nuxfioverlayIncludegreenlet’ Check the logs for full command output.
—————————————-
ERROR: Command errored out with exit status 1: ‘c:userspunkoappdatalocalprogramspythonpython39python.exe’ ‘c:userspunkoappdatalocalprogramspythonpython39libsite-packagespip’ install —ignore-installed —no-user —prefix ‘C:UserspunkoAppDataLocalTemppip-build-env-881nuxfioverlay’ —no-warn-script-location —no-binary :none: —only-binary :none: -i https://pypi.org/simple — ‘setuptools >= 40.8.0’ wheel ‘Cython >= 3.0a5’ ‘cffi >= 1.12.3 ; platform_python_implementation == ‘»‘»‘CPython'»‘»» ‘greenlet >= 0.4.17 ; platform_python_implementation == ‘»‘»‘CPython'»‘»» Check the logs for full command output.

T

You didn’t show your attempts, do what you want is bad.
But given your desire for action, I will show you a simple example.Start module login.py — create OBDlogin.dbwhere you’ register users.If that’s what you wanted, you’ll have to use it in your program.login.pyfrom PyQt5.Qt import *
from welcome import MainWindow
from signup import Dialog
import sqlite3
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName(«Dialog»)
Dialog.resize(496, 265)
self.u_name_label = QLabel(Dialog)
self.u_name_label.setGeometry(QRect(150, 110, 71, 20))
font = QFont()
font.setPointSize(10)
font.setBold(False)
font.setWeight(50)
self.u_name_label.setFont(font)
self.u_name_label.setAlignment(Qt.AlignCenter)
self.u_name_label.setObjectName(«u_name_label»)
self.pass_label = QLabel(Dialog)
self.pass_label.setGeometry(QRect(150, 150, 71, 21))
font = QFont()
font.setPointSize(10)
self.pass_label.setFont(font)
self.pass_label.setAlignment(Qt.AlignCenter)
self.pass_label.setObjectName(«pass_label»)
self.uname_lineEdit = QLineEdit(Dialog)
self.uname_lineEdit.setGeometry(QRect(230, 110, 113, 20))
self.uname_lineEdit.setObjectName(«uname_lineEdit»)
self.pass_lineEdit = QLineEdit(Dialog)
self.pass_lineEdit.setGeometry(QRect(230, 150, 113, 20))
self.pass_lineEdit.setObjectName(«pass_lineEdit»)
self.login_btn = QPushButton(Dialog)
self.login_btn.setGeometry(QRect(230, 200, 51, 23))
self.login_btn.setObjectName(«login_btn»)
self.signup_btn = QPushButton(Dialog)
self.signup_btn.setGeometry(QRect(290, 200, 51, 23))
self.signup_btn.setObjectName(«signup_btn»)
self.label = QLabel(Dialog)
self.label.setGeometry(QRect(190, 10, 211, 51))
font = QFont()
font.setPointSize(18)
self.label.setFont(font)
self.label.setObjectName(«label»)
self.retranslateUi(Dialog)
QMetaObject.connectSlotsByName(Dialog)

def retranslateUi(self, Dialog):
_translate = QCoreApplication.translate
Dialog.setWindowTitle(_translate(«Dialog», «Login Form»))
self.u_name_label.setText(_translate(«Dialog», «USERNAME «))
self.pass_label.setText(_translate(«Dialog», «PASSWORD»))
self.login_btn.setText(_translate(«Dialog», «Login»))
self.signup_btn.setText(_translate(«Dialog», «Sign Up»))
self.label.setText(_translate(«Dialog», «Login Form»))

class LoginDatabase():
def init(self, dbname):
self.dbname = dbname
self.conn = sqlite3.connect(dbname)
def is_table(self, table_name):
query = «SELECT name from sqlite_master WHERE type=’table’ AND name='{}’;».format(table_name)
cursor = self.conn.execute(query)
result = cursor.fetchone()
if result == None:
return False
else:
return True

class MainDialog(QDialog, Ui_Dialog):
def init(self, parent=None):
super(MainDialog, self).init(parent)
self.setupUi(self)
self.loginDatabase = LoginDatabase(‘login.db’)
if self.loginDatabase.is_table(‘USERS’):
pass
else:
self.loginDatabase.conn.execute(«CREATE TABLE USERS(USERNAME TEXT NOT NULL, EMAIL TEXT, PASSWORD TEXT)»)
self.loginDatabase.conn.execute(«INSERT INTO USERS VALUES(?, ?, ?)»,
(‘admin’, ‘admin@gmail.com’, ‘admin’)
)
self.loginDatabase.conn.commit()

self.login_btn.clicked.connect(self.loginCheck)
self.signup_btn.clicked.connect(self.signUpCheck)

def showMessageBox(self, title, message):
msgBox = QMessageBox()
msgBox.setIcon(QMessageBox.Warning)
msgBox.setWindowTitle(title)
msgBox.setText(message)
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec_()

def welcomeWindowShow(self, username):
self.welcomeWindow = MainWindow(username)
self.welcomeWindow.show()

def signUpShow(self):
self.signUpWindow = Dialog(self)
self.signUpWindow.show()

def loginCheck(self):
username = self.uname_lineEdit.text()
password = self.pass_lineEdit.text()
if (not username) or (not password):
msg = QMessageBox.information(self, ‘Внимание!’, ‘Вы не заполнили все поля.’)
return

result = self.loginDatabase.conn.execute(«SELECT * FROM USERS WHERE USERNAME = ? AND PASSWORD = ?»,
(username, password))
if len(result.fetchall()):
self.welcomeWindowShow(username)
self.hide()
self.loginDatabase.conn.close()
else:
self.showMessageBox(‘Внимание!’, ‘Неправильное имя пользователя или пароль.’)

def signUpCheck(self):
self.signUpShow()

if name == «main»:
import sys
app = QApplication(sys.argv)
w = MainDialog()
w.show()
sys.exit(app.exec_())
signup.pyfrom PyQt5.Qt import *
class Ui_signUp(object):
def setupUi(self, Dialog):
Dialog.setObjectName(«Dialog»)
Dialog.resize(570, 375)
self.label = QLabel(Dialog)
self.label.setGeometry(QRect(160, 130, 81, 31))
font = QFont()
font.setPointSize(10)
self.label.setFont(font)
self.label.setObjectName(«label»)
self.label_2 = QLabel(Dialog)
self.label_2.setGeometry(QRect(160, 230, 81, 31))
font = QFont()
font.setPointSize(10)
self.label_2.setFont(font)
self.label_2.setObjectName(«label_2»)
self.label_3 = QLabel(Dialog)
self.label_3.setGeometry(QRect(160, 180, 81, 31))
font = QFont()
font.setPointSize(10)
self.label_3.setFont(font)
self.label_3.setObjectName(«label_3»)
self.uname_lineEdit = QLineEdit(Dialog)
self.uname_lineEdit.setGeometry(QRect(250, 130, 141, 20))
self.uname_lineEdit.setObjectName(«uname_lineEdit»)
self.email_lineEdit = QLineEdit(Dialog)
self.email_lineEdit.setGeometry(QRect(250, 180, 141, 20))
self.email_lineEdit.setObjectName(«email_lineEdit»)
self.password_lineEdit = QLineEdit(Dialog)
self.password_lineEdit.setGeometry(QRect(250, 230, 141, 20))
self.password_lineEdit.setObjectName(«password_lineEdit»)
self.signup_btn = QPushButton(Dialog)
self.signup_btn.setGeometry(QRect(270, 290, 75, 23))
self.signup_btn.setObjectName(«signup_btn»)
self.label_4 = QLabel(Dialog)
self.label_4.setGeometry(QRect(150, 10, 321, 81))
font = QFont()
font.setPointSize(18)
self.label_4.setFont(font)
self.label_4.setAlignment(Qt.AlignCenter)
self.label_4.setObjectName(«label_4»)
self.retranslateUi(Dialog)
QMetaObject.connectSlotsByName(Dialog)

def retranslateUi(self, Dialog):
_translate = QCoreApplication.translate
Dialog.setWindowTitle(_translate(«Dialog», «Dialog»))
self.label.setText(_translate(«Dialog», «USERNAME»))
self.label_2.setText(_translate(«Dialog», «PASSWORD»))
self.label_3.setText(_translate(«Dialog», «Email»))
self.signup_btn.setText(_translate(«Dialog», «Sign Up»))
self.label_4.setText(_translate(«Dialog», «Create Account»))

class Dialog(QDialog, Ui_signUp):
def init(self, parent=None):
super(Dialog, self).init(parent)
self.setupUi(self)
self.parent = parent
self.signup_btn.clicked.connect(self.insertData)

@pyqtSlot()
def insertData(self):
username = self.uname_lineEdit.text()
email = self.email_lineEdit.text()
password = self.password_lineEdit.text()

if (not username) or (not email) or (not password):
msg = QMessageBox.information(self, ‘Внимание!’, ‘Вы не заполнили все поля.’)
return

result = self.parent.loginDatabase.conn.execute(«SELECT * FROM USERS WHERE USERNAME = ?», (username,))
if result.fetchall():
msg = QMessageBox.information(self, ‘Внимание!’, ‘Пользоватеть с таким именем уже зарегистрирован.’)
else:
self.parent.loginDatabase.conn.execute(«INSERT INTO USERS VALUES(?, ?, ?)»,
(username, email, password))
self.parent.loginDatabase.conn.commit()
self.close()

if name == «main»:
import sys
app = QApplication(sys.argv)
w = Dialog()
w.show()
sys.exit(app.exec_())
welcome.pyfrom PyQt5.Qt import *
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName(«MainWindow»)
MainWindow.resize(466, 283)
self.centralwidget = QWidget(MainWindow)
self.centralwidget.setObjectName(«centralwidget»)
self.label = QLabel(self.centralwidget)
self.label.setGeometry(QRect(120, 30, 231, 51))
font = QFont()
font.setPointSize(18)
self.label.setFont(font)
self.label.setAlignment(Qt.AlignCenter)
self.label.setObjectName(«label»)
self.label_2 = QLabel(self.centralwidget)
self.label_2.setGeometry(QRect(140, 120, 211, 51))
font = QFont()
font.setPointSize(18)
self.label_2.setFont(font)
self.label_2.setAlignment(Qt.AlignCenter)
self.label_2.setObjectName(«label_2»)
MainWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(MainWindow)
QMetaObject.connectSlotsByName(MainWindow)

def retranslateUi(self, MainWindow):
_translate = QCoreApplication.translate
MainWindow.setWindowTitle(_translate(«MainWindow», «MainWindow»))
self.label.setText(_translate(«MainWindow», «Добро пожаловать!»))
self.label_2.setText(_translate(«MainWindow», «Хорошего вам дня!»))

class MainWindow(QMainWindow, Ui_MainWindow):
def init(self, name=’admin’):
super().init()
self.setupUi(self)
self.label.setText(‘{} {}’.format(self.label.text(), name))
gridLayout = QGridLayout(self.centralwidget)
gridLayout.addWidget(self.label)
gridLayout.addWidget(self.label_2)

if name == «main»:
import sys
app = QApplication(sys.argv)
w = MainWindow()
w.show()
sys.exit(app.exec_())








by


asked

Apr 1, 2021



Error installing the eel package via the command line command: pip install eel.
I can’t install any package at all, I’ve already reinstalled all Visual C++ packages, the pip version and even Python itself.
Before that I only used the mingw compiler (they say it may be the cause of the error.

The mistake itself:
ERROR: Command errored out with exit status 1:
command: ‘c:userspunkoappdatalocalprogramspythonpython39python.exe’ ‘c:userspunkoappdatalocalprogramspythonpython39libsite-packagespip’ install —ignore-installed —no-user —prefix ‘C:UserspunkoAppDataLocalTemppip-build-env-881nuxfioverlay’ —no-warn-script-location —no-binary :none: —only-binary :none: -i https://pypi.org/simple — ‘setuptools >= 40.8.0’ wheel ‘Cython >= 3.0a5’ ‘cffi >= 1.12.3 ; platform_python_implementation == ‘»‘»‘CPython'»‘»» ‘greenlet >= 0.4.17 ; platform_python_implementation == ‘»‘»‘CPython'»‘»»
cwd: None
Complete output (33 lines):
Collecting setuptools>=40.8.0
Using cached setuptools-50.3.0-py3-none-any.whl (785 kB)
Collecting wheel
Using cached wheel-0.35.1-py2.py3-none-any.whl (33 kB)
Collecting Cython>=3.0a5
Using cached Cython-3.0a6-py2.py3-none-any.whl (1.0 MB)
Collecting cffi>=1.12.3
Using cached cffi-1.14.3-cp39-cp39-win_amd64.whl (179 kB)
Collecting greenlet>=0.4.17
Using cached greenlet-0.4.17.tar.gz (61 kB)
Collecting pycparser
Using cached pycparser-2.20-py2.py3-none-any.whl (112 kB)
Using legacy ‘setup.py install’ for greenlet, since package ‘wheel’ is not installed.
Installing collected packages: setuptools, wheel, Cython, pycparser, cffi, greenlet
Running setup.py install for greenlet: started
Running setup.py install for greenlet: finished with status ‘error’
ERROR: Command errored out with exit status 1:
command: ‘c:userspunkoappdatalocalprogramspythonpython39python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘C:\Users\punko\AppData\Local\Temp\pip-install-tystk9hm\greenlet\setup.py'»‘»‘; __file__='»‘»‘C:\Users\punko\AppData\Local\Temp\pip-install-tystk9hm\greenlet\setup.py'»‘»‘;f=getattr(tokenize, ‘»‘»‘open'»‘»‘, open)(__file__);code=f.read().replace(‘»‘»‘rn'»‘»‘, ‘»‘»‘n'»‘»‘);f.close();exec(compile(code, __file__, ‘»‘»‘exec'»‘»‘))’ install —record ‘C:UserspunkoAppDataLocalTemppip-record-y9jl407ninstall-record.txt’ —single-version-externally-managed —prefix ‘C:UserspunkoAppDataLocalTemppip-build-env-881nuxfioverlay’ —compile —install-headers ‘C:UserspunkoAppDataLocalTemppip-build-env-881nuxfioverlayIncludegreenlet’
cwd: C:UserspunkoAppDataLocalTemppip-install-tystk9hmgreenlet
Complete output (11 lines):
running install
running build
running build_ext
building ‘greenlet’ extension
creating build
creating buildtemp.win-amd64-3.9
creating buildtemp.win-amd64-3.9Release
D:Program Files (x86)Microsoft Visual Studio 14.0VCBINx86_amd64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:userspunkoappdatalocalprogramspythonpython39include -Ic:userspunkoappdatalocalprogramspythonpython39include -ID:Program Files (x86)Microsoft Visual Studio 14.0VCINCLUDE -ID:Program Files (x86)Microsoft Visual Studio 14.0VCATLMFCINCLUDE -IC:Program Files (x86)Windows Kits10include10.0.10240.0ucrt /Tcgreenlet.c /Fobuildtemp.win-amd64-3.9Releasegreenlet.obj
greenlet.c
c:userspunkoappdatalocalprogramspythonpython39includepyconfig.h(201): фатальная ошибка C1083: ЌҐ г¤ Ґвбп ®вЄалвм д ©» ўЄ «о票Ґ: basetsd.h.»: Нет такого файла или директории,
error: command ‘D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe’ failed with exit code 2
—————————————-
ERROR: Command errored out with exit status 1: ‘c:userspunkoappdatalocalprogramspythonpython39python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘C:\Users\punko\AppData\Local\Temp\pip-install-tystk9hm\greenlet\setup.py'»‘»‘; __file__='»‘»‘C:\Users\punko\AppData\Local\Temp\pip-install-tystk9hm\greenlet\setup.py'»‘»‘;f=getattr(tokenize, ‘»‘»‘open'»‘»‘, open)(__file__);code=f.read().replace(‘»‘»‘rn'»‘»‘, ‘»‘»‘n'»‘»‘);f.close();exec(compile(code, __file__, ‘»‘»‘exec'»‘»‘))’ install —record ‘C:UserspunkoAppDataLocalTemppip-record-y9jl407ninstall-record.txt’ —single-version-externally-managed —prefix ‘C:UserspunkoAppDataLocalTemppip-build-env-881nuxfioverlay’ —compile —install-headers ‘C:UserspunkoAppDataLocalTemppip-build-env-881nuxfioverlayIncludegreenlet’ Check the logs for full command output.
—————————————-
ERROR: Command errored out with exit status 1: ‘c:userspunkoappdatalocalprogramspythonpython39python.exe’ ‘c:userspunkoappdatalocalprogramspythonpython39libsite-packagespip’ install —ignore-installed —no-user —prefix ‘C:UserspunkoAppDataLocalTemppip-build-env-881nuxfioverlay’ —no-warn-script-location —no-binary :none: —only-binary :none: -i https://pypi.org/simple — ‘setuptools >= 40.8.0’ wheel ‘Cython >= 3.0a5’ ‘cffi >= 1.12.3 ; platform_python_implementation == ‘»‘»‘CPython'»‘»» ‘greenlet >= 0.4.17 ; platform_python_implementation == ‘»‘»‘CPython'»‘»» Check the logs for full command output.

2 Answers

Put python 3.8 or better yet 3.7
3.9 just came out of beta recently — too new








by
Andy_U


answered

Apr 1, 2021



Checked the installation in a clean virtual environment:

See installation protocol…
Microsoft Windows [Version 10.0.16299.2107]
(c) 2017 Microsoft Corporation. All rights reserved.

(.venv390) D:DocumentsPycharmProjectstst39>pip install eel
Collecting eel
Downloading Eel-0.14.0.tar.gz (17 kB)
Collecting bottle
Downloading bottle-0.12.18-py3-none-any.whl (89 kB)
|████████████████████████████████| 89 kB 654 kB/s
Collecting bottle-websocket
Downloading bottle-websocket-0.2.9.tar.gz (2.0 kB)
Collecting future
Downloading future-0.18.2.tar.gz (829 kB)
|████████████████████████████████| 829 kB 1.1 MB/s
Collecting pyparsing
Using cached pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
Collecting whichcraft
Downloading whichcraft-0.6.1-py2.py3-none-any.whl (5.2 kB)
Collecting gevent-websocket
Downloading gevent_websocket-0.10.1-py3-none-any.whl (22 kB)
Collecting gevent
Downloading gevent-20.9.0.tar.gz (5.8 MB)
|████████████████████████████████| 5.8 MB 819 kB/s
Installing build dependencies … done
Getting requirements to build wheel … done
Preparing wheel metadata … done
Requirement already satisfied: setuptools in d:documentspycharmprojectstst39.venv390libsite-packages (from gevent->gevent-websocket->bottle-websocket->eel) (50.3.0)
Collecting zope.event
Downloading zope.event-4.5.0-py2.py3-none-any.whl (6.8 kB)
Processing c:usersushakovayappdatalocalpipcachewheels9d57c1e801430741639b9be449a6643c8be3210d68f066446504cb5fgreenlet-0.4.17-cp39-cp39-win_amd64.whl
Collecting zope.interface
Downloading zope.interface-5.1.2.tar.gz (228 kB)
|████████████████████████████████| 228 kB 1.1 MB/s
Collecting cffi>=1.12.2; platform_python_implementation == «CPython» and sys_platform == «win32»
Using cached cffi-1.14.3-cp39-cp39-win_amd64.whl (179 kB)
Collecting pycparser
Using cached pycparser-2.20-py2.py3-none-any.whl (112 kB)
Building wheels for collected packages: eel, bottle-websocket, future, gevent, zope.interface
Building wheel for eel (setup.py) … done
Created wheel for eel: filename=Eel-0.14.0-py3-none-any.whl size=17466 sha256=4138700b941ca6c1c90d2c0017d5f6515ccfb2e42139adb5b9a70d5c7e8b3823
Stored in directory: c:usersushakovayappdatalocalpipcachewheelsf1c25c5f6bc6e4a71a5ea3c3d9b46f832e1ca0a2a66d229c4efb13c9
Building wheel for bottle-websocket (setup.py) … done
Created wheel for bottle-websocket: filename=bottle_websocket-0.2.9-py3-none-any.whl size=2353 sha256=aef67a2df8581f132c1cbc63771a8da1c73812f6c406e20ae1f4230b3781ebc9
Stored in directory: c:usersushakovayappdatalocalpipcachewheels3f389b62449b34a0c944daa3c7ae993e2d9a97096b22a2c9d4bd49b
Building wheel for future (setup.py) … done
Created wheel for future: filename=future-0.18.2-py3-none-any.whl size=491062 sha256=55bee94514979181f6a5512d6ffc973cbbc7896efbff5d1693ffe6b7ddddc3eb
Stored in directory: c:usersushakovayappdatalocalpipcachewheels2fa0d34030d9f80e6b3be787f19fc911b8e7aa462986a40ab1e4bb94
Building wheel for gevent (PEP 517) … done
Created wheel for gevent: filename=gevent-20.9.0-cp39-cp39-win_amd64.whl size=1524182 sha256=3b0ccdb92c72d0bda1d34dacd23e101f3f2486677e97c7a0b1cb9368c124e1f7
Stored in directory: c:usersushakovayappdatalocalpipcachewheels1f44999f12f4be61863aaacf1bd866310ee44d2d884e22565b211a0
Building wheel for zope.interface (setup.py) … done
Created wheel for zope.interface: filename=zope.interface-5.1.2-cp39-cp39-win_amd64.whl size=195684 sha256=109fe4bb38647db6abbcf8a064ba85b719200e84a945870ab9c3fa9715d04463
Stored in directory: c:usersushakovayappdatalocalpipcachewheels9e2cc36410c8350e1f3683cd8e1eb85b0c1b906061eea437477c89cf
Successfully built eel bottle-websocket future gevent zope.interface
Installing collected packages: bottle, zope.event, greenlet, zope.interface, pycparser, cffi, gevent, gevent-websocket, bottle-websocket, future, pyparsing, whichcraft, eel
Successfully installed bottle-0.12.18 bottle-websocket-0.2.9 cffi-1.14.3 eel-0.14.0 future-0.18.2 gevent-20.9.0 gevent-websocket-0.10.1 greenlet-0.4.17 pycparser-2.20 pyparsing-2.4.7 whichcraft-0.6.1 zope.event-4.5.0 zope.interface-5.1.2

(.venv390) D:DocumentsPycharmProjectstst39> No problems… The only thing is that I have Visual Studio Build Tools 2019 16.2.29215.179 (I installed it a year ago). P.S. By the way, my missing file basetsd.h is located in C:Program Files (x86)Windows Kits10Include10.0.18362.0shared.

Прописал в командной строке pip install Eel пошел процесс:

Collecting Eel
  Using cached Eel-0.14.0.tar.gz (17 kB)
Requirement already satisfied: future in c:program filespython39libsite-packages (from Eel) (0.18.2)
Collecting bottle
  Using cached bottle-0.12.19-py3-none-any.whl (89 kB)
Collecting bottle-websocket
  Using cached bottle-websocket-0.2.9.tar.gz (2.0 kB)
Collecting gevent-websocket
  Using cached gevent_websocket-0.10.1-py3-none-any.whl (22 kB)
Collecting gevent
  Using cached gevent-20.12.1.tar.gz (5.9 MB)
  Installing build dependencies ... error

до этого момента все было нормально, но после:

 ERROR: Command errored out with exit status 1:
   command: 'c:program filespython39python.exe' 'c:program filespython39libsite-packagespip' install --ignore-installed --no-user --prefix 'C:UsersUserAppDataLocalTemppip-build-env-7owfez8loverlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools >= 40.8.0' wheel 'Cython >= 3.0a5' 'cffi >= 1.12.3 ; platform_python_implementation == '"'"'CPython'"'"'' 'greenlet >= 0.4.17, < 2.0 ; platform_python_implementation == '"'"'CPython'"'"''
       cwd: None
  Complete output (27 lines):
  Collecting cffi>=1.12.3
    Using cached cffi-1.14.4-cp39-cp39-win_amd64.whl (179 kB)
  Collecting Cython>=3.0a5
    Using cached Cython-3.0a6-py2.py3-none-any.whl (1.0 MB)
  Collecting greenlet<2.0,>=0.4.17
    Using cached greenlet-0.4.17.tar.gz (61 kB)
  Collecting wheel
    Using cached wheel-0.36.2-py2.py3-none-any.whl (35 kB)
  Collecting pycparser
    Using cached pycparser-2.20-py2.py3-none-any.whl (112 kB)
  Collecting setuptools>=40.8.0
    Using cached setuptools-51.1.1-py3-none-any.whl (2.0 MB)
  Using legacy 'setup.py install' for greenlet, since package 'wheel' is not installed.
  Installing collected packages: pycparser, wheel, setuptools, greenlet, Cython, cffi
      Running setup.py install for greenlet: started
      Running setup.py install for greenlet: finished with status 'error'
      ERROR: Command errored out with exit status 1:
       command: 'c:program filespython39python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\User\AppData\Local\Temp\pip-install-83q7wnl8\greenlet_d3f80df7773541828232d986305cc345\setup.py'"'"'; __file__='"'"'C:\Users\User\AppData\Local\Temp\pip-install-83q7wnl8\greenlet_d3f80df7773541828232d986305cc345\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersUserAppDataLocalTemppip-record-b_nhoujwinstall-record.txt' --single-version-externally-managed --prefix 'C:UsersUserAppDataLocalTemppip-build-env-7owfez8loverlay' --compile --install-headers 'C:UsersUserAppDataLocalTemppip-build-env-7owfez8loverlayIncludegreenlet'
           cwd: C:UsersUserAppDataLocalTemppip-install-83q7wnl8greenlet_d3f80df7773541828232d986305cc345
      Complete output (5 lines):
      running install
      running build
      running build_ext
      building 'greenlet' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      ----------------------------------------
  ERROR: Command errored out with exit status 1: 'c:program filespython39python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\User\AppData\Local\Temp\pip-install-83q7wnl8\greenlet_d3f80df7773541828232d986305cc345\setup.py'"'"'; __file__='"'"'C:\Users\User\AppData\Local\Temp\pip-install-83q7wnl8\greenlet_d3f80df7773541828232d986305cc345\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersUserAppDataLocalTemppip-record-b_nhoujwinstall-record.txt' --single-version-externally-managed --prefix 'C:UsersUserAppDataLocalTemppip-build-env-7owfez8loverlay' --compile --install-headers 'C:UsersUserAppDataLocalTemppip-build-env-7owfez8loverlayIncludegreenlet' Check the logs for full command output.
  ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:program filespython39python.exe' 'c:program filespython39libsite-packagespip' install --ignore-installed --no-user --prefix 'C:UsersUserAppDataLocalTemppip-build-env-7owfez8loverlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools >= 40.8.0' wheel 'Cython >= 3.0a5' 'cffi >= 1.12.3 ; platform_python_implementation == '"'"'CPython'"'"'' 'greenlet >= 0.4.17, < 2.0 ; platform_python_implementation == '"'"'CPython'"'"'' Check the logs for full command output.

В чем проблема? Почему модуль не устанавливается?

PyPI version
PyPi Downloads
Python
License

Total alerts
Language grade: JavaScript
Language grade: Python

Eel is a little Python library for making simple Electron-like offline HTML/JS GUI apps, with full access to Python capabilities and libraries.

Eel hosts a local webserver, then lets you annotate functions in Python so that they can be called from Javascript, and vice versa.

Eel is designed to take the hassle out of writing short and simple GUI applications. If you are familiar with Python and web development, probably just jump to this example which picks random file names out of the given folder (something that is impossible from a browser).

  • Eel
    • Intro
    • Install
    • Usage
      • Directory Structure
      • Starting the app
      • App options
        • Chrome/Chromium flags
      • Exposing functions
      • Eello, World!
      • Return values
        • Callbacks
        • Synchronous returns
    • Asynchronous Python
    • Building distributable binary with PyInstaller
    • Microsoft Edge

Intro

There are several options for making GUI apps in Python, but if you want to use HTML/JS (in order to use jQueryUI or Bootstrap, for example) then you generally have to write a lot of boilerplate code to communicate from the Client (Javascript) side to the Server (Python) side.

The closest Python equivalent to Electron (to my knowledge) is cefpython. It is a bit heavy weight for what I wanted.

Eel is not as fully-fledged as Electron or cefpython — it is probably not suitable for making full blown applications like Atom — but it is very suitable for making the GUI equivalent of little utility scripts that you use internally in your team.

For some reason many of the best-in-class number crunching and maths libraries are in Python (Tensorflow, Numpy, Scipy etc) but many of the best visualization libraries are in Javascript (D3, THREE.js etc). Hopefully Eel makes it easy to combine these into simple utility apps for assisting your development.

Join Eel’s users and maintainers on Discord, if you like.

Install

Install from pypi with pip:

pip install eel

To include support for HTML templating, currently using Jinja2:

pip install eel[jinja2]

Usage

Directory Structure

An Eel application will be split into a frontend consisting of various web-technology files (.html, .js, .css) and a backend consisting of various Python scripts.

All the frontend files should be put in a single directory (they can be further divided into folders inside this if necessary).

my_python_script.py     <-- Python scripts
other_python_module.py
static_web_folder/      <-- Web folder
  main_page.html
  css/
    style.css
  img/
    logo.png

Starting the app

Suppose you put all the frontend files in a directory called web, including your start page main.html, then the app is started like this;

import eel
eel.init('web')
eel.start('main.html')

This will start a webserver on the default settings (http://localhost:8000) and open a browser to http://localhost:8000/main.html.

If Chrome or Chromium is installed then by default it will open in that in App Mode (with the --app cmdline flag), regardless of what the OS’s default browser is set to (it is possible to override this behaviour).

App options

Additional options can be passed to eel.start() as keyword arguments.

Some of the options include the mode the app is in (e.g. ‘chrome’), the port the app runs on, the host name of the app, and adding additional command line flags.

As of Eel v0.12.0, the following options are available to start():

  • mode, a string specifying what browser to use (e.g. 'chrome', 'electron', 'edge', 'custom'). Can also be None or False to not open a window. Default: 'chrome'
  • host, a string specifying what hostname to use for the Bottle server. Default: 'localhost')
  • port, an int specifying what port to use for the Bottle server. Use 0 for port to be picked automatically. Default: 8000.
  • block, a bool saying whether or not the call to start() should block the calling thread. Default: True
  • jinja_templates, a string specifying a folder to use for Jinja2 templates, e.g. my_templates. Default: None
  • cmdline_args, a list of strings to pass to the command to start the browser. For example, we might add extra flags for Chrome; eel.start('main.html', mode='chrome-app', port=8080, cmdline_args=['--start-fullscreen', '--browser-startup-dialog']). Default: []
  • size, a tuple of ints specifying the (width, height) of the main window in pixels Default: None
  • position, a tuple of ints specifying the (left, top) of the main window in pixels Default: None
  • geometry, a dictionary specifying the size and position for all windows. The keys should be the relative path of the page, and the values should be a dictionary of the form {'size': (200, 100), 'position': (300, 50)}. Default: {}
  • close_callback, a lambda or function that is called when a websocket to a window closes (i.e. when the user closes the window). It should take two arguments; a string which is the relative path of the page that just closed, and a list of other websockets that are still open. Default: None
  • app, an instance of Bottle which will be used rather than creating a fresh one. This can be used to install middleware on the
    instance before starting eel, e.g. for session management, authentication, etc.
  • shutdown_delay, timer configurable for Eel’s shutdown detection mechanism, whereby when any websocket closes, it waits shutdown_delay seconds, and then checks if there are now any websocket connections. If not, then Eel closes. In case the user has closed the browser and wants to exit the program. By default, the value of shutdown_delay is 1.0 second

Exposing functions

In addition to the files in the frontend folder, a Javascript library will be served at /eel.js. You should include this in any pages:

<script type="text/javascript" src="/eel.js"></script>

Including this library creates an eel object which can be used to communicate with the Python side.

Any functions in the Python code which are decorated with @eel.expose like this…

@eel.expose
def my_python_function(a, b):
    print(a, b, a + b)

…will appear as methods on the eel object on the Javascript side, like this…

console.log("Calling Python...");
eel.my_python_function(1, 2); // This calls the Python function that was decorated

Similarly, any Javascript functions which are exposed like this…

eel.expose(my_javascript_function);
function my_javascript_function(a, b, c, d) {
  if (a < b) {
    console.log(c * d);
  }
}

can be called from the Python side like this…

print('Calling Javascript...')
eel.my_javascript_function(1, 2, 3, 4)  # This calls the Javascript function

The exposed name can also be overridden by passing in a second argument. If your app minifies JavaScript during builds, this may be necessary to ensure that functions can be resolved on the Python side:

eel.expose(someFunction, "my_javascript_function");

When passing complex objects as arguments, bear in mind that internally they are converted to JSON and sent down a websocket (a process that potentially loses information).

Eello, World!

See full example in: examples/01 — hello_world

Putting this together into a Hello, World! example, we have a short HTML page, web/hello.html:

<!DOCTYPE html>
<html>
  <head>
    <title>Hello, World!</title>

    <!-- Include eel.js - note this file doesn't exist in the 'web' directory -->
    <script type="text/javascript" src="/eel.js"></script>
    <script type="text/javascript">
      eel.expose(say_hello_js); // Expose this function to Python
      function say_hello_js(x) {
        console.log("Hello from " + x);
      }

      say_hello_js("Javascript World!");
      eel.say_hello_py("Javascript World!"); // Call a Python function
    </script>
  </head>

  <body>
    Hello, World!
  </body>
</html>

and a short Python script hello.py:

import eel

# Set web files folder and optionally specify which file types to check for eel.expose()
#   *Default allowed_extensions are: ['.js', '.html', '.txt', '.htm', '.xhtml']
eel.init('web', allowed_extensions=['.js', '.html'])

@eel.expose                         # Expose this function to Javascript
def say_hello_py(x):
    print('Hello from %s' % x)

say_hello_py('Python World!')
eel.say_hello_js('Python World!')   # Call a Javascript function

eel.start('hello.html')             # Start (this blocks and enters loop)

If we run the Python script (python hello.py), then a browser window will open displaying hello.html, and we will see…

Hello from Python World!
Hello from Javascript World!

…in the terminal, and…

Hello from Javascript World!
Hello from Python World!

…in the browser console (press F12 to open).

You will notice that in the Python code, the Javascript function is called before the browser window is even started — any early calls like this are queued up and then sent once the websocket has been established.

Return values

While we want to think of our code as comprising a single application, the Python interpreter and the browser window run in separate processes. This can make communicating back and forth between them a bit of a mess, especially if we always had to explicitly send values from one side to the other.

Eel supports two ways of retrieving return values from the other side of the app, which helps keep the code concise.

To prevent hanging forever on the Python side, a timeout has been put in place for trying to retrieve values from
the JavaScript side, which defaults to 10000 milliseconds (10 seconds). This can be changed with the _js_result_timeout parameter to eel.init. There is no corresponding timeout on the JavaScript side.

Callbacks

When you call an exposed function, you can immediately pass a callback function afterwards. This callback will automatically be called asynchronously with the return value when the function has finished executing on the other side.

For example, if we have the following function defined and exposed in Javascript:

eel.expose(js_random);
function js_random() {
  return Math.random();
}

Then in Python we can retrieve random values from the Javascript side like so:

def print_num(n):
    print('Got this from Javascript:', n)

# Call Javascript function, and pass explicit callback function
eel.js_random()(print_num)

# Do the same with an inline lambda as callback
eel.js_random()(lambda n: print('Got this from Javascript:', n))

(It works exactly the same the other way around).

Synchronous returns

In most situations, the calls to the other side are to quickly retrieve some piece of data, such as the state of a widget or contents of an input field. In these cases it is more convenient to just synchronously wait a few milliseconds then continue with your code, rather than breaking the whole thing up into callbacks.

To synchronously retrieve the return value, simply pass nothing to the second set of brackets. So in Python we would write:

n = eel.js_random()()  # This immediately returns the value
print('Got this from Javascript:', n)

You can only perform synchronous returns after the browser window has started (after calling eel.start()), otherwise obviously the call will hang.

In Javascript, the language doesn’t allow us to block while we wait for a callback, except by using await from inside an async function. So the equivalent code from the Javascript side would be:

async function run() {
  // Inside a function marked 'async' we can use the 'await' keyword.

  let n = await eel.py_random()(); // Must prefix call with 'await', otherwise it's the same syntax
  console.log("Got this from Python: " + n);
}

run();

Asynchronous Python

Eel is built on Bottle and Gevent, which provide an asynchronous event loop similar to Javascript. A lot of Python’s standard library implicitly assumes there is a single execution thread — to deal with this, Gevent can «monkey patch» many of the standard modules such as time. This monkey patching is done automatically when you call import eel. If you need monkey patching you should import gevent.monkey and call gevent.monkey.patch_all() before you import eel. Monkey patching can interfere with things like debuggers so should be avoided unless necessary.

For most cases you should be fine by avoiding using time.sleep() and instead using the versions provided by gevent. For convenience, the two most commonly needed gevent methods, sleep() and spawn() are provided directly from Eel (to save importing time and/or gevent as well).

In this example…

import eel
eel.init('web')

def my_other_thread():
    while True:
        print("I'm a thread")
        eel.sleep(1.0)                  # Use eel.sleep(), not time.sleep()

eel.spawn(my_other_thread)

eel.start('main.html', block=False)     # Don't block on this call

while True:
    print("I'm a main loop")
    eel.sleep(1.0)                      # Use eel.sleep(), not time.sleep()

…we would then have three «threads» (greenlets) running;

  1. Eel’s internal thread for serving the web folder
  2. The my_other_thread method, repeatedly printing «I’m a thread»
  3. The main Python thread, which would be stuck in the final while loop, repeatedly printing «I’m a main loop»

Building distributable binary with PyInstaller

If you want to package your app into a program that can be run on a computer without a Python interpreter installed, you should use PyInstaller.

  1. Configure a virtualenv with desired Python version and minimum necessary Python packages
  2. Install PyInstaller pip install PyInstaller
  3. In your app’s folder, run python -m eel [your_main_script] [your_web_folder] (for example, you might run python -m eel hello.py web)
  4. This will create a new folder dist/
  5. Valid PyInstaller flags can be passed through, such as excluding modules with the flag: --exclude module_name. For example, you might run python -m eel file_access.py web --exclude win32com --exclude numpy --exclude cryptography
  6. When happy that your app is working correctly, add --onefile --noconsole flags to build a single executable file

Consult the documentation for PyInstaller for more options.

Microsoft Edge

For Windows 10 users, Microsoft Edge (eel.start(.., mode='edge')) is installed by default and a useful fallback if a preferred browser is not installed. See the examples:

  • A Hello World example using Microsoft Edge: examples/01 — hello_world-Edge/
  • Example implementing browser-fallbacks: examples/07 — CreateReactApp/eel_CRA.py

0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии

А вот еще интересные материалы:

  • Яшка сломя голову остановился исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного где ошибка
  • Pip install discord ошибка
  • Pip install colorama ошибка