tyiannak / multimodal_movie_analysis

A Python Library for Multimodal Analysis of Movies and Content-based Movie Recommendation
25 stars 8 forks source link

importing problems #26

Closed GeorgeTouros closed 3 years ago

GeorgeTouros commented 3 years ago

When opening in Pycharm (PyCharm 2020.2.3 (Professional Edition), in Ubuntu 20.04.1 LTS) using the root folder as the root of the project, I get the following import error when running from analyze_visual.analyze_visual import process_video:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/snap/pycharm-professional/218/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/home/zappatistas20/PycharmProjects/multimodal_movie_analysis/analyze_visual/analyze_visual.py", line 30, in <module>
    from object_detection import detection_utils as dutils
  File "/snap/pycharm-professional/218/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'object_detection'

I fixed that (and all the errors that followed after that concerning ModuleNotFoundError) by adding the absolute path to the targeted module like so:

In the analyze_visual.py:

from analyze_visual.object_detection import detection_utils as dutils
from analyze_visual.object_detection import generic_model as gmodel
from analyze_visual.utils import *

In the detection_utils.py:

from analyze_visual.utils import rect_area
from analyze_visual.utils import intersect_rectangles

I am guessing the same should happen in the analyze_textual files as well.

pakoromilas commented 3 years ago

Running from the terminal I do not face that issue. Is it possible that this problem is connected with some Pycharm interpreter? Could you try running the repo code from the terminal and tell us if the issue remains?

GeorgeTouros commented 3 years ago

Indeed running $ python ./analyze_visual/analyze_visual.py doesn't raise import issues. If that's the intended use of the packages, there's no need for further action. If it is intended to be imported as a module in other projects, then perhaps this issue should be addressed. Thanks.