-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ModuleNotFoundError: No module named 'cv2' #6
Comments
@safalabolo You should try installing opencv by running this command in your active python environment
This would install opencv to your environment which can be imported to script by
Refer to this link https://pypi.org/project/opencv-python/ |
Hi @ishwar97 and thank You for your response. After running in python notebook I have the following error message ImportError Traceback (most recent call last) ~/anaconda3/lib/python3.8/importlib/init.py in import_module(name, package) ~/anaconda3/lib/python3.8/importlib/_bootstrap.py in _gcd_import(name, package, level) ~/anaconda3/lib/python3.8/importlib/_bootstrap.py in find_and_load(name, import) ~/anaconda3/lib/python3.8/importlib/_bootstrap.py in find_and_load_unlocked(name, import) ~/anaconda3/lib/python3.8/importlib/_bootstrap.py in _load_unlocked(spec) ~/anaconda3/lib/python3.8/importlib/_bootstrap.py in module_from_spec(spec) ~/anaconda3/lib/python3.8/importlib/_bootstrap_external.py in create_module(self, spec) ~/anaconda3/lib/python3.8/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds) ImportError: libgdal.so.27: cannot open shared object file: No such file or directory During handling of the above exception, another exception occurred: ModuleNotFoundError Traceback (most recent call last) ~/segment-anything-eo/sameo.py in ~/segment-anything-eo/tms2geotiff/tms2geotiff.py in ~/anaconda3/lib/python3.8/site-packages/osgeo/init.py in ~/anaconda3/lib/python3.8/site-packages/osgeo/init.py in swig_import_helper() ~/anaconda3/lib/python3.8/importlib/init.py in import_module(name, package) ModuleNotFoundError: No module named '_gdal' |
@safalabolo Try running
This will install osgeo in your active py environmentAfter that try
If this runs without throwing an error, then try running your script. That should work. |
Hi @ishwar97 thank You. (base) safalabolo@safalabolo-HPE-340it:~$ pip install osgeo
|
Can you try replacing gdal with osgeo? |
Oh... Unfortunately, installing GDAL is always a pain... And installation process depends on particular platform, there is no universal solution... You could try docker with preinstalled GDAL, but in this case you will need to install torch properly to work with GPU. If you will not use functions for downloading form XYZ (TMS) services, you could just comment all lines with tms2geotiff and in this case there be only rasterio module in use (no GDAL) and you will be able to process tiff files. |
Thank You for sharing your work.
After executing the lines of code in my Jupiter notebook
I get the following error message.
import cv2
import matplotlib.pyplot as plt
from sameo import SamEO
ModuleNotFoundError Traceback (most recent call last)
/tmp/ipykernel_6910/2586265285.py in
----> 1 import cv2
2 import matplotlib.pyplot as plt
3 from sameo import SamEO
ModuleNotFoundError: No module named 'cv2'**
Any help is appreciated
Thanks in advance for your support
The text was updated successfully, but these errors were encountered: