using sdl2 in Kivy instead of pygame - python

I couldn't resize my windows on the applications i made with Kivy, so I found out using sdl2, instead of Pygame, with Kivy can fix this. I uninstalled Kivy and Pygame, then installed sdl2, then reinstalled Kivy. Kivy still is trying to use pygame though. Please Help.
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/kivy/core/__init__.py", line 59, in core_select_lib
fromlist=[modulename], level=0)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/kivy/core/window/window_pygame.py", line 8, in <module>
import pygame

The easiest way to fix this is to purge your current kivy install and re-install it fresh using the following links as a reference point (these are the official installation instructions)
https://kivy.org/docs/installation/installation-windows.html
With that being said please note the following, do to an issue with a few compilers 1.9.2 doesn't work on windows with python 3.5 this is an ongoing issue the kivy team is aware of and working on.
So this means you're left with using python 3.4 for the newest version(s) of kivy on windows. Kivy no longers uses pygame and should by default prompt you to install sdl2.
The only issue you may have with the official instructions in the link I provided is setting up GStreamer if it gives you a problem you can skip that and just grab a ported version which suffices.
If you're on Linux then just re-install :)

I had the same issue on my new Mac (Sierra). I followed the suggestion at https://github.com/kivy/kivy/issues/4688
and installed the latest version of Kivy using the command
USE_OSX_FRAMEWORKS=0 pip install https://github.com/kivy/kivy/zipball/master
This worked for me, and Kivy is now using SDL2 and not looking for pygame.
(I also answered this at: Kivy support for SDL2 in Virtualenv)

Related

Why does visual studio code not recognize that i have Pygame installed?

I installed pygame through cmd using pip install pygame which can be seen in the ss. For some reason im unable to import it in my main.py file. Is there some way for me to fix this?(screenshot of terminal and vscode file)
I faced the same issue, but I had used the terminal. What I had done:
Deleted pygame which was installed via pip.
Installed it from the official website.
Then imported pygame. It fixed the issue.
I use linux
Alternatively, you can open the app installer of your device and search "pygame". Hopefully the module shows up.

How do I install python 3.6 while having python3.8 installed? (MacOS)

I tried the code:
import kivy
from kivy.app import app
and it gives me the error 'no package called kivy'. I have installed kivy but its still giving me this error. Somebody said that kivy is not supported by python 3.8 so I decided to download 3.6 from python.org but something is wrong..when I click on the downloaded file, it just takes me to more files with several codes but nothing about installation. I am confused what do I do?

Kivy not being imported despite installlation

I just installed kivy on python 3.5.0. However, every time I try to import kivy; it shows the error "No module named Kivy".
I am very new to all this so step by step instructions would be helpful.
Many operating systems come with python 2.7 and 3.5 already installed. I know you said you have 3.5, but check this anyway with python2 -V. In the comments,you said that you have been importing kivy correctly into your files. It may be that you are accidentally running your python3 app with python2.
Kivy for python2 is not the same as kivy for python3. If you want to be sure that you're running with the python version you want, run your app with python3 filename.py.
If all this is said and done, and you still don't find out what's wrong, you either installed kivy for python2 somehow or it's searching for kivy in the wrong place.

Does Kivy Require PyGame if SDL2 Dependencies are Installed Instead? [duplicate]

I couldn't resize my windows on the applications i made with Kivy, so I found out using sdl2, instead of Pygame, with Kivy can fix this. I uninstalled Kivy and Pygame, then installed sdl2, then reinstalled Kivy. Kivy still is trying to use pygame though. Please Help.
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/kivy/core/__init__.py", line 59, in core_select_lib
fromlist=[modulename], level=0)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/kivy/core/window/window_pygame.py", line 8, in <module>
import pygame
The easiest way to fix this is to purge your current kivy install and re-install it fresh using the following links as a reference point (these are the official installation instructions)
https://kivy.org/docs/installation/installation-windows.html
With that being said please note the following, do to an issue with a few compilers 1.9.2 doesn't work on windows with python 3.5 this is an ongoing issue the kivy team is aware of and working on.
So this means you're left with using python 3.4 for the newest version(s) of kivy on windows. Kivy no longers uses pygame and should by default prompt you to install sdl2.
The only issue you may have with the official instructions in the link I provided is setting up GStreamer if it gives you a problem you can skip that and just grab a ported version which suffices.
If you're on Linux then just re-install :)
I had the same issue on my new Mac (Sierra). I followed the suggestion at https://github.com/kivy/kivy/issues/4688
and installed the latest version of Kivy using the command
USE_OSX_FRAMEWORKS=0 pip install https://github.com/kivy/kivy/zipball/master
This worked for me, and Kivy is now using SDL2 and not looking for pygame.
(I also answered this at: Kivy support for SDL2 in Virtualenv)

Installing PyGame - ImportError: DLL load failed

My current version of Python is the newest 3.5 and the only available PyGame was for 3.2 (both PyGame and Python are 32-bit). I've scoured stackoverflow for a resolution and can't find any way to make this work. I've installed the PyGame easy installer and placed it in the directory where my Python install is, and in Visual Studio (I've also tried this in PyCharm as well as the standard Python IDE in command prompt), upon typing
import pygame or import sys, pygame
I'm presented with the error Import Error was
unhandled by user code - DLL load failed: The specified module could not be found.
My final solution is to uninstall Python 3.5 and install the version which matches PyGame.
This shouldn't have anything to do with Python version. You are missing a dynamic library (the DLL). This means that either the DLL is not on your system or Python can't find it. You should probably try the msi/exe installer for PyGame mentioned here, as it should install any dependencies. This would fix the issue if it is caused by the DLL being absent from your system.
It could also be caused by the libraries not being on PYTHONPATH. Search the error you received and you should see quite a few answers on fixing this.
If you're just getting started, you may want to look at a different library. There are likely quite a few game libraries for Python that can be installed with a simple pip install. You could then return to PyGame when you are more comfortable if you wanted.
get it from here: https://www.dropbox.com/s/hnmcaq1rf6zn7m3/pygame-1.9.2a0-cp34-none-win32.whl?dl=0
download it and install it by putting it in C:\python3.5\Scripts
then run pip3 install pygame-1.9.2a0-cp34-none-win32.whl
(this is for 3.4, but 3.5 works too)
it should work, and your error has nothing to do with the package, it's just that you do not have a DLL file, install it again from the website above

Categories