Error: Kivy- Unable to find a valuable window provider

691 views
Skip to first unread message

markR

unread,
May 7, 2022, 9:33:50 AM5/7/22
to Kivy users support
After  using pyinstaller to create a bundled app, running it gives above error. 
Search results say to: pip install docutils pygments  pypiwin32 kivy.deps.sdl2 kivy.deps.glew .
Elliot, as you have been shepparding me on this install creation; would you recommend above as a first step or should i look at something else?


Elliot Garbus

unread,
May 7, 2022, 11:41:30 AM5/7/22
to kivy-...@googlegroups.com

Are you running pysintaller from the activated venv?  Does the program run properly from the activated venv?

 

If not, activate the venv, and install kivy per the directions on the web site.

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/20381e3e-8d53-4fd7-ac51-43e8c7332ed7n%40googlegroups.com.

 

markR

unread,
May 7, 2022, 1:45:34 PM5/7/22
to Kivy users support
There is a pyinstaller folder in my site packages in the environment i am working in. The environment was activated when i attempted to use pyinstaller. That makes me want to say -Yes. 

The program runs fine in the venv.

I will make another attempt at kivy install and let you know. What confuses me is there exists folders already for kivy, all the _deps, garden, and dist_info.

markR

unread,
May 7, 2022, 10:33:14 PM5/7/22
to Kivy users support
So I made sure environment was activated.
I uninstalled kivy
I reinstalled kivy: python -m pip install "kivy[base]" kivy_examples- successful
I uninstalled: docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew; 
I reinstalled: python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew; -successful
I ran pyinstaller : pyinstaller Bovine25.py

Still same error!

Gleening pyinstaller output i included below questionable comments. 
Do you see any show stoppers?
I noticed a couple of duplicates which may or may not mean anything.




[WARNING] [Could not find GStreamer plugins. Possible solution] set GST_PLUGIN_PATH
13756 WARNING: Could not find GStreamer plugins. Possible solution: set GST_PLUGIN_PATH

[CRITICAL] [Camera      ] Unable to find any valuable Camera provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes
picamera - ModuleNotFoundError: No module named 'picamera'

gi - ModuleNotFoundError: No module named 'gi'

opencv - ModuleNotFoundError: No module named 'cv2'

[CRITICAL] [Spelling    ] Unable to find any valuable Spelling provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes
enchant - ModuleNotFoundError: No module named 'enchant'

25746 WARNING: Hidden import "pkg_resources.py2_warn" not found!
25746 WARNING: Hidden import "pkg_resources.markers" not found!

[CRITICAL] [Camera      ] Unable to find any valuable Camera provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes
picamera - ModuleNotFoundError: No module named 'picamera'

gi - ModuleNotFoundError: No module named 'gi'

opencv - ModuleNotFoundError: No module named 'cv2'

922 CRITICAL: Camera: Unable to find any valuable Camera provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes
picamera - ModuleNotFoundError: No module named 'picamera'

gi - ModuleNotFoundError: No module named 'gi'

opencv - ModuleNotFoundError: No module named 'cv2'

[CRITICAL] [Spelling    ] Unable to find any valuable Spelling provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes
enchant - ModuleNotFoundError: No module named 'enchant'

1087 CRITICAL: Spelling: Unable to find any valuable Spelling provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes
enchant - ModuleNotFoundError: No module named 'enchant'

2457 WARNING: lib not found: glib-2.0-0.dll dependency of C:\Users\marka\PythonEnv\Bovine25env\lib\site-packages\kivy\lib\gstplayer\_gstplayer.cp39-win_amd64.pyd
2471 WARNING: lib not found: gstreamer-1.0-0.dll dependency of C:\Users\marka\PythonEnv\Bovine25env\lib\site-packages\kivy\lib\gstplayer\_gstplayer.cp39-win_amd64.pyd
2475 WARNING: lib not found: gobject-2.0-0.dll dependency of C:\Users\marka\PythonEnv\Bovine25env\lib\site-packages\kivy\lib\gstplayer\_gstplayer.cp39-win_amd64.pyd



On Saturday, May 7, 2022 at 11:41:30 AM UTC-4 ElliotG wrote:

Elliot Garbus

unread,
May 7, 2022, 10:43:35 PM5/7/22
to kivy-...@googlegroups.com

Uninstall: docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew; 

Uninstall kivy

 

Then install kivy… it will install the appropriate dependencies:

python -m pip install "kivy[base]" kivy_examples

 

and give it a try.

 

In my experience the most useful errors are the errors in the kivy log file.

markR

unread,
May 8, 2022, 8:59:43 AM5/8/22
to Kivy users support
After following exact sequence as listed above I continue to get the same error.
Is it important to note that while pyinstaller was doing its thing- a blank kivy screen popped up for a split second but immediately went away?
I have looked around for this kivy log file but I am not experienced enough to locate it. You might direct me on some there.
thanks

Elliot Garbus

unread,
May 8, 2022, 11:29:49 AM5/8/22
to kivy-...@googlegroups.com

Wow that is frustrating.

 

Here is the location of the kivy log files: C:\Users\YourUserNane\.kivy\logs

It is normal for the Window to pop up and close when pyinstaller is running.

 

Looking at the top of the spec file you will see:

 

a = Analysis(['../main.py'],
            
pathex=[],
            
binaries=[],
            
datas=[('../*.kv', '.'),
                    (
'../Images/*.png', './Images')],

Is main.py the name of your main python code?  If not change the name in your spec file.

The spec file uses relative paths and assumes the specfile is in  a directory under the project directory.

 

I usually have a structure like this:

MYPROJECT – directory

    MYProjectDist

        W10.spec – the spec file

    Images – Directory for Images

    main.py – python and kv files are under MYPROJECT

    my.kv

    other.py

markR

unread,
May 8, 2022, 4:33:06 PM5/8/22
to Kivy users support
In my environment folder the python app is named Bovine25 which is indicated as a PY file.
In the dist folder pyinstaller created a folder called Bovine25
    in the Bovine25 folder the application name is Bovine25- the one with the python icon

Here is my .spec
a = Analysis(
    ['Bovine25.py'],
    pathex=[],
    binaries=[],
    datas=[],
    hiddenimports=[],
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    win_no_prefer_redirects=False,
    win_private_assemblies=False,
    cipher=block_cipher,
    noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

exe = EXE(
    pyz,
    a.scripts,
    [],
    exclude_binaries=True,
    name='Bovine25',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    console=True,
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
)
coll = COLLECT(
    exe,
    a.binaries,
    a.zipfiles,
    a.datas,
    strip=False,
    upx=True,
    upx_exclude=[],
    name='Bovine25',
)

Here is the .kivy log
[INFO   ] Logger: Record log in C:\Users\marka\.kivy\logs\kivy_22-05-08_17.txt
[INFO   ] Kivy: v2.1.0
[INFO   ] Kivy: Installed at "C:\Users\marka\PythonEnv\Bovine25env\dist\Bovine25\kivy\__init__.pyc"
[INFO   ] Python: v3.9.12 (tags/v3.9.12:b28265d, Mar 23 2022, 23:52:46) [MSC v.1929 64 bit (AMD64)]
[INFO   ] Python: Interpreter at "C:\Users\marka\PythonEnv\Bovine25env\dist\Bovine25\Bovine25.exe"
[INFO   ] Logger: Purge log fired. Processing...
[INFO   ] Logger: Purge finished!
[INFO   ] Factory: 189 symbols loaded
[INFO   ] Image: Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored)
[INFO   ] Text: Provider: sdl2
[INFO   ] Window: Provider: sdl2
[INFO   ] GL: Using the "OpenGL" graphics system
[INFO   ] GL: GLEW initialization succeeded
[INFO   ] GL: Backend used <glew>
[INFO   ] GL: OpenGL version <b'4.6.0 - Build 27.20.100.9365'>
[INFO   ] GL: OpenGL vendor <b'Intel'>
[INFO   ] GL: OpenGL renderer <b'Intel(R) UHD Graphics'>
[INFO   ] GL: OpenGL parsed version: 4, 6
[INFO   ] GL: Shading version <b'4.60 - Build 27.20.100.9365'>
[INFO   ] GL: Texture max size <16384>
[INFO   ] GL: Texture max units <32>
[WARNING] Image: Unable to load image <C:\Users\marka\PythonEnv\Bovine25env\dist\Bovine25\kivy_install\data\glsl\default.png>
[CRITICAL] Window: Unable to find any valuable Window provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes
sdl2 - Exception: SDL2: Unable to load image
  File "kivy\core\__init__.py", line 71, in core_select_lib
  File "kivy\core\window\window_sdl2.py", line 165, in __init__
  File "kivy\core\window\__init__.py", line 1071, in __init__
  File "kivy\core\window\window_sdl2.py", line 362, in create_window
  File "kivy\core\window\__init__.py", line 1450, in create_window
  File "kivy\graphics\instructions.pyx", line 797, in kivy.graphics.instructions.RenderContext.__init__
  File "kivy\core\image\__init__.py", line 561, in __init__
  File "kivy\core\image\__init__.py", line 754, in _set_filename
  File "kivy\core\image\__init__.py", line 460, in load
  File "kivy\core\image\__init__.py", line 223, in __init__
  File "kivy\core\image\img_sdl2.py", line 47, in load

[CRITICAL] App: Unable to get a Window, abort.


Hope this can shed some light on what I am doing wrong. 
thanks

Elliot Garbus

unread,
May 8, 2022, 5:31:24 PM5/8/22
to kivy-...@googlegroups.com

I suspect we have a directories path issue…

C:\Users\marka\PythonEnv\Bovine25env\dist\Bovine25\kivy_install\data\glsl\default.png

Have you nested virtual environments?

 

FWIW here is the directory structure of a program I’m working on:

The full project path:  C:\Users\ellio\PycharmProjects\ME-Surgeon

Note below the venv is a subdirectory of the project.  It does not need to be.

 

As you can see, I put the spec files in ME-Dist. I switch to that directory to run pyinstaller.

 

markR

unread,
May 8, 2022, 9:58:29 PM5/8/22
to Kivy users support
The PythonEnv folder is not an environment. It is where I will store all the different environments I might create in the future as well. Bovine25env is a venv. So looking at what you do you separate the build and dist folders from the venv even though pyinstaller creates them there.
So my thoughts are to create a project folder above the venv(Bovine25env) folder and move the build and dist files into it. Is that what you are recommending? 

Elliot Garbus

unread,
May 8, 2022, 10:34:43 PM5/8/22
to kivy-...@googlegroups.com

Because I put the spec file in ME-Dist, and cd to that directory to run pyinstaller, that is where the build and dist directories are created.

I would not recommend putting your code files in the venv directory.  Make your venv a subdirectory of the project (as below) or just another directory.  I put my code up on GitHub, but not the venv.

markR

unread,
May 9, 2022, 3:48:33 PM5/9/22
to Kivy users support
Ok, so based on above, I just started fresh and created a new project folder, created its own venv folder(python -m venv CattleMgt-venv), etc. as below and copied my .py and data files over:

CattleMgt
    CattleMgt-dist
    CattleMgt-venv
    Bovine25.py
    -------------.py
    ----------.py
    -------.db

I cd to venv folder
I activated this environment
I installed kivy per docs
I tried to run pyinstaller but it's name was not recognized
I uninstalled pyinstaller from the python39\site_packages
I reinstalled pyinstaller
I cd to my CattleMgt-dist folder
I ran pyinstaller Bovine25.py but it could not find Bovine25.py
I cd back CattleMgt folder, ran pyinstaller and it ran as it has been. created a build and dist folder in CattleMgt folder.
Ran from cmd prompt and got the same error.

So if getting the build and dist folders to be created in my CattleMgt-dist folder is the key; how do i do that without moving my .py files into the same folder?
From what I can figure out, the spec file is not created until pyinstaller runs so i can not pre-put that in anyfolder. 
LOST.

Elliot Garbus

unread,
May 9, 2022, 4:00:53 PM5/9/22
to kivy-...@googlegroups.com

You might want to find a resource on venv.  I’m at a loss to suggest something useful.

 

I never cd into the venv.

I activate it from the working directory.  I pip install from there.

 

I would put the spec file into CattleMgt-dist

Cd in CattleMgt-dist

Pyinstaller yourspecfile.spec

 

You will need to change the path as appropriate in your spec file if you spec file is not in the same dir as your .py files.

markR

unread,
May 9, 2022, 6:50:26 PM5/9/22
to Kivy users support
Thanks, I am not giving up yet.
Clarification on something you indicated above, I pyinstaller myApp.py not the .spec file. Do I need to be doing something different here?

Elliot Garbus

unread,
May 9, 2022, 6:56:47 PM5/9/22
to kivy-...@googlegroups.com
Run pyinstaller using the spec file!
>pyinstaller myspecfile.spec

Sent from my iPhone

On May 9, 2022, at 3:50 PM, markR <markandla...@gmail.com> wrote:



markR

unread,
May 15, 2022, 8:59:42 PM5/15/22
to Kivy users support
Issue Resolved:
Do not ever assume you have a "simple" app and can just run pyinstaller against the .py and be off to the races- you will be off in the weeds.
To correct the initial issue of not having a windows provider; in the .spec file  I had to import sdl2 and glew. Also, not understanding why-just followed directions, and in coll(collect) added *{Tree(p) for p in (sdl2.dep_bins +glew.dep_bins)].
Following, it could not find my db even though it was in the folder. I thought it would find it like it did when running it out of environment. I had to add it in the datas=. What a arduous learning experience.
Thanks Elliot for getting me to think about the .spec file.

Elliot Garbus

unread,
May 15, 2022, 11:16:44 PM5/15/22
to kivy-...@googlegroups.com

Glad to hear you got it working!

Reply all
Reply to author
Forward
0 new messages