This fixed the problem by having it as the first two lines of the script:
!pip install opencv-python
!apt update && apt install -y libsm6 libxext6
!apt-get install -y libxrender-dev
More Related Contents:
- How do I import a module given the full path?
- How to do relative imports in Python?
- How can I import other Python files?
- How to fix “Attempted relative import in non-package” even with __init__.py
- ImportError: Cannot import name X
- Python error “ImportError: No module named”
- Importing files from different folder
- Importing modules: __main__ vs import as module
- How do I import other Python files?
- Error “ImportError: DLL load failed: %1 is not a valid Win32 application”
- How does python find a module file if the import statement only contains the filename?
- Absolute imports in python not working, relative imports work
- Why can’t Python import Image from PIL?
- Python import modules from a higher level package
- What can I do about “ImportError: Cannot import name X” or “AttributeError: … (most likely due to a circular import)”?
- Prevent Python from caching the imported modules
- How can I import a module dynamically given the full path?
- Installing OpenCV for Python on Ubuntu, getting ImportError: No module named cv2.cv
- Python: is the current directory automatically included in path?
- How to properly use relative or absolute imports in Python modules?
- Importing a library from (or near) a script with the same name raises “AttributeError: module has no attribute” or an ImportError or NameError
- How can I do relative imports in Python?
- How to reload python module imported using `from module import *`
- Import statement works on PyCharm but not from terminal
- Recursive version of ‘reload’
- How to unimport a python module which is already imported?
- Should I use `import os.path` or `import os`?
- Python: Sorting items from top left to bottom right with OpenCV
- Import module works in terminal but not in IDLE
- Python, OpenCV: Increasing image brightness without overflowing UINT8 array