community icon indicating copy to clipboard operation
community copied to clipboard

Unable to find any valuable Window provider when install method is conda

Open razed11 opened this issue 2 years ago • 5 comments

Software Versions

  • Python: 3.10.5
  • OS: MacOS Big Sur 11.6.8 (Intel)
  • Kivy: 2.1
  • Kivy installation method: conda install -c conda-forge kivy

Describe the bug When running the "Hello World" example I get Unable to find any valuable Window provider. and it reports that it cannot load @rpath/libSDL2_image-2.0.0.dylib. More detailed logs below.

Expected behavior Display a window with "Hello world".

To Reproduce

#! /usr/bin/env python
import kivy

kivy.require("2.1.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()

Code and Logs and screenshots

cryo) Silverback: ./Developer/Code/Test.py 
[INFO   ] [Logger      ] Record log in /Users/Kenny/.kivy/logs/kivy_22-08-12_18.txt
[INFO   ] [Kivy        ] v2.1.0
[INFO   ] [Kivy        ] Installed at "/Users/Kenny/Anaconda3/envs/cryo/lib/python3.10/site-packages/kivy/__init__.py"
[INFO   ] [Python      ] v3.10.5 | packaged by conda-forge | (main, Jun 14 2022, 07:09:13) [Clang 13.0.1 ]
[INFO   ] [Python      ] Interpreter at "/Users/Kenny/Anaconda3/envs/cryo/bin/python"
[INFO   ] [Logger      ] Purge log fired. Processing...
[INFO   ] [Logger      ] Purge finished!
[INFO   ] [Factory     ] 189 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_imageio, img_dds, img_pil (img_sdl2, img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: sdl2
[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 - ImportError: dlopen(/Users/Kenny/Anaconda3/envs/cryo/lib/python3.10/site-packages/kivy/core/window/_window_sdl2.cpython-310-darwin.so, 2): Library not loaded: @rpath/libSDL2_image-2.0.0.dylib
  Referenced from: /Users/Kenny/Anaconda3/envs/cryo/lib/python3.10/site-packages/kivy/core/window/_window_sdl2.cpython-310-darwin.so
  Reason: image not found
  File "/Users/Kenny/Anaconda3/envs/cryo/lib/python3.10/site-packages/kivy/core/__init__.py", line 59, in core_select_lib
    mod = importlib.__import__(name='{2}.{0}.{1}'.format(
  File "<frozen importlib._bootstrap>", line 1129, in __import__
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/Kenny/Anaconda3/envs/cryo/lib/python3.10/site-packages/kivy/core/window/window_sdl2.py", line 28, in <module>
    from kivy.core.window._window_sdl2 import _WindowSDL2Storage

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

The requested library does not appear to be installed within the conda subdirectories:

(cryo) Silverback: find ~/Anaconda3 -name "libSDL2_image*"
/Users/Kenny/Anaconda3/pkgs/sdl2_image-2.6.1-h54440a0_0/lib/libSDL2_image.dylib
/Users/Kenny/Anaconda3/pkgs/sdl2_image-2.6.1-h54440a0_0/lib/libSDL2_image-2.0.dylib
/Users/Kenny/Anaconda3/pkgs/sdl2_image-2.6.1-h54440a0_0/lib/libSDL2_image-2.0.3.0.0.dylib
/Users/Kenny/Anaconda3/pkgs/sdl2_image-2.6.1-h54440a0_0/lib/libSDL2_image-2.0.601.1.0.dylib
/Users/Kenny/Anaconda3/envs/cryo/lib/libSDL2_image.dylib
/Users/Kenny/Anaconda3/envs/cryo/lib/libSDL2_image-2.0.dylib
/Users/Kenny/Anaconda3/envs/cryo/lib/libSDL2_image-2.0.3.0.0.dylib
/Users/Kenny/Anaconda3/envs/cryo/lib/libSDL2_image-2.0.601.1.0.dylib

Additional context Also tried with a Python 3.7 environment.

razed11 avatar Aug 12 '22 19:08 razed11

As a workaround, I linked the expected library to what exists and the example code worked.

cd /Users/Kenny/Anaconda3/envs/cryo/lib
ln -s libSDL2_image-2.0.601.1.0.dylib libSDL2_image-2.0.0.dylib

razed11 avatar Aug 12 '22 20:08 razed11

Hi Kivy team, I'm seeing exactly the same issue using:

  • OS: Mac OS Monterey 12.6
  • Python 3.8.13
  • Kivy 2.1.0
  • Kivy installation method: conda install -c conda-forge kivy

Error produced:

[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 - ImportError: dlopen(/Users/dirk/anaconda3/envs/donkey_38/lib/python3.8/site-packages/kivy/core/window/_window_sdl2.cpython-38-darwin.so, 0x0002): Library not loaded: '@rpath/libSDL2_image-2.0.3.0.0.dylib'
  Referenced from: '/Users/dirk/anaconda3/envs/donkey_38/lib/python3.8/site-packages/kivy/core/window/_window_sdl2.cpython-38-darwin.so'
  Reason: tried: '/Users/dirk/anaconda3/envs/donkey_38/lib/python3.8/site-packages/kivy/core/window/../../../../../libSDL2_image-2.0.3.0.0.dylib' (no such file), '/Users/dirk/anaconda3/envs/donkey_38/lib/python3.8/site-packages/kivy/core/window/../../../../../libSDL2_image-2.0.3.0.0.dylib' (no such file), '/Users/dirk/anaconda3/envs/donkey_38/bin/../lib/libSDL2_image-2.0.3.0.0.dylib' (no such file), '/Users/dirk/anaconda3/envs/donkey_38/bin/../lib/libSDL2_image-2.0.3.0.0.dylib' (no such file), '/usr/local/lib/libSDL2_image-2.0.3.0.0.dylib' (no such file), '/usr/lib/libSDL2_image-2.0.3.0.0.dylib' (no such file)
  File "/Users/dirk/anaconda3/envs/donkey_38/lib/python3.8/site-packages/kivy/core/__init__.py", line 59, in core_select_lib
    mod = importlib.__import__(name='{2}.{0}.{1}'.format(
  File "<frozen importlib._bootstrap>", line 1093, in __import__
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/dirk/anaconda3/envs/donkey_38/lib/python3.8/site-packages/kivy/core/window/window_sdl2.py", line 28, in <module>
    from kivy.core.window._window_sdl2 import _WindowSDL2Storage

We are using Kivy in the Donkey Car project (https://github.com/autorope/donkeycar) and it prevents us from upgrading 2.0 -> 2.1. Could you please fix this in the package?

DocGarbanzo avatar Nov 05 '22 20:11 DocGarbanzo

Cofirm, same here

bedbad avatar Apr 18 '23 14:04 bedbad

  • OS: macOS Monterey 12.6.5
  • Python 3.8
  • Kiv 2.1.0
  • Installation: conda install -c conda-forge kivy

Same exact error.

benpm avatar May 21 '23 16:05 benpm

As a workaround, I linked the expected library to what exists and the example code worked.

cd /Users/Kenny/Anaconda3/envs/cryo/lib
ln -s libSDL2_image-2.0.601.1.0.dylib libSDL2_image-2.0.0.dylib

This works, thank you. For me, Kivy was looking for "libSDL2_image-2.0.3.0.0.dylib" but the library in my Conda environment was "libSDL2_image-2.0.801.0.0.dylib".

To resolve:

  1. Navigate to /Users/{user}/opt/anaconda3/envs/{env_name}/lib
  2. Create a copy of the "libSDL2_image-2.0.{x}.0.0.dylib" file
  3. Change the name of the copy to "libSDL2_image-2.0.3.0.0.dylib" OR whatever the name of the library is in the ImportError you get when trying to run your program with python3 -d your_program.py.

sampazdan avatar Dec 20 '23 21:12 sampazdan