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


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 --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\”, line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File “c:\users\username\anaconda3\lib\multiprocessing\”, line 125, in _main
File “c:\users\username\anaconda3\lib\multiprocessing\”, line 236, in prepare
File “c:\users\username\anaconda3\lib\multiprocessing\”, line 287, in _fixup_main_from_path
main_content = runpy.run_path(main_path,
File “c:\users\username\anaconda3\lib\”, line 265, in run_path
return _run_module_code(code, init_globals, run_name,
File “c:\users\username\anaconda3\lib\”, line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File “c:\users\username\anaconda3\lib\”, line 87, in run_code
exec(code, run_globals)
File “C:\Users\username\desktop\”, 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\”, 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

What could be the reason for this problem?
Could you help me?

Hi @Ko.o

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 @Ko.o ! 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…