Eo-learn import error in module eolearn.core.utilities

Hello all,

I have a persistent error trying to use the eo-learn library, even with example scripts like: link. The error occurs just by trying to import the eo-learn modules in the script; I am always getting the error:
No module named ‘eolearn.core.utilities’

I’ve installed the eo-learn library following the instructions in the documentation. But until now, I was not able to sort this error.

I would really appreciate it if you could help me.

Hi Sergio,

a lot of issues with package versions arose when we released eo-learn 1.0 and I suspect this is one of them as well. I have some additional questions:

  1. Are you installing via pip or conda?
  2. What are the versions of your eo-learn and eo-learn.core. If you’re using pip you can do that with pip show eo-learn and pip show eo-learn.core. For conda you can do conda list and find them in the listed packages.

Hello Ziga,

  1. I am installing via conda.
  2. The following are the versions:
  • eo-learn = 0.10.1.
  • eo-learn-core = 1.0.1.

Thanks for your reply.

Sadly our updates for conda recipes haven’t been reviewed yet, so you will need to wait a bit before you can install eo-learn 1.0 which works with the example you linked.

You can find the same example, but compatible with version 0.10.1, on our github page here.

Thank you Ziga, but I already tried with the example that you share and got the same error. However, may I try another version of eo-learn for conda? Which version do you recommend?

Just to double-check, did you try the example I linked to? So the example at the 0.10.1 tag of git history, and not the same example on the main branch?

If that one does not work then there is a problem in the eo-learn you have installed (not just it’s version).

Yes, I tried with the 0.10.1 tag example, and I am getting the same error. I don’t know what could go wrong with the installation, I performed it following the instructions in this link for the anaconda example.

Should I try with a pip installation instead of using anaconda?

We had some issues with the conda recipes (and we are waiting for them to accept the fix), so right now the conda installation is a bit risky. I would advise installing with pip, since that is regularly tested by us. The conda version should also be viable soon if you wish to switch back later.

Hello Ziga, just to let you know that the pip installation went fine. Now I can import all the libraries without issues. Thank you so much for the workaround, I hope you can fix the anaconda version soon.

I’m having the same proble with eolearn.core

--------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In [1], line 24
     21 from shapely.geometry import Polygon
     22 from tqdm.auto import tqdm
---> 24 from eolearn.core import (
     25     EOExecutor,
     26     EOPatch,
     27     EOTask,
     28     FeatureType,
     29     LinearWorkflow,
     30     LoadTask,
     31     OverwritePermission,
     32     SaveTask,
     33     ZipFeatureTask,
     34 )
     35 from eolearn.coregistration import ECCRegistration
     36 from eolearn.features import LinearInterpolation, SimpleFilterTask

ModuleNotFoundError: No module named 'eolearn'

I’ve installed everything on Windows 10 with Python 3.9.13 and my eo libraries version are

type or paName: eo-learn
Version: 1.2.0

Name: eo-learn-core
Version: 1.2.0

thanks

Hi, how did you install the packages?
If you open up python in your terminal, does the following work:

>>> from eolearn.core import __version__
>>> print(__version__)
1.2.0

of course I’ve installed the packages correctly, and in fact the commands you mentioned gives me the exact version.

This is the full error

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In [1], line 24
     21 from shapely.geometry import Polygon
     22 from tqdm.auto import tqdm
---> 24 from eolearn.core import (
     25     EOExecutor,
     26     EOPatch,
     27     EOTask,
     28     FeatureType,
     29     LinearWorkflow,
     30     LoadTask,
     31     OverwritePermission,
     32     SaveTask,
     33     ZipFeatureTask,
     34 )
     35 from eolearn.coregistration import ECCRegistration
     36 from eolearn.features import LinearInterpolation, SimpleFilterTask

ImportError: cannot import name 'LinearWorkflow' from 'eolearn.core' (C:\Users\user1\AppData\Local\Programs\Python\Python39\lib\site-packages\eolearn\core\__init__.py)

The last line maybe can be useful but I don’r really know what “LinearWorkflow” is.

and this is are the libs I’ve installed

pip install eo-learn

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

The full error is indeed very helpful. You appear to be running code (possibly a jupyter notebook) that is outdated. LinearWorkflow has been removed in eo-learn 1.0.0, which is why the import fails. Are you running an example notebook? Perhaps I can point you to a similar one which is kept up-to-date.

thanks @ziga.luksic

I’m running this exact notebook here on a local jupyter kernel

We sadly only have a much smaller timelapse GIF example.

You can try using linearly_connect_tasks, which replaced the LinearWorkflow. You can see a minor example of it here, hidden in the comment. Basically instead of LinearWorkflow(a, b, c) you can do EOWorkflow(linearly_connect_tasks(a, b, c)). But I cannot guarantee that is the only thing that needs to be updated.