elsampsa / valkka-live

OpenSource Video Surveillance Program
GNU Affero General Public License v3.0
31 stars 12 forks source link

Issue while trying out valkka-live #1

Closed manik005 closed 5 years ago

manik005 commented 5 years ago

Hi @elsampsa,

Thanks for the amazing package. I was trying to explore it and when I followed the steps in the installation on my ubuntu 16.04 machine I encountered the following error. May I know the reason for this? I have even installed kwin. Have I missed any other package/library ?

valkka-live
Service 'org.kde.KWin' does not exist.
valkka.mvision.__init__ : could not import module alpr : ''
valkka.mvision.__init__ : could not import module yolo3 : 'No module named 'darknet''
valkka.mvision.__init__ : could not import module yolo2 : 'No module named 'darknet''
valkka.mvision.__init__ : could not import module yolo3tiny : 'No module named 'darknet''
Traceback (most recent call last):
  File "/home/manikandan/.local/bin/run-valkka-live", line 9, in <module>
    load_entry_point('valkka-live==0.8.0', 'console_scripts', 'run-valkka-live')()
  File "/home/manikandan/.local/lib/python3.5/site-packages/valkka/live/gui.py", line 783, in main
    mg = MyGui()
  File "/home/manikandan/.local/lib/python3.5/site-packages/valkka/live/gui.py", line 60, in __init__
    self.initVars()
  File "/home/manikandan/.local/lib/python3.5/site-packages/valkka/live/gui.py", line 75, in initVars
    self.mvision_classes = tools.scanMVisionClasses()
  File "/home/manikandan/.local/lib/python3.5/site-packages/valkka/live/tools.py", line 63, in scanMVisionClasses
    if (p.name.find(".mvision")>-1):
AttributeError: 'tuple' object has no attribute 'name'
elsampsa commented 5 years ago

Hi,

Thanks for the report. My best guess is, that pkgutil module is somehow different in our python3 versions. Could you please run the following script with python3 and post the output here?

import importlib
import pkgutil

valkka = importlib.import_module("valkka")
gen = pkgutil.iter_modules(valkka.__path__, valkka.__name__ + ".")
print("gen>", gen)
for p in gen:
    print(p)
    print(p.__class__)
    print()

Here is the same in file form if you prefer that: debug.txt

manik005 commented 5 years ago

Hi @elsampsa ,

Thanks for the swift reply. I did tried it out, here is the response.

gen> <generator object iter_modules at 0x7f0965842200>
(FileFinder('/home/manikandan/.local/lib/python3.5/site-packages/valkka'), 'valkka.live', True)
<class 'tuple'>

(FileFinder('/home/manikandan/.local/lib/python3.5/site-packages/valkka'), 'valkka.mvision', True)
<class 'tuple'>

(FileFinder('/usr/lib/python3/dist-packages/valkka'), 'valkka.api2', True)
<class 'tuple'>

(FileFinder('/usr/lib/python3/dist-packages/valkka'), 'valkka.core', True)
<class 'tuple'>
elsampsa commented 5 years ago

This library and program is currently being developed by Petri, using an Ubuntu 18 environment (which I have myself as well).

When going from Ubuntu 16 => Ubuntu 18, the python version has been changed from 3.5 => 3.6. And there seems to be some "jump" between those versions. Take a look at this, for example:

In Ubuntu 18, which uses python 3.6+ : https://docs.python.org/3.6/library/pkgutil.html#pkgutil.iter_modules In Ubuntu 16, which uses python 3.5 : https://docs.python.org/3.5/library/pkgutil.html#pkgutil.iter_modules

But said that, I changed a few lines of code to take python 3.5 into account, so please update with

pip3 install --user --upgrade git+git://github.com/elsampsa/valkka-live.git

and try again.

If this gets more complicated, I'd recommend updating to Ubuntu 18. And besides, who uses Ubuntu 16 anymore? :)

P. S. The problem here is, that it's not trivial to run valkka in virtual environments for testing with different distros and their versions.. it uses OpenGL, and if you start to play with the machine vision extensions, also CUDA, darknet, etc. Only possibility would be to have it running on a linux pc with ubuntu 16 and test there.. but I'm not really motivated to do it, since Ubuntu 16 is a distro that's getting obsolete

manik005 commented 5 years ago

Alright then. Will try to set it up on Ubuntu 18 machine. Thanks for the support :)