Bug 12171 - Python-opencv needs config.py and config-3.7.py to run. Only the *.pyc is not enough.
Summary: Python-opencv needs config.py and config-3.7.py to run. Only the *.pyc is not...
Status: RESOLVED FIXED
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: 2019.08
Hardware: Other Linux
: P5 trivial
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-02 21:01 UTC by Ivan
Modified: 2019-12-01 21:32 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan 2019-09-02 21:01:36 UTC
When importing cv2 in python 3.7, the program stops with:

  File "usr/lib/python3.7/site-packages/cv2/__init__.py", line 89, in <module>
  File "usr/lib/python3.7/site-packages/cv2/__init__.py", line 58, in bootstrap
  File "usr/lib/python3.7/site-packages/cv2/__init__.py", line 56, in load_first_config
ImportError: OpenCV loader: missing configuration file: ['config.py']. Check OpenCV installation.

Since buildroot removed all *.py, leaving the corresponding *.pyc, the above config.py file is not in target. But these two files are currently needed uncompiled for "import cv2".

We can of course specify BR2_PACKAGE_PYTHON3_PY_PYC=y, but this would make all *.py in target, which is sort of a waste.
Comment 1 Fabrice Fontaine 2019-09-05 18:49:06 UTC
I sent a patch to "fix" this issue: https://patchwork.ozlabs.org/patch/1158640.

This patch adds a !BR2_PACKAGE_PYTHON_PYC_ONLY dependency on opencv3's python option.
Comment 2 Thomas Petazzoni 2019-11-27 20:38:27 UTC
I have submitted a series to address this: https://patchwork.ozlabs.org/project/buildroot/list/?series=145444
Comment 3 Peter Korsgaard 2019-12-01 21:32:52 UTC
Merged for 2019.11, thanks