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

RuntimeError: Could not import backend "Glfw": #442

Closed
Juhhxx opened this issue Nov 17, 2023 · 7 comments
Closed

RuntimeError: Could not import backend "Glfw": #442

Juhhxx opened this issue Nov 17, 2023 · 7 comments

Comments

@Juhhxx
Copy link

Juhhxx commented Nov 17, 2023

I'm trying to package a script that has the p5.py library, it runs normally in vs code and I have all the dependencies installed, yet when I try to run the executable it always gives me an error related to the GLFW library, I've already tried to put it in the hidden imports section and it gives me this message :

Traceback (most recent call last):
  File "minesweeper.py", line 499, in <module>
  File "p5\sketch\userspace.py", line 187, in run
  File "vispy\util\wrappers.py", line 93, in use
  File "vispy\app\_default_app.py", line 47, in use_app
  File "vispy\app\application.py", line 47, in __init__
  File "vispy\app\application.py", line 240, in _use
RuntimeError: Could not import backend "Glfw":
Could not import glwf, you may need to `pip install glfw` first.

Here is all the libraries I have in the script:

from p5 import *
from myColorsShapes import * # custom library just with some functions
import random
import time
import sys, os
import vispy.app.backends._glfw # I've added this one because before it said it couldn't find 'vispy.app.backends._glfw'

Your Environment:

  • Python version: 3.10.1
  • auto-py-to-exe version: 2.42.0
  • PyInstaller version: 6.2.0
  • Eel version: 0.16.0

Here is all my librabries

C:\Users\count>pip list
Package                   Version
------------------------- -----------
altgraph                  0.17.4
auto-py-to-exe            2.42.0
bottle                    0.12.25
bottle-websocket          0.2.9
certifi                   2023.7.22
cffi                      1.16.0
charset-normalizer        3.2.0
click                     8.0.1
colorama                  0.4.6
cprint                    1.2.2
Eel                       0.16.0
Flask                     2.2.2
freetype-py               2.1.0.post1
future                    0.18.3
gevent                    23.9.1
gevent-websocket          0.10.1
glfw                      1.11.2
greenlet                  3.0.1
gunicorn                  20.1.0
hsluv                     5.0.4
idna                      3.4
itsdangerous              2.1.2
Jinja2                    3.1.2
kiwisolver                1.4.5
MarkupSafe                2.1.1
mypy                      1.6.1
mypy-extensions           1.0.0
numpy                     1.26.0
p5                        0.8.2
packaging                 23.2
pefile                    2023.2.7
Pillow                    9.0.1
pip                       23.3.1
pybind11                  2.11.1
pycparser                 2.21
pyinstaller               6.2.0
pyinstaller-hooks-contrib 2023.10
PyOpenGL                  3.1.6
PyOpenGL-accelerate       3.1.6
pyp5js                    0.7.3
pyparsing                 3.1.1
python-decouple           3.6
python-slugify            6.1.2
pywin32-ctypes            0.2.2
requests                  2.31.0
setuptools                58.1.0
skia-python               87.5
text-unidecode            1.3
tomli                     2.0.1
Transcrypt                3.9.0
typing_extensions         4.8.0
urllib3                   2.0.5
vispy                     0.10.0
watchdog                  2.1.9
Werkzeug                  3.0.1
whichcraft                0.6.1
zope.event                5.0
zope.interface            6.1
@Juhhxx Juhhxx added the bug Something isn't working label Nov 17, 2023
Copy link

👋 Hi, just a reminder that if you haven't read the help post yet, give it a read to see if your issue is covered in it and make sure to follow the debugging section.

Also please note, as stated in the README, if your issue is only associated with your application and not auto-py-to-exe itself, please do not create an issue in this repository - instead, comment on the help post, video or create a new discussion.

@brentvollebregt
Copy link
Owner

This looks like a classic case of PyInstaller not detecting a "hidden" import. Potentially this could be fixed by adding "glfw" to "--hidden-import" in the advanced section.

@brentvollebregt brentvollebregt removed the bug Something isn't working label Nov 17, 2023
@Juhhxx
Copy link
Author

Juhhxx commented Nov 17, 2023

already did that as I said in the post!!

I've already tried to put it in the hidden imports section and it gives me this message :

@Juhhxx Juhhxx removed their assignment Nov 17, 2023
@brentvollebregt
Copy link
Owner

My bad, I didn't see any reproduction steps so had assumed you didn't try that. 

Could you provide the "Current Command" generated at the bottom of the UI before you package and the build output.

Also when you package it into one directory, are you able to see the glfw library inside the folder? Should be with the other external dependency folders.

@Juhhxx
Copy link
Author

Juhhxx commented Nov 17, 2023

Sorry for no putting the steps, my bad there!

Could you provide the "Current Command" generated at the bottom of the UI before you package and the build output.

Of course I can show it, here it is:

Running auto-py-to-exe v2.42.0
Building directory: C:\Users\count\AppData\Local\Temp\tmp2or06k00
Provided command: pyinstaller --noconfirm --onedir --windowed --hidden-import "glfw"  "C:/Users/count/Desktop/minesweeper_p5/minesweeper.py"
Recursion Limit is set to 5000
Executing: pyinstaller --noconfirm --onedir --windowed --hidden-import glfw C:/Users/count/Desktop/minesweeper_p5/minesweeper.py --distpath C:\Users\count\AppData\Local\Temp\tmp2or06k00\application --workpath C:\Users\count\AppData\Local\Temp\tmp2or06k00\build --specpath C:\Users\count\AppData\Local\Temp\tmp2or06k00

56702 INFO: PyInstaller: 6.2.0
56713 INFO: Python: 3.10.1
56750 INFO: Platform: Windows-10-10.0.19045-SP0
56763 INFO: wrote C:\Users\count\AppData\Local\Temp\tmp2or06k00\minesweeper.spec
56797 INFO: Extending PYTHONPATH with paths
['C:\\Users\\count\\Desktop\\minesweeper_p5']
57502 INFO: checking Analysis
57508 INFO: Building Analysis because Analysis-00.toc is non existent
57523 INFO: Initializing module dependency graph...
57544 INFO: Caching module graph hooks...
57705 INFO: Analyzing base_library.zip ...
58785 INFO: Loading module hook 'hook-encodings.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks'...
59920 INFO: Loading module hook 'hook-heapq.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks'...
63086 INFO: Loading module hook 'hook-pickle.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks'...
68181 INFO: Caching module dependency graph...
68456 INFO: Running Analysis Analysis-00.toc
68473 INFO: Looking for Python shared library...
68501 INFO: Using Python shared library: C:\Program Files\Python310\python310.dll
68505 INFO: Analyzing C:\Users\count\Desktop\minesweeper_p5\minesweeper.py
68623 INFO: Loading module hook 'hook-numpy.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\numpy\\_pyinstaller'...
71168 INFO: Loading module hook 'hook-difflib.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks'...
71820 INFO: Loading module hook 'hook-multiprocessing.util.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks'...
72323 INFO: Loading module hook 'hook-xml.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks'...
74389 INFO: Loading module hook 'hook-platform.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks'...
74463 INFO: Loading module hook 'hook-sysconfig.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks'...
79289 INFO: Loading module hook 'hook-OpenGL.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
89316 INFO: Loading module hook 'hook-xml.etree.cElementTree.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks'...
90829 INFO: Processing pre-safe import module hook distutils from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-distutils.py'.
90837 INFO: Processing pre-find module path hook distutils from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
90846 INFO: Loading module hook 'hook-distutils.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks'...
93822 INFO: Loading module hook 'hook-PIL.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks'...
93995 INFO: Loading module hook 'hook-PIL.Image.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks'...
94955 INFO: Loading module hook 'hook-pycparser.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
95984 INFO: Loading module hook 'hook-setuptools.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks'...
97412 INFO: Loading module hook 'hook-distutils.util.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks'...
98165 INFO: Loading module hook 'hook-pkg_resources.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks'...
101022 INFO: Loading module hook 'hook-PIL.ImageFilter.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks'...
103524 INFO: Loading module hook 'hook-charset_normalizer.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
103751 INFO: Loading module hook 'hook-certifi.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
104075 INFO: Processing module hooks...
104412 INFO: Loading module hook 'hook-OpenGL_accelerate.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
105201 INFO: Loading module hook 'hook-PIL.SpiderImagePlugin.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks'...
105515 INFO: Processing pre-safe import module hook win32com from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\pre_safe_import_module\\hook-win32com.py'.
106231 INFO: Loading module hook 'hook-packaging.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks'...
106772 INFO: Loading module hook 'hook-setuptools.msvc.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks'...
107845 INFO: Looking for ctypes DLLs
108188 WARNING: Library glfw3.dll required via ctypes not found
108238 INFO: Analyzing run-time hooks ...
108255 INFO: Including run-time hook 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_inspect.py'
108293 INFO: Including run-time hook 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgutil.py'
108329 INFO: Processing pre-find module path hook _pyi_rth_utils from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-_pyi_rth_utils.py'.
108353 INFO: Loading module hook 'hook-_pyi_rth_utils.py' from 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks'...
108359 INFO: Including run-time hook 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py'
108394 INFO: Including run-time hook 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_setuptools.py'
108417 INFO: Including run-time hook 'C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgres.py'
108501 INFO: Looking for dynamic libraries
110509 INFO: Extra DLL search directories (AddDllDirectory): ['C:\\Users\\count\\AppData\\Roaming\\Python\\Python310\\site-packages\\numpy.libs']
110521 INFO: Extra DLL search directories (PATH): []
112196 INFO: Warnings written to C:\Users\count\AppData\Local\Temp\tmp2or06k00\build\minesweeper\warn-minesweeper.txt
112569 INFO: Graph cross-reference written to C:\Users\count\AppData\Local\Temp\tmp2or06k00\build\minesweeper\xref-minesweeper.html
112758 INFO: checking PYZ
112776 INFO: Building PYZ because PYZ-00.toc is non existent
112782 INFO: Building PYZ (ZlibArchive) C:\Users\count\AppData\Local\Temp\tmp2or06k00\build\minesweeper\PYZ-00.pyz
115471 INFO: Building PYZ (ZlibArchive) C:\Users\count\AppData\Local\Temp\tmp2or06k00\build\minesweeper\PYZ-00.pyz completed successfully.
115587 INFO: checking PKG
115601 INFO: Building PKG because PKG-00.toc is non existent
115616 INFO: Building PKG (CArchive) minesweeper.pkg
115725 INFO: Building PKG (CArchive) minesweeper.pkg completed successfully.
115745 INFO: Bootloader C:\Users\count\AppData\Roaming\Python\Python310\site-packages\PyInstaller\bootloader\Windows-64bit-intel\runw.exe
115757 INFO: checking EXE
115773 INFO: Building EXE because EXE-00.toc is non existent
115778 INFO: Building EXE from EXE-00.toc
115799 INFO: Copying bootloader EXE to C:\Users\count\AppData\Local\Temp\tmp2or06k00\build\minesweeper\minesweeper.exe
116096 INFO: Copying icon to EXE
116228 INFO: Copying 0 resources to EXE
116246 INFO: Embedding manifest in EXE
116378 INFO: Appending PKG archive to EXE
116421 INFO: Fixing EXE headers
117090 INFO: Building EXE from EXE-00.toc completed successfully.
117104 INFO: checking COLLECT
117116 INFO: Building COLLECT because COLLECT-00.toc is non existent
117131 INFO: Building COLLECT COLLECT-00.toc
117490 INFO: Building COLLECT COLLECT-00.toc completed successfully.

Moving project to: C:\Users\count\Desktop\minesweeper_p5(exe)
Complete.

Also when you package it into one directory, are you able to see the glfw library inside the folder? Should be with the other external dependency folders.

Actually no, idk why but all the other dependencies are there except glfw, I have it installed and in my environment variables so it's kinda weird

@brentvollebregt
Copy link
Owner

brentvollebregt commented Nov 18, 2023

Actually no, idk why but all the other dependencies are there except glfw, I have it installed and in my environment variables so it's kinda weird

Hmm, that's odd. Could you run this in PowerShell and make sure glfw is in this list,

& "C:/Users/count/AppData/Roaming/Python/Python310/python.exe" -m pip list

Could you also try adding "glfw" to --collect-all in the advanced tab - this will pick up binaries missing but the fact this library isn't showing up in the exe hints this might not fix it.

Also this isn't an auto-py-to-exe issue directly btw, this issue lies around PyInstaller (but isn't PyInstaller's fault - more around how the libraries are setup). Still happy to offer my knowledge around the subject though!

@Juhhxx
Copy link
Author

Juhhxx commented Nov 23, 2023

it worked! thank you!

@Juhhxx Juhhxx closed this as completed Nov 23, 2023
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

2 participants