Python Forum
[Kivy] ModuleNotFoundError: No module named 'kivy'
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Kivy] ModuleNotFoundError: No module named 'kivy'
#1
I've installed Kivy to the specifications given in this documentation and this video, but when I try to run the following code,

import kivy
kivy.require('1.0.8')

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

class HelloKivy(App):

    def build(self):
        return Label(text="Hello, Kivy.")

helloKivy = HelloKivy()

helloKivy.run()
I get this error:

Quote:Traceback (most recent call last):
File "C:/Users/[USERNAME]/PycharmProjects/practice/kivytut.py", line 1, in <module>
import kivy
ModuleNotFoundError: No module named 'kivy'
Reply
#2
It may not be installed for the version of python that you are running
run the following commands (from command line) to see where it's installed
Since the link you show instructs you to use pip, make sure your pip is for your python version
pip -V
# and for python
python -V
pip should show something like:
Output:
pip -V pip 19.0.3 from ...pyenv/versions/3.7.2/lib/python3.7/site-packages/pip (python 3.7) python -V Python 3.7.2
if you see (python 2.7) in pip -V, and your python version is 3.whatever,
then you need to reinstall using pip3
Reply
#3
(Mar-29-2019, 02:35 AM)Larz60+ Wrote: It may not be installed for the version of python that you are running
run the following commands (from command line) to see where it's installed
Since the link you show instructs you to use pip, make sure your pip is for your python version
pip -V
# and for python
python -V
pip should show something like:
Output:
pip -V pip 19.0.3 from ...pyenv/versions/3.7.2/lib/python3.7/site-packages/pip (python 3.7) python -V Python 3.7.2
if you see (python 2.7) in pip -V, and your python version is 3.whatever,
then you need to reinstall using pip3

Okay, it's installed now, but when I tried to use it, I got a different module-not-found error: ModuleNotFoundError: No module named 'kivy.app'; 'kivy' is not a package

Here is the code:

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

class MyApp(App):
    def build(self):
        return Label(text="Text here")

if __name__ == "__main__":
    MyApp().run()
Reply
#4
Have you named one of your files kivy.py if so change to something different so it doesn't clash with the kivy files.
Reply
#5
(Mar-29-2019, 06:17 AM)Yoriz Wrote: Have you named one of your files kivy.py if so change to something different so it doesn't clash with the kivy files.

That may have been it, but now I'm back to this error again:

ModuleNotFoundError: No module named 'kivy'

Why is this so hard?!
Reply
#6
(Mar-29-2019, 02:35 AM)Larz60+ Wrote: It may not be installed for the version of python that you are running
run the following commands (from command line) to see where it's installed
Since the link you show instructs you to use pip, make sure your pip is for your python version
pip -V
# and for python
python -V
pip should show something like:
Output:
pip -V pip 19.0.3 from ...pyenv/versions/3.7.2/lib/python3.7/site-packages/pip (python 3.7) python -V Python 3.7.2
if you see (python 2.7) in pip -V, and your python version is 3.whatever,
then you need to reinstall using pip3

This was the result:

C:\Users\[USERNAME]>pip -V
pip 19.0.3 from c:\users\[USERNAME]\appdata\local\programs\python\python37\lib\site-packages\pip (python 3.7)

C:\Users\[USERNAME]>python -V
Python 3.7.3
Reply
#7
Quote:This was the result:
That looks fine.
Please post exact, unmodified and complete error message that you are receiving
also, what is your OS.
Reply
#8
(Mar-29-2019, 10:17 PM)Larz60+ Wrote:
Quote:This was the result:
That looks fine.
Please post exact, unmodified and complete error message that you are receiving
also, what is your OS.

Windows 10 (64-bit)

Quote:C:\Users\travis.lambert\PycharmProjects\practice\venv\installkivy\Scripts\python.exe C:/Users/travis.lambert/PycharmProjects/kivia/venv/installkivy/never_name_a_file_kivy.py
[INFO ] [Logger ] Record log in C:\Users\travis.lambert\.kivy\logs\kivy_19-03-29_43.txt
[INFO ] [Kivy ] v1.10.1
[INFO ] [Python ] v3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)]
[INFO ] [Factory ] 194 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_gif (img_sdl2, img_pil, img_ffpyplayer ignored)
[CRITICAL] [Text ] Unable to find any valuable Text provider.
sdl2 - ImportError: DLL load failed: The specified module could not be found.
File "C:\Users\travis.lambert\PycharmProjects\practice\venv\installkivy\lib\site-packages\kivy\core\__init__.py", line 59, in core_select_lib
fromlist=[modulename], level=0)
File "C:\Users\travis.lambert\PycharmProjects\practice\venv\installkivy\lib\site-packages\kivy\core\text\text_sdl2.py", line 12, in <module>
from kivy.core.text._text_sdl2 import (_SurfaceContainer, _get_extents,

pil - ModuleNotFoundError: No module named 'PIL'
File "C:\Users\travis.lambert\PycharmProjects\practice\venv\installkivy\lib\site-packages\kivy\core\__init__.py", line 59, in core_select_lib
fromlist=[modulename], level=0)
File "C:\Users\travis.lambert\PycharmProjects\practice\venv\installkivy\lib\site-packages\kivy\core\text\text_pil.py", line 7, in <module>
from PIL import Image, ImageFont, ImageDraw

[CRITICAL] [App ] Unable to get a Text provider, abort.

Process finished with exit code 1

This problem is solved, but I still need help with the other.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [FIXED] User-defined module: ModuleNotFoundError error in VSCode but not in PyCharm epoxy 5 11,869 Jun-01-2021, 02:16 AM
Last Post: deanhystad
  [PyQt] ModuleNotFoundError: No module named 'PyQt5' matklt 2 16,586 Jun-02-2020, 07:05 AM
Last Post: Knight18
  [WxPython] Linux: No module named 'wx' PeterLinux 23 15,442 Apr-02-2020, 12:50 PM
Last Post: PeterLinux
  [Kivy] Kivy Designer Module Error SARAVANAN_M 0 3,836 Nov-20-2019, 09:57 AM
Last Post: SARAVANAN_M
  "ModuleNotFoundError: No module named '_tkinter' in Python 3.8 Alfa 0 programmerc 1 6,284 Oct-21-2018, 06:32 PM
Last Post: Larz60+
  PyGtk3, No Module Named gi, on python3.5 on Windows harun2525 8 34,326 May-19-2017, 01:30 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020