Kivy: Kivy sdl2 DLL Load failed

Created on 26 Mar 2018  ·  29Comments  ·  Source: kivy/kivy

  • Python: 3.6.4
  • OS: Windows 10
  • Kivy: 1.10.0
  • Kivy installation method:
    python -m pip install --upgrade pip wheel setuptools
    python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew
    python -m pip install kivy.deps.gstreamer
    python -m pip install kivy.deps.angle
    python -m pip install kivy
    python -m pip install kivy_examples
    python -m pip install Pillow
    python -m pip install cython
    python -m pip install PyEnchant

Description

Hi, I am trying to run the example code from the install Kivy. The following is the error I receive back. Any help would be great. I have tried looking at previous enquiries about similar problems, but nothing suggested on them has worked so far.

[INFO   ] [Logger      ] Record log in C:\Users\DoddJ\.kivy\logs\kivy_18-03-26_52.txt
[INFO   ] [Kivy        ] v1.10.0
[INFO   ] [Python      ] v3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)]
[INFO   ] [Factory     ] 194 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_pil, img_gif (img_sdl2, img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: pil(['text_sdl2'] ignored)
[CRITICAL] [Window      ] Unable to find any valuable Window provider.
sdl2 - ImportError: DLL load failed: The specified module could not be found.
  File "C:\Users\dev.DoddJ\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\core\__init__.py", line 59, in core_select_lib
    fromlist=[modulename], level=0)
  File "C:\Users\dev.DoddJ\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\core\window\window_sdl2.py", line 26, in <module>
    from kivy.core.window._window_sdl2 import _WindowSDL2Storage

[CRITICAL] [App         ] Unable to get a Window, abort.
 Exception ignored in: 'kivy.properties.dpi2px'
 Traceback (most recent call last):
   File "C:\Users\dev.DoddJ\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\utils.py", line 496, in __get__
     retval = self.func(inst)
   File "C:\Users\dev.DoddJ\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\metrics.py", line 174, in dpi
     EventLoop.ensure_window()
   File "C:\Users\dev.DoddJ\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\base.py", line 127, in ensure_window
     sys.exit(1)
 SystemExit: 1
[CRITICAL] [App         ] Unable to get a Window, abort.

Code and Logs

Code that I am trying to run:

import kivy
kivy.require('1.10.0') # replace with your current kivy version !

from kivy.app import App
from kivy.uix.label import Label


class MyApp(App):

    def build(self):
        return Label(text='Hello world')


if __name__ == '__main__':
    MyApp().run()
documentation Windows

Most helpful comment

Well,

some further testing reveals that it functions correctly if BOTH kivy.deps.glew AND kivy.deps.sdl2 are installed in Administrator mode.

I think the problem lies with too much being hardcoded into site-packages\kivy\deps\*\__init__.py

I wonder if there's a more canonical way to add DLLs from Pip packages into the PATH...?

All 29 comments

what does this say on your system (PowerShell):

python -m pip freeze | select-string cython

@dolang it says
'select-string' is not recognized as an internal or external command,
operable program or batch file.

yeah, sorry that wasn't clear. You need to execute that in PowerShell. It's the replacement for the DOS prompt.

Use Win + x then select it, or type powershell at the command prompt. You will have PS as the first 2 letter of the prompt.

Oh okay. In the powershell it says

Cython==0.27.3

Alright, tried to reproduce it with a similar not same environment without luck. Bascially, what the error says is that the sdl2 library is missing. But it should've been installed with python -m pip install kivy.deps.sdl2 which is in your original description somewhere.

I'll have to try reproducing this on another machine again, you could try to pip uninstall ... + pip install ... that dependency in the meantime.

Tried on another machine now, getting the same result (i.e. it works here). What do you have for:

PS  C:\> python -m pip freeze | select-string sdl2

it should give you: kivy.deps.sdl2==0.1.17.

Alternatively, if you have several Python interpreters installed:

PS  C:\> py -3.6 -m pip freeze | select-string sdl2

If one of these two commands doesn't give you the output above, try reinstalling kivy.deps.sdl2.

If they do and it doesn't work, please paste what you get with:

PS C:\> dir C:\Users\dev.DoddJ\AppData\Local\Programs\Python\Python36-32\share\sdl2\bin

Maybe you have to reinstall the 64-bit Python interpreter. (Just a guess, not sure yet.)

I did that and

get kivy.deps.sdl2==0.1.17

I have uninstalled 32-bit and installed 64-bit Python in its place, however, still get this error

H:\untitled2\Scripts\python.exe "C:/Users/DoddJ/PycharmProjects/untitled/KIVY TEST.py"
[INFO   ] [Logger      ] Record log in C:\Users\DoddJ\.kivy\logs\kivy_18-03-28_40.txt
[INFO   ] [Kivy        ] v1.10.0
[INFO   ] [Python      ] v3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)]
[INFO   ] [Factory     ] 194 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_pil, img_gif (img_sdl2, img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: pil(['text_sdl2'] ignored)
[CRITICAL] [Window      ] Unable to find any valuable Window provider.

[CRITICAL] [App         ] Unable to get a Window, abort.
 Exception ignored in: 'kivy.properties.dpi2px'
 Traceback (most recent call last):
   File "C:\Users\dev.DoddJ\AppData\Local\Programs\Python\Python36\lib\site-packages\kivy\utils.py", line 496, in __get__
     retval = self.func(inst)
   File "C:\Users\dev.DoddJ\AppData\Local\Programs\Python\Python36\lib\site-packages\kivy\metrics.py", line 174, in dpi
     EventLoop.ensure_window()
   File "C:\Users\dev.DoddJ\AppData\Local\Programs\Python\Python36\lib\site-packages\kivy\base.py", line 127, in ensure_window
     sys.exit(1)
 SystemExit: 1
[CRITICAL] [App         ] Unable to get a Window, abort.

Process finished with exit code 1

Well, I wasn't sure if 32/64-bit could be the problem here. But can you look if the .dll is actually there?

PS C:\> dir C:\Users\dev.DoddJ\AppData\Local\Programs\Python\Python36\share\sdl2\bin

If it's there, maybe your virus scanner is blocking it, or your firewall (or some other really intrusive software)? This is not something that should happen, imho.

Edit: had a look at my installation again and opened a running application in Process Hacker. This SDL2.dll is custom-built for PyPI and it looks like it's unsigned. Depending on your Windows policy settings, it could be blocked automatically because of that. Maybe the following can help?

Windows 10: Unblock File in Windows 10

According to earlier comment, you have cython 0.27.3 and the console log says Kivy v1.10.0 ... those versions are not compatible, though I'm not sure exactly why the missing window provider is the first clue to this problem.... Maybe try either using cython 0.25.2 (compatible with 1.10) + reinstall kivy, or alternatively pip install kivy==master with your current cython version?

I am getting this issue also with Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32

````
C:> python3 -m pip show kivy kivy.deps.glew kivy.deps.sdl2
Name: Kivy
Version: 1.10.0
Summary: A software library for rapid development of hardware-accelerated multitouch applications.
Home-page: http://kivy.org
Author: Kivy Team and other contributors
Author-email: [email protected]
License: MIT
Location: c:\users\jedingtoappdata\roaming\python\python36\site-packages
Requires: docutils, Kivy-Garden, pygments

Required-by:

Name: kivy.deps.glew
Version: 0.1.9
Summary: Repackaged binary dependency of Kivy.
Home-page: http://kivy.org/
Author: Kivy Crew
Author-email: [email protected]
License: MIT
Location: c:\users\jedingtoappdata\roaming\python\python36\site-packages
Requires:

Required-by:

Name: kivy.deps.sdl2
Version: 0.1.17
Summary: Repackaged binary dependency of Kivy.
Home-page: http://kivy.org/
Author: Kivy Crew
Author-email: [email protected]
License: zlib
Location: c:\users\jedingtoappdata\roaming\python\python36\site-packages
Requires:
Required-by:
````

running it gives the following:

````
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

from kivy.app import App
[INFO ] [Logger ] Record log in C:\Users\jedingto.kivy\logs\kivy_18-05-17_4.txt
[INFO ] [Kivy ] v1.10.0
[INFO ] [Python ] v3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)]
[INFO ] [Factory ] 194 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_gif (img_sdl2, img_pil, img_ffpyplayer ignored)
from kivy.uix.widget import Widget
class PongGame(Widget):
... pass
...
class PongApp(App):
... def build(self):
... return PongGame()
...
PongApp().run()
[CRITICAL] [Window ] Unable to find any valuable Window provider.
sdl2 - ImportError: DLL load failed: The specified module could not be found.
File "C:\Users\jedingtoAppData\Roaming\Python\Python36\site-packages\kivy\core__init__.py", line 59, in core_select_lib
fromlist=[modulename], level=0)
File "C:\Users\jedingtoAppData\Roaming\Python\Python36\site-packages\kivy\core\window\window_sdl2.py", line 26, in
from kivy.core.window._window_sdl2 import _WindowSDL2Storage

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

Despite the existence of the SDL2 DLL:

````
dir %AppData%\Python\sharesdl2\bin\SDL2.dll
Volume in drive C is XXXXXX
Volume Serial Number is 0000-0000

Directory of C:\Users\USERAppData\Roaming\Python\sharesdl2\bin

2018-05-17 11:33 AM 1,254,400 SDL2.dll
1 File(s) 1,254,400 bytes
0 Dir(s) 161,199,689,728 bytes free
````

and I should add that this occurs even if I uninstall kivy.deps.sdl from --user mode and install it into C:\Program Files\Python\share\sdl2 via Administrator Mode, the error is the same:

````

PongApp().run()
[CRITICAL] [Window ] Unable to find any valuable Window provider.
sdl2 - ImportError: DLL load failed: The specified module could not be found.
File "C:\Users\jedingtoAppData\Roaming\Python\Python36\site-packages\kivy\core__init__.py", line 59, in core_select_lib
fromlist=[modulename], level=0)
File "C:\Users\jedingtoAppData\Roaming\Python\Python36\site-packages\kivy\core\window\window_sdl2.py", line 26, in
from kivy.core.window._window_sdl2 import _WindowSDL2Storage

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

````

It doesn't even work if I cd right into the directory next to SDL2.dll before running python3

Alright, there are several things at play here:

  1. the .dll has to exist in that directory
  2. the file ...\site-packages\kivy\deps\sdl2\__init__.py gets loaded and points at the .dll
  3. Windows (or some other intrusive software like some virus scanners) itself doesn't block loading it

So far I've been unable to reproduce it, but 3. is something that can't be excluded.

Another thing you could try: open a command prompt and point the PATH directly at the sdl2 folder. Something like:

\> set PATH=C:\Users\USER\AppData\Roaming\Python\share\sdl2\bin;%PATH%

@dolang Well, it seems that adding the SDL2.dll folder to the %PATH% fixes....part of that error. img_sdl2 is now no longer "ignored", but it's still "Unable to find any valuable Window provider". It also gave some slightly different (almost exclusively expanded?) error message

[INFO ] [Logger ] Record log in C:\Users\jedingto\.kivy\logs\kivy_18-05-17_15.txt [INFO ] [Kivy ] v1.10.0 [INFO ] [Python ] v3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] [INFO ] [Factory ] 194 symbols loaded [INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored) [INFO ] [OSC ] using <thread> for socket [INFO ] [Window ] Provider: sdl2 [CRITICAL] [Window ] Unable to find any valuable Window provider. sdl2 - ImportError: DLL load failed: The specified module could not be found. File "C:\Users\jedingto\AppData\Roaming\Python\Python36\site-packages\kivy\core\__init__.py", line 67, in core_select_lib cls = cls() File "C:\Users\jedingto\AppData\Roaming\Python\Python36\site-packages\kivy\core\window\window_sdl2.py", line 140, in __init__ super(WindowSDL, self).__init__() File "C:\Users\jedingto\AppData\Roaming\Python\Python36\site-packages\kivy\core\window\__init__.py", line 899, in __init__ self.create_window() File "C:\Users\jedingto\AppData\Roaming\Python\Python36\site-packages\kivy\core\window\window_sdl2.py", line 269, in create_window self.fullscreen, resizable, state) File "kivy\core\window\_window_sdl2.pyx", line 110, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window (kivy\core/window\_window_sdl2.c:2466) File "kivy\graphics\cgl.pyx", line 52, in kivy.graphics.cgl.cgl_get_backend_name (kivy\graphics\cgl.c:3044) File "kivy\graphics\cgl.pyx", line 60, in kivy.graphics.cgl.cgl_get_backend_name (kivy\graphics\cgl.c:2879) File "C:\Program Files\Python36\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 658, in _load_unlocked File "<frozen importlib._bootstrap>", line 571, in module_from_spec File "<frozen importlib._bootstrap_external>", line 922, in create_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed

I confirmed by repeatedly adding and removing that from the PATH that the presence of img_sdl2 in the "ignored" section depends on that, and that the expanded error text appears or disappears depending on if it could find SDL2 or not.

Now, the glew dependency should have a folder right next to it (share\glew\bin). What happens if you add that too?

Aha!

So, on Windows, it can be "solved" by prepending %AppData%\Python\share\glew\bin;%AppData%\Python\share\sdl2\bin; to PATH:

cmd /C "PATH=%AppData%\Python\share\glew\bin;%AppData%\Python\share\sdl2\bin;%PATH% && python3 -c ^"from kivy.core.window._window_sdl2 import _WindowSDL2Storage^""

But unfortunately this is not a solution per se

How ARE the pip-installed-python-libraries supposed to make their way into the PATH which they must be in to function? (A reboot was insufficient)

That was just a clue for me to find out whether the libraries are actually blocked or not. Good thing they aren't.

As said above (point 2.), you can see that if you open the __init__.py in site-packages\kivy\deps\..., but that should work out of the box. Now I need to find a way to break mine exactly like in your case. :smile:

Is this of any use?

````

import pdb
pdb.run()
KeyboardInterrupt
lamb
KeyboardInterrupt
pdb.run("from kivy.core.window._window_sdl2 import _WindowSDL2Storage")
(1)()
(Pdb) s
--Call--
(966)_find_and_load()
(Pdb)
(968)_find_and_load()
(Pdb)
--Call--
(143)__init__()
(Pdb)
(144)__init__()
(Pdb)
(145)__init__()
(Pdb)
--Return--
(145)__init__()->None
(Pdb)
--Call--
(147)__enter__()
(Pdb)
(148)__enter__()
(Pdb)
--Call--
(157)_get_module_lock()
(Pdb)
(163)_get_module_lock()
(Pdb)
(164)_get_module_lock()
(Pdb)
(165)_get_module_lock()
(Pdb)
(166)_get_module_lock()
(Pdb)
KeyError: 'kivy.core.window._window_sdl2'
(166)_get_module_lock()
(Pdb)
(167)_get_module_lock()
(Pdb)
(168)_get_module_lock()
(Pdb)
(170)_get_module_lock()
(Pdb)
(171)_get_module_lock()
(Pdb)
(174)_get_module_lock()
(Pdb)
--Call--
(58)__init__()
(Pdb)
(59)__init__()
(Pdb)
(60)__init__()
(Pdb)
(61)__init__()
(Pdb)
(62)__init__()
(Pdb)
(63)__init__()
(Pdb)
(64)__init__()
(Pdb)
--Return--
(64)__init__()->None
(Pdb)
(176)_get_module_lock()
(Pdb)
(187)_get_module_lock()
(Pdb)
(189)_get_module_lock()
(Pdb)
(191)_get_module_lock()
(Pdb)
--Return--
(191)_get_module_lock()->_ModuleLock('... 1869402554208
(Pdb)
(149)__enter__()
(Pdb)
--Call--
(78)acquire()
(Pdb)
(84)acquire()
(Pdb)
(85)acquire()
(Pdb)
(86)acquire()
(Pdb)
(87)acquire()
(Pdb)
(88)acquire()
(Pdb)
(89)acquire()
(Pdb)
(90)acquire()
(Pdb)
(91)acquire()
(Pdb)
(92)acquire()
(Pdb)
(101)acquire()
(Pdb)
KeyError: 12616
(101)acquire()
(Pdb)
--Return--
(101)acquire()->None
(Pdb)
KeyError: 12616
(149)__enter__()
(Pdb)
--Return--
(149)__enter__()->None
(Pdb)
KeyError: 12616
(968)_find_and_load()
(Pdb)
--Return--
(968)_find_and_load()->None
(Pdb)
KeyError: 12616
(1)()
(Pdb)
--Return--
(1)()->None
(Pdb)
KeyError: 12616
c:\program filespython36\lib\bdb.py(434)run()
-> exec(cmd, globals, locals)
(Pdb)
c:\program filespython36\lib\bdb.py(435)run()
-> except BdbQuit:
(Pdb)
c:\program filespython36\lib\bdb.py(438)run()
-> self.quitting = True
(Pdb)
Traceback (most recent call last):
File "", line 1, in
File "C:\Program Files\Python36\lib\pdb.py", line 1572, in run
Pdb().run(statement, globals, locals)
File "C:\Program Files\Python36\lib\bdb.py", line 434, in run
exec(cmd, globals, locals)
File "", line 1, in
File "", line 968, in _find_and_load
File "", line 149, in __enter__
File "", line 101, in acquire
KeyError: 12616
````

Well,

some further testing reveals that it functions correctly if BOTH kivy.deps.glew AND kivy.deps.sdl2 are installed in Administrator mode.

I think the problem lies with too much being hardcoded into site-packages\kivy\deps\*\__init__.py

I wonder if there's a more canonical way to add DLLs from Pip packages into the PATH...?

Good question, but I don't know how the team arrived at their current solution. At least we could narrow it down now, so that's a step forward.

By the way, are you familiar with virtualenv. I normally use those and rarely have problems. So for now you could do (admin):

py -m pip install virtualenv

Normal user account (.venv is my preferred name of the directory of the virtualenv, change as you like):

py -m virtualenv .venv
.venv\Scripts\activate
python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew
python -m pip install kivy

optionally add: python -m pip install kivy.deps.gstreamer

Hope I got that all right.

Configuration windows 10 python 363 (visual studio 2017):

[INFO   ] [Logger      ] Record log in C:\Users\Laurent\.kivy\logs\kivy_18-08-23_29.txt
[INFO   ] [Kivy        ] v1.10.1
[INFO   ] [Python      ] v3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)]
[INFO   ] [Factory     ] 194 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[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 NVIDIA 390.77'>
[INFO   ] [GL          ] OpenGL vendor <b'NVIDIA Corporation'>
[INFO   ] [GL          ] OpenGL renderer <b'GeForce GTX 970/PCIe/SSE2'>
[INFO   ] [GL          ] OpenGL parsed version: 4, 6
[INFO   ] [GL          ] Shading version <b'4.60 NVIDIA'>
[INFO   ] [GL          ] Texture max size <16384>
[INFO   ] [GL          ] Texture max units <32>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [Text        ] Provider: sdl2
Standard library module invoked user code during import; breakpoints disabled for invoked code.
[INFO   ] [Base        ] Start application main loop
[INFO   ] [GL          ] NPOT texture support is available
[WARNING] [Accordion   ] not enough space for displaying all children
[WARNING] [Accordion   ] need 132px, got 84px
[WARNING] [Accordion   ] layout aborted.
[WARNING] [Accordion   ] not enough space for displaying all children
[WARNING] [Accordion   ] need 132px, got 84px
[WARNING] [Accordion   ] layout aborted.
[INFO   ] [Base        ] Leaving application in progress...
The thread 'MainThread' (0x13ec) has exited with code 0 (0x0).

I 've got same issue and I solve it and my solution is not a good one. I copy all dlls (share/sdl2 share/angle share/glew share/gstreamer) in a repository and I add this repository to path variable.

I installed kivy using admin right (https://kivy.org/docs/installation/installation-windows.html) and i tried to run using user right (user laurent )then error happens : [CRITICAL] [Window ] Unable to find any valuable Window provider.
sdl2 - ImportError: DLL load failed: The specified module could not be found.

Copying all dlls in new folder solves issues. My question is then How can I install kivy to run kivy with user privilege ?

PS sorry I 'm not good in english and python

By the way, are you familiar with virtualenv. I normally use those and rarely have problems. So for now you could do (admin):

py -m pip install virtualenv

Normal user account (.venv is my preferred name of the directory of the virtualenv, change as you like):

py -m virtualenv .venv
.venv\Scripts\activate
python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew
python -m pip install kivy

I tried using virtualenv and it did not work. I still got a similar error. I also added C:\Program Files\Python37\share\sdl2\bin and C:\Program Files\Python37\share\angle\bin to my PATH already. And I did what I think @LaurentBerger did, copy those two files into another directory, and then add that directory to the path. Using virtualenv with the two PATH options did not work for me as well.

I'm using python 3.7 so I installed kivy.deps.angle instead of kivy.deps.glew

Logs:
```(venv) C:\Users\henry\Documents\Side Projects\fps>py main.py
[INFO ] [Logger ] Record log in C:\Users\henry.kivy\logs\kivy_18-09-15_16.txt
[INFO ] [Kivy ] v1.10.1
[INFO ] [Python ] v3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
[INFO ] [Factory ] 194 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
[INFO ] [Text ] Provider: sdl2
[INFO ] [Window ] Provider: sdl2
[CRITICAL] [Window ] Unable to find any valuable Window provider.
sdl2 - ImportError: DLL load failed: The specified module could not be found.
File "C:\Users\henry\DOCUME~1\SIDEPR~1\fps\venv\lib\site-packages\kivy\core__init__.py", line 67, in core_select_lib
cls = cls()
File "C:\Users\henry\DOCUME~1\SIDEPR~1\fps\venv\lib\site-packages\kivy\core\window\window_sdl2.py", line 140, in __init__
super(WindowSDL, self).__init__()
File "C:\Users\henry\DOCUME~1\SIDEPR~1\fps\venv\lib\site-packages\kivy\core\window__init__.py", line 968, in __init__
self.create_window()
File "C:\Users\henry\DOCUME~1\SIDEPR~1\fps\venv\lib\site-packages\kivy\core\window\window_sdl2.py", line 272, in create_window
self.fullscreen, resizable, state)
File "kivy\core\window_window_sdl2.pyx", line 125, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window
File "kivy\graphics\cgl.pyx", line 52, in kivy.graphics.cgl.cgl_get_backend_name
File "kivy\graphics\cgl.pyx", line 60, in kivy.graphics.cgl.cgl_get_backend_name
File "C:\Users\henry\DOCUME~1\SIDEPR~1\fps\venv\lib\importlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 670, in _load_unlocked
File "", line 583, in module_from_spec
File "", line 1043, in create_module
File "", line 219, in _call_with_frames_removed

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

On this issue, i've seen mixing libraries architectures (Python in 64 bits, SDL2 in 32 bits), so that's a first stop. And yes, if you mixed the arch, the libraries won't be used at all and Kivy won't work.
Installation of SDL2 via kivy.deps.sdl2 should works.

I am using python 3.7 and i am getting this error. kivy version is 1.10.1
how should i resolve it

same here python 3.7 , kivy version is 1.10.1 and tried all ways to load the DLL but shows no mercy.

https://stackoverflow.com/questions/49466785/kivy-error-python-2-7-sdl2-import-error/49477111#49477111

This Solve My Problem Which is The same one you Had
Hope this will help You

I had the same issue. This video may help those who are visual! https://youtu.be/gt-qndBYrCQ

Had many issues, but managed to work them out. Here's what I learned (using PyCharm):
1) You can't install Kivy on Python 3.8. If you have 3.8, go back to 3.7.
2) I installed all of the packages that someone else posted a picture of. I'll post mine here. Go to your project interpreter and hit the "+" button to add them all. They should successfully install.
pkg1
pkg2
3) Was getting the window sdl2 error. Watched this short video (https://www.youtube.com/watch?v=e_jv8KsYBrs&t=212s) (may God bless this person) and changed my paths in my system environment.
4) I then reinstalled the dependencies from the Kivy website -- AND IT WORKED!!!

Hope this helps someone!!!!

By the way, are you familiar with virtualenv. I normally use those and rarely have problems. So for now you could do (admin):

py -m pip install virtualenv

Normal user account (.venv is my preferred name of the directory of the virtualenv, change as you like):

py -m virtualenv .venv
.venv\Scripts\activate
python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew
python -m pip install kivy

I tried using virtualenv and it did not work. I still got a similar error. I also added C:\Program Files\Python37\share\sdl2\bin and C:\Program Files\Python37\share\angle\bin to my PATH already. And I did what I think @LaurentBerger did, copy those two files into another directory, and then add that directory to the path. Using virtualenv with the two PATH options did not work for me as well.

I'm using python 3.7 so I installed kivy.deps.angle instead of kivy.deps.glew

Logs:

[INFO   ] [Logger      ] Record log in C:\Users\henry\.kivy\logs\kivy_18-09-15_16.txt
[INFO   ] [Kivy        ] v1.10.1
[INFO   ] [Python      ] v3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
[INFO   ] [Factory     ] 194 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Window      ] Provider: sdl2
[CRITICAL] [Window      ] Unable to find any valuable Window provider.
sdl2 - ImportError: DLL load failed: The specified module could not be found.
  File "C:\Users\henry\DOCUME~1\SIDEPR~1\fps\venv\lib\site-packages\kivy\core\__init__.py", line 67, in core_select_lib
    cls = cls()
  File "C:\Users\henry\DOCUME~1\SIDEPR~1\fps\venv\lib\site-packages\kivy\core\window\window_sdl2.py", line 140, in __init__
    super(WindowSDL, self).__init__()
  File "C:\Users\henry\DOCUME~1\SIDEPR~1\fps\venv\lib\site-packages\kivy\core\window\__init__.py", line 968, in __init__
    self.create_window()
  File "C:\Users\henry\DOCUME~1\SIDEPR~1\fps\venv\lib\site-packages\kivy\core\window\window_sdl2.py", line 272, in create_window
    self.fullscreen, resizable, state)
  File "kivy\core\window\_window_sdl2.pyx", line 125, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window
  File "kivy\graphics\cgl.pyx", line 52, in kivy.graphics.cgl.cgl_get_backend_name
  File "kivy\graphics\cgl.pyx", line 60, in kivy.graphics.cgl.cgl_get_backend_name
  File "C:\Users\henry\DOCUME~1\SIDEPR~1\fps\venv\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 670, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 583, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1043, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed

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

Try to manually copy glew,sdl2 folders and __init__.py from ../site-packages/kivy_deps to ../site-packages/kivy/deps.
It worked for me

Was this page helpful?
0 / 5 - 0 ratings