8

few days ago I got into Android app creating. I learned about Kivy. It simplicity overwhelmed so I decided to stick to it and try to design some App. The Dev team provides Buildozer to build the App for Android easily - but I have not been able to do this step.

In the process of creating the App for Android I get two errors, since I don't know whether they relate I'll present both of them.

First error

When I run my application on Linux (Ubuntu) I got an Error, although the App works and it looks like there is no problem. The error log:

 Exception in thread Thread-1:
 Traceback (most recent call last):
   File "/usr/lib/python2.7/threading.py", line 808, in __bootstrap_inner
     self.run()
   File "/usr/lib/python2.7/threading.py", line 761, in run
     self.__target(*self.__args, **self.__kwargs)
   File "/usr/lib/python2.7/dist-packages/kivy/input/providers/mtdev.py", line 193, in _thread_run
     _device = Device(_fn)
   File "/usr/lib/python2.7/dist-packages/kivy/lib/mtdev.py", line 131, in __init__
     self._fd = os.open(filename, os.O_NONBLOCK | os.O_RDONLY)
 OSError: [Errno 13] Permission denied: '/dev/input/event7'

Second Error

I'have installed buildozer using sudo pip install buildozer. When I try to use buildozer init I got following error:

Traceback (most recent call last):
  File "/usr/local/bin/buildozer", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2825, in <module>
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 710, in subscribe
    callback(dist)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2825, in <lambda>
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2257, in activate
    self.insert_on(path)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2364, in insert_on
    self.check_version_conflict()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2403, in check_version_conflict
    for modname in self._get_metadata('top_level.txt'):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2251, in _get_metadata
    for line in self.get_metadata_lines(name):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1219, in get_metadata_lines
    return yield_lines(self.get_metadata(name))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1211, in get_metadata
    return self._get(self._fn(self.egg_info,name))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1326, in _get
    stream = open(path, 'rb')
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/google_api_python_client-1.2-py2.7.egg/EGG-INFO/top_level.txt'

This error prevents the process from going on and buildozer init fails to create buildozer.spec.

More information

In fact I have tried to run both the app, lets say sudo main.py and sudo buildozer init. At first it seemed to solve the issue, but the first time I ran buildozer android debug deploy run it took forever and unfortunately I had to kill it.

The second time I wanted to do it properly, and it was strange to me that in the example they do not use sudo. Also I have found everywhere NEVER run buildozer with sudo. So, I unistalled both kivy and buildozer, and installed it again, restart my pc. But nothing changed. Maybe my stupid app has some issues (that might solve the first error), but probably not the second one. Any help appreciated - also I can give more information.

Note

I've looked on other questions, but they seemed to solve different issues.

10
  • 3
    First Error: not an issue. Your user doesn't have access to directly read the input device - but usually that's because it's a laptop touchpad which Kivy doesn't need to read anyway (it uses it as a mouse, not a touch input device). You can safely ignore that one - if it really bothers you, you can modify udev rules to give your user access to those devices.
    – kitti
    Commented Oct 2, 2014 at 16:03
  • @RyanP Thanks! I hoped it won't be anything crucial. I guess I don't need to modify the rules for two reasons: 1) don't know how, 2) I am creating and Android app. so the touchpad should not matter. Do you have any ideas about the second issue?
    – quapka
    Commented Oct 2, 2014 at 16:06
  • 1
    The second issue is strange. buildozer doesn't use the Google APIs in your error. Are you using that API package? Maybe you could try removing it?
    – kitti
    Commented Oct 2, 2014 at 16:09
  • Also, I will go ahead and reiterate: never run buildozer with sudo. ;) buildozer does not need root access for anything, but giving it root will screw up file permissions. Since you've already used sudo, you should fix permissions - run chmod -R username:group ~/.buildozer and chmod -R username:group <project dir> (replacing username and group with your username and group, of course).
    – kitti
    Commented Oct 2, 2014 at 16:11
  • Well, in other (totally unrelated) projects I am accessing GDrive from python, but I do not remember installing any packages. I'll fix the permissions (the "reinstall" does not help?) as soon as I'll come back from school.
    – quapka
    Commented Oct 2, 2014 at 16:15

1 Answer 1

11

First Error: not an issue. Your user doesn't have access to directly read the input device - but usually that's because it's a laptop touchpad which Kivy doesn't need to read anyway (it uses it as a mouse, not a touch input device). You can safely ignore that one - if it really bothers you, you can modify udev rules to give your user access to those devices.

Second Error: apparently due to an issue with the Google API package. Uninstalling that package fixes buildozer. You might be able to reinstall it now (maybe the Google package didn't install properly, which confused pkg_resources when it was scanning things?). If not, you could try installing that package in a virtualenv to separate it from other packages.

Not the answer you're looking for? Browse other questions tagged or ask your own question.