Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kivy and buildozer "Permission denied"

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.

like image 832
quapka Avatar asked Oct 02 '14 15:10

quapka


1 Answers

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.

like image 158
kitti Avatar answered Oct 02 '22 08:10

kitti