I have installed open cv using sudo apt-get install python3-opencv
and autocomplete is not working
open cv version: 4.5.4
linux: Ubuntu 22.04.3 LTS
added paths in the settings
"python.autoComplete.extraPaths": [
"/usr/lib/python3/dist-packages/cv2.cpython-310-x86_64-linux-gnu.so"
],
"python.analysis.extraPaths": [
"/usr/lib/python3/dist-packages/cv2.cpython-310-x86_64-linux-gnu.so"
]
How can I fix this issue?
because that is not recommended. the debian package is not official.
install via pip. that’s an official package.
for support with VSCode, please find an appropriate forum. we don’t know how that thing needs to be configured. specifically,
it is highly unlikely that python configuration knows what to do with a .so
file.
ok I installed the package using pip.
Which id should i used for this? pycharm?
I installed the package using pip install opencv-python
and now I am getting this error when I try to import the package
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/mubashir/.local/lib/python3.10/site-packages/cv2/__init__.py", line 181, in <module>
bootstrap()
File "/home/mubashir/.local/lib/python3.10/site-packages/cv2/__init__.py", line 175, in bootstrap
if __load_extra_py_code_for_module("cv2", submodule, DEBUG):
File "/home/mubashir/.local/lib/python3.10/site-packages/cv2/__init__.py", line 28, in __load_extra_py_code_for_module
py_module = importlib.import_module(module_name)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/mubashir/.local/lib/python3.10/site-packages/cv2/typing/__init__.py", line 69, in <module>
NumPyArrayGeneric = numpy.ndarray[typing.Any, numpy.dtype[numpy.generic]]
TypeError: 'numpy._DTypeMeta' object is not subscriptable
I fixed the issue by downgrading the package and using pycharm instead of vs code