Xilinx/PYNQ_Composable_Pipeline

ModuleNotFoundError: No module named `pynq_composable.overlay`

mariodruiz opened this issue · 1 comments

When the pynq_composable package is installed in a board that is not supported by the composable video overlay, the pynq_composable.overlay is register as a module, however the /usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq_composable/overlay folder is not created as there's no overlay to deliver. This leads to the following error:

KeyError                                  Traceback (most recent call last)
/usr/local/share/pynq-venv/lib/python3.8/site-packages/pkg_resources/__init__.py in get_provider(moduleOrReq)
    358     try:
--> 359         module = sys.modules[moduleOrReq]
    360     except KeyError:

KeyError: 'pynq_composable.overlay'

During handling of the above exception, another exception occurred:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-1c5b09ab7d60> in <module>
      1 from pynq   import Overlay
----> 2 overlay = Overlay("base.bit")

/usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq/overlay.py in __init__(self, bitfile_name, dtbo, download, ignore_version, device)
    334 
    335         """
--> 336         super().__init__(bitfile_name, dtbo, partial=False, device=device)
    337 
    338         self._register_drivers()

/usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq/bitstream.py in __init__(self, bitfile_name, dtbo, partial, device)
    120             overlays_ext_man = _ExtensionsManager(OVERLAYS_GROUP)
    121             paths = [overlays_ext_man.extension_path(OVERLAYS_GROUP)]
--> 122             paths += overlays_ext_man.paths
    123             for path in paths:
    124                 for p in [os.path.join(path,

/usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq/utils.py in paths(self)
    106         """Return a list of paths from the discovered extensions.
    107         """
--> 108         return [self.extension_path(e.module_name) for e in self.list]
    109 
    110 

/usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq/utils.py in <listcomp>(.0)
    106         """Return a list of paths from the discovered extensions.
    107         """
--> 108         return [self.extension_path(e.module_name) for e in self.list]
    109 
    110 

/usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq/utils.py in extension_path(extension_name)
     89         init_backup = pkg_resources.NullProvider.__init__
     90         pkg_resources.NullProvider.__init__ = init
---> 91         src_path = pkg_resources.resource_filename(extension_name, "")
     92         # Restore original `pkg_resources.NullProvider.__init__`
     93         pkg_resources.NullProvider.__init__ = init_backup

/usr/local/share/pynq-venv/lib/python3.8/site-packages/pkg_resources/__init__.py in resource_filename(self, package_or_requirement, resource_name)
   1142     def resource_filename(self, package_or_requirement, resource_name):
   1143         """Return a true filesystem path for specified resource"""
-> 1144         return get_provider(package_or_requirement).get_resource_filename(
   1145             self, resource_name
   1146         )

/usr/local/share/pynq-venv/lib/python3.8/site-packages/pkg_resources/__init__.py in get_provider(moduleOrReq)
    359         module = sys.modules[moduleOrReq]
    360     except KeyError:
--> 361         __import__(moduleOrReq)
    362         module = sys.modules[moduleOrReq]
    363     loader = getattr(module, '__loader__', None)

ModuleNotFoundError: No module named 'pynq_composable.overlay'

There are two workarounds for now:

  1. Use absolute path when creating an overlay object. For instance,
    ol = Overlay('<absolute path>/base.bit')
  2. Create an empty overlay folder within the pynq_composable module.
    sudo mkdir -p /usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq_composable/overlay