Issue
kivy 1.10.0, python 3.4.5, windows 10, using Anaconda's Spyder IDE
After much trouble trying to install kivy on my windows 10 computer, I was able to...sort of. I downgraded python to the most recent supported version.
I put in kivy's stock code to make sure it's working:
import kivy
kivy.require('1.0.6') # 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()
Changing my version to 1.10.0. But I got the following error and trace back:
Traceback (most recent call last):
File "<ipython-input-6-498c1728e978>", line 1, in runfile('C:/Users/Andrew/Documents/Programming/Kivvv/UsageExample.py', wdir='C:/Users/Andrew/Documents/Programming/Kivvv')
File "C:\Users\Andrew\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile execfile(filename, namespace)
File "C:\Users\Andrew\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/Andrew/Documents/Programming/Kivvv/UsageExample.py", line 12, in kivy.require('1.10.0') # replace with your current kivy version !
AttributeError: 'module' object has no attribute 'require'
Also ran
print(dir(kivy))
which returned this list:
['doc', 'loader', 'name', 'package', 'path', 'spec']
My guess is that kivy didn't install properly, but I've had so many troubles installing it that I don't want to reinstalling it until that is clearly the next best option.
Also, if it helps, when running the kivy installation process on the kivy website, several steps return an error regarding "splitlines" even though each step successfully finishes--
Exception:
Traceback (most recent call last):
File "C:\Users\Andrew\Anaconda3\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Users\Andrew\Anaconda3\lib\site-packages\pip\commands\install.py", line 335, in run
wb.build(autobuilding=True)
File "C:\Users\Andrew\Anaconda3\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:\Users\Andrew\Anaconda3\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Users\Andrew\Anaconda3\lib\site-packages\pip\req\req_set.py", line 666, in _prepare_file
check_dist_requires_python(dist)
File "C:\Users\Andrew\Anaconda3\lib\site-packages\pip\utils\packaging.py", line 48, in check_dist_requires_python
feed_parser.feed(metadata)
File "C:\Users\Andrew\Anaconda3\lib\email\feedparser.py", line 177, in feed
self._input.push(data)
File "C:\Users\Andrew\Anaconda3\lib\email\feedparser.py", line 100, in push
parts = data.splitlines(True)
AttributeError: 'NoneType' object has no attribute 'splitlines'
Not sure if it make a difference, but I decided to include it in case it is a good clue to what's going on.
Thanks so much!!!
Update, 5-12-17:
I went ahead and tried the program by pasting it in notepad and running it from there, but I got the same error message.
I then did
python -m pip list
in the powershell, and none of these popped up:
Kivy (1.10.0)
Kivy-Garden (0.1.4)
kivy.deps.angle (0.1.4)
kivy.deps.glew (0.1.9)
kivy.deps.sdl2 (0.1.17)
It looks like kivy didn't install after all. After trying to run the installation again, here is what my computer shoots back at me:
PS C:\Users\Andrew> python -m pip install kivy
Collecting kivy
Using cached Kivy-1.10.0-cp34-cp34m-win_amd64.whl
Collecting Kivy-Garden>=0.1.4 (from kivy)
Using cached kivy-garden-0.1.4.tar.gz
Requirement already satisfied: docutils in
c:\users\andrew\anaconda3\lib\site-packages (from kivy)
Requirement already satisfied: pygments in
c:\users\andrew\anaconda3\lib\site-packages (from kivy)
Exception:
Traceback (most recent call last):
File "C:\Users\Andrew\Anaconda3\lib\site-packages\pip\basecommand.py",
line 215, in main
status = self.run(options, args)
File "C:\Users\Andrew\Anaconda3\lib\site-
packages\pip\commands\install.py", line 335, in run
wb.build(autobuilding=True)
File "C:\Users\Andrew\Anaconda3\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:\Users\Andrew\Anaconda3\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Users\Andrew\Anaconda3\lib\site-packages\pip\req\req_set.py", line 666, in _prepare_file
check_dist_requires_python(dist)
File "C:\Users\Andrew\Anaconda3\lib\site-packages\pip\utils\packaging.py", line 48, in check_dist_requires_python
feed_parser.feed(metadata)
File "C:\Users\Andrew\Anaconda3\lib\email\feedparser.py", line 177, in feed
self._input.push(data)
File "C:\Users\Andrew\Anaconda3\lib\email\feedparser.py", line 100, in push
parts = data.splitlines(True)
AttributeError: 'NoneType' object has no attribute 'splitlines'
Since I'm not getting that "kivy installed" message, it looks like this "splitlines" attribute error is preventing the installation from finishing. Any idea how I can fix this?
Solution
So it seems more likely to me that your issue is with the ide. In fact if I was a betting man I'd bet everything I have that your IDE is the issue.
Please go through my answer and try the two scripts I posted. The most important thing you NEED to do now is paste the python code into notepad and run it through your command line.
If it works, you know what your issue is. If it doesn't try all the steps I've listed below. It's very possible that your ide is pointing to the wrong path(s) or something along those lines.
Try the following things please.
Step 1:
python -m pip list
Locate your kivy install and verify it's there, and it's version. You should see something like
Kivy (1.10.0)
Kivy-Garden (0.1.4)
kivy.deps.angle (0.1.4)
kivy.deps.glew (0.1.9)
kivy.deps.sdl2 (0.1.17)
If you see that stuff copy paste the below example and try running it.
Step 2: Script
import kivy
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()
If you get the same errors.
Try the following python -m pip show kivy
You should see something like
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:\python36-32\lib\site-packages
Requires: pygments, Kivy-Garden, docutils
If you see this and even if you don't run the following command
python -m pip check kivy
This will tell you if you've met all the required dependencies for kivy. If not go through and install them.
There could be issues that I can't help you with based off of the current information that I have so my last piece of advice would be to do this as a last resort.
python -m pip uninstall kivy
python -m pip install kivy==1.10.0
Update: I've never used power shell so I don't know how it operates. Try using the command promot. Also you're using Anacondas IDE but are you also using Anaconda Python? If so certain commands are different and you'd have to bypass it and use the official tools. To make sure it's not a compatibility issue. https://docs.continuum.io/anaconda/faq
From what I see in the error code your kivy install is there and fine. Which means it's directly related to spider.
Answered By - suroh
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.