Skip to main content

Cannot import name 'get_s2_pixel_cloud_detector' from 'eolearn.mask'

  • 26 April 2024
  • 3 replies
  • 29 views

Hi,


I am working on a project to detect plastics using Sentinel-2.

I am trying to follow theA pipeline for detecting macro-plastics in coastal waters using Sentinel 2 data


python download_features.py --features data/features.csv

I get an error when I run.


I get the following Error:


Traceback (most recent call last):

File “”, line 1, in

File “c:\users\username\anaconda3\lib\multiprocessing\spawn.py”, line 116, in spawn_main

exitcode = _main(fd, parent_sentinel)

File “c:\users\username\anaconda3\lib\multiprocessing\spawn.py”, line 125, in _main

prepare(preparation_data)

File “c:\users\username\anaconda3\lib\multiprocessing\spawn.py”, line 236, in prepare

_fixup_main_from_path(datan‘init_main_from_path’])

File “c:\users\username\anaconda3\lib\multiprocessing\spawn.py”, line 287, in _fixup_main_from_path

main_content = runpy.run_path(main_path,

File “c:\users\username\anaconda3\lib\runpy.py”, line 265, in run_path

return _run_module_code(code, init_globals, run_name,

File “c:\users\username\anaconda3\lib\runpy.py”, line 97, in _run_module_code

_run_code(code, mod_globals, init_globals,

File “c:\users\username\anaconda3\lib\runpy.py”, line 87, in run_code

exec(code, run_globals)

File “C:\Users\username\desktop\download_features.py”, line 21, in

from plasticfinder.tasks.combined_masks import CombineMask

File "C:\Users\username\desktop\plasticfinder\tasks_init
.py", line 6, in
module = loader.find_module(module_name).load_module(module_name)

File “C:\Users\username\desktop\plasticfinder\tasks\cloud_classifier.py”, line 1, in

from eolearn.mask import get_s2_pixel_cloud_detector , AddCloudMaskTask

ImportError: cannot import name ‘get_s2_pixel_cloud_detector’ from ‘eolearn.mask’ (C:\Users\username.virtualenvs\username-SQMDgPYL\lib\site-packages\eolearn\mask_init
.py)


What could be the reason for this problem?

Could you help me?

Hi,

Wow, nice project, I didn’t know about it.

In eo-learn version 0.9.0 the tasks for cloud detection using s2cloudless have been updated. I expect the code you are referring to was implemented using older version of eo-learn.

The “Compute cloud maps yourself” section of the example notebook fo CloudMaskTask shows how to create a task for cloud masking. I assume that you should change the cloud_classifier task in the original code, but I didn’t look at the code for detecting macro plastics in details.

A side note: it might be a good idea to let the authors know about this.

Kind regards


Thank you for your feedback .


Hi, I’m too working on this project and having the same error, Have you figured out the solution? if yes will you be able to share it…


Reply