EOlearn imports on colab

  • 26 April 2024
  • 1 reply
  • 1 view

Hello, after frying my machine I decided to try to run the Slovenia-cover-map notebook on Google Colab (eo-learn-examples/SI_LULC_pipeline.ipynb at main · sentinel-hub/eo-learn-examples · GitHub)
but there is a problem in importing some packages.
I did
!pip install jpy==0.7
!pip install SentinelHub
!pip install eo-learn-core
!pip install eo-learn-coregistration
!pip install eo-learn-features
!pip install eo-learn-geometry
!pip install eo-learn-io
!pip install eo-learn-mask
!pip install eo-learn-ml-tools
!pip install eo-learn-visualization
!pip install “opencv-python-headless<4.3”

before the imports but i got this

# Imports from eo-learn and sentinelhub-py
from eolearn.core import EOTask, EOPatch, EOWorkflow, FeatureType, OverwritePermission, \
    LoadTask, SaveTask, EOExecutor, ExtractBandsTask, MergeFeatureTask
from eolearn.io import SentinelHubInputTask, VectorImportTask, ExportToTiffTask
from eolearn.mask import AddValidDataMaskTask
from eolearn.geometry import VectorToRasterTask, PointSamplingTask, ErosionTask
from eolearn.features import LinearInterpolationTask, SimpleFilterTask, NormalizedDifferenceIndexTask
from sentinelhub import UtmZoneSplitter, BBox, CRS, DataCollection

The response was:

ImportError                               Traceback (most recent call last)

<ipython-input-34-42b1858dbc14> in <module>()
     35 from eolearn.core import EOTask, EOPatch, EOWorkflow, FeatureType, OverwritePermission,     LoadTask, SaveTask, EOExecutor, ExtractBandsTask, MergeFeatureTask
     36 from eolearn.io import SentinelHubInputTask, VectorImportTask, ExportToTiffTask
---> 37 from eolearn.mask import AddValidDataMaskTask
     38 from eolearn.geometry import VectorToRasterTask, PointSamplingTask, ErosionTask
     39 from eolearn.features import LinearInterpolationTask, SimpleFilterTask, NormalizedDifferenceIndexTask

ImportError: cannot import name 'AddValidDataMaskTask' from 'eolearn.mask' (/usr/local/lib/python3.7/dist-packages/eolearn/mask/__init__.py)


---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.

can someone help me find a solution?


1 reply

Hi @simone.vagnoni2,
the issue you are facing is due to miss-matched versions.

By installing eo-learn with pip you installed the 1.0.0 version. However the eo-learn-examples repository is not fully updated to 1.0.0.

But the examples on the eo-learn repository are all up-to-date. And since you’re interested in the land cover notebook, there is an updated equivalent on the eo-learn repo.

Reply


Planet Monitoring
Investors

© 2024 Planet Labs PBC. All rights reserved.
| Privacy Policy | California Privacy Notice | California Do Not Sell
Your Privacy Choices | Cookie Notice | Terms of Use