ModuleNotFoundError: No module named 'plyer.utils'; 'plyer' is not a package

933 views
Skip to first unread message

Assi Oz

unread,
Jun 18, 2021, 6:16:22 AM6/18/21
to Kivy users support
Hi guys,

Been struggling with this message when trying to execute a short simple Python script for getting Windows Popup notification box.

When executing I get this in the command line window : 
Traceback (most recent call last):
  File "C:\Users\Desktop\PY\plyer.py", line 1, in <module>
    from plyer.utils import platform
  File "C:\Users\Desktop\PY\plyer.py", line 1, in <module>
    from plyer.utils import platform
ModuleNotFoundError: No module named 'plyer.utils'; 'plyer' is not a package

Plyer is installed. also re-installed,. tries many versions of it but nothing.

Can anyone assist please?

Pranav Balaji Pooruli

unread,
Jun 18, 2021, 6:43:40 AM6/18/21
to kivy-...@googlegroups.com
Try from plyer import utils; platform = utils.platform.

--
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/37271963-e4de-4bb4-a663-b5b00dbfb519n%40googlegroups.com.

Assi Oz

unread,
Jun 18, 2021, 7:13:29 AM6/18/21
to Kivy users support
Now i got : 

ImportError: cannot import name 'utils' from partially initialized module 'plyer' (most likely due to a circular import) 
ב-יום שישי, 18 ביוני 2021 בשעה 13:43:40 UTC+3, pranav....@gmail.com כתב/ה:

Assi Oz

unread,
Jun 18, 2021, 7:14:00 AM6/18/21
to Kivy users support
This is the script :

from plyer import utils; platform = utils.platform
#from plyer.utils import platform
from plyer import notification

notification.notify(
    title='Here is the title',
    message='Here is the message',
    app_name='Here is the application name',

ב-יום שישי, 18 ביוני 2021 בשעה 14:13:29 UTC+3, ‪Assi Oz‬‏ כתב/ה:

Elliot Garbus

unread,
Jun 18, 2021, 9:27:47 AM6/18/21
to kivy-...@googlegroups.com

This suggests an installation problem.

Are you using a venv?  Did you activated the venv when you pip installed plyer?  If you run pip list, do you see plyer?

 

I ran the notification example on Windows without any error.

https://github.com/kivy/plyer/tree/master/examples/notification

Assi Oz

unread,
Jun 18, 2021, 11:01:19 AM6/18/21
to Kivy users support
Thanks Elliot
Is VENV mandatory to execute plyer?
I do have plyer when running pip list

ב-יום שישי, 18 ביוני 2021 בשעה 16:27:47 UTC+3, ElliotG כתב/ה:

Elliot Garbus

unread,
Jun 18, 2021, 11:07:43 AM6/18/21
to kivy-...@googlegroups.com
No it is not required. 
I use venv as recommended in the kivy install directions. 

Are you sure you are using the environment that includes plyer?

Sent from my iPhone

On Jun 18, 2021, at 8:03 AM, Assi Oz <ass...@gmail.com> wrote:



Assi Oz

unread,
Jun 18, 2021, 11:09:54 AM6/18/21
to Kivy users support
As I`m a beginner I`ll tell you what I did so far :
1) installed Python 3.9
2) Saved a file with the script sent here
3) executed  pip install plyer
4) executed python filename.py

anything missed...?

ב-יום שישי, 18 ביוני 2021 בשעה 18:07:43 UTC+3, ElliotG כתב/ה:

Assi Oz

unread,
Jun 18, 2021, 11:14:13 AM6/18/21
to Kivy users support
by the way - in the link you provided i just took the  main.py file and executed.
Do I need anything from the other files in that link?

buildozer.spec
notificationdemo.kv
plyer-icon.ico
plyer-icon.png

ב-יום שישי, 18 ביוני 2021 בשעה 18:09:54 UTC+3, ‪Assi Oz‬‏ כתב/ה:

Elliot Garbus

unread,
Jun 18, 2021, 12:23:53 PM6/18/21
to kivy-...@googlegroups.com

You also need:

notificationdemo.kv

plyer-icon.ico

plyer-icon.png

Elliot Garbus

unread,
Jun 18, 2021, 12:34:21 PM6/18/21
to kivy-...@googlegroups.com
Follow the kivy install directions. 

What platform are you on? Windows, Mac…
Did you install Python from Python.org?
Have you set the Python path?

Sent from my iPhone

On Jun 18, 2021, at 8:11 AM, Assi Oz <ass...@gmail.com> wrote:



Robert

unread,
Jun 18, 2021, 1:22:07 PM6/18/21
to Kivy users support
For Plyer the examples are the documentation (which sucks), try

Assi Oz

unread,
Jun 18, 2021, 1:23:51 PM6/18/21
to Kivy users support
I`m using Windows 10
installed Python from Python.org
I have just set the Python path (anything needed after doing that? any restart of anything?)
Downloaded the below files to same folder as the script :

notificationdemo.kv

plyer-icon.ico

plyer-icon.png

Still same error....

 ImportError: cannot import name 'notification' from partially initialized module 'plyer' (most likely due to a circular import)

ב-יום שישי, 18 ביוני 2021 בשעה 19:34:21 UTC+3, ElliotG כתב/ה:

Assi Oz

unread,
Jun 18, 2021, 1:25:12 PM6/18/21
to Kivy users support
Thanks Robert ! we are dealing with the same link you sent.
Maybe I`m missing something here?
SHould i just download all files included in that link, put in same folder and execute main.py?

ב-יום שישי, 18 ביוני 2021 בשעה 20:23:51 UTC+3, ‪Assi Oz‬‏ כתב/ה:

Assi Oz

unread,
Jun 18, 2021, 1:33:38 PM6/18/21
to Kivy users support
FULL EXECUTION OUTPUT

C:\Users\aoz>python C:\Users\aoz\Desktop\PY\main.py
[INFO   ] [Logger      ] Record log in C:\Users\aoz\.kivy\logs\kivy_21-06-18_8.txt
[INFO   ] [deps        ] Successfully imported "kivy_deps.angle" 0.3.0
[INFO   ] [deps        ] Successfully imported "kivy_deps.glew" 0.3.0
[INFO   ] [deps        ] Successfully imported "kivy_deps.sdl2" 0.3.1
[INFO   ] [Kivy        ] v2.0.0
[INFO   ] [Kivy        ] Installed at "C:\Users\aoz\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\__init__.py"
[INFO   ] [Python      ] v3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)]
[INFO   ] [Python      ] Interpreter at "C:\Users\aoz\AppData\Local\Programs\Python\Python39\python.exe"
[INFO   ] [Factory     ] 186 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2 (img_pil, img_ffpyplayer ignored)
 Traceback (most recent call last):
   File "C:\Users\aoz\Desktop\PY\main.py", line 7, in <module>
     from plyer import notification
   File "C:\Users\aoz\Desktop\PY\plyer.py", line 7, in <module>
     from plyer import notification
 ImportError: cannot import name 'notification' from partially initialized module 'plyer' (most likely due to a circular import) (C:\Users\aoz\Desktop\PY\plyer.py)

ב-יום שישי, 18 ביוני 2021 בשעה 20:25:12 UTC+3, ‪Assi Oz‬‏ כתב/ה:

Robert

unread,
Jun 18, 2021, 9:56:29 PM6/18/21
to Kivy users support
I just tried the example (all the files) on Windows and no errors,
Best guess there is a Python or Plyer install issue, which is what Elliot said.
Probably the Python install, I'm not  the person to do sys admin for you.
If this is the issue you will run into it again with some other pip package.

That said the example didn't do anything, just take input and hang.
My view of Plyer is it is a Potemkin Village, only sometimes is there something that is tested behind each facade.
If it works great, otherwise don't waste your time expecting it to work if you just......

Alexander Taylor

unread,
Jun 20, 2021, 1:10:39 PM6/20/21
to Kivy users support
You named your file plyer.py, so when you import plyer that's what you get.

Name it something else instead.

Assi Oz

unread,
Jun 20, 2021, 3:35:43 PM6/20/21
to Kivy users support
This is Unbelievable the file name was the issue !!!!!!
God damn....thank you so much Alex

ב-יום ראשון, 20 ביוני 2021 בשעה 20:10:39 UTC+3, alexander...@gmail.com כתב/ה:
Reply all
Reply to author
Forward
0 new messages