Skip to main content

Sentinel Install Error - Importing 'MosaickingOrder'

  • April 26, 2024
  • 7 replies
  • 110 views

Hi!
I was trying to play around with sentinel2 data and got the following error when trying to follow the documentation:
cannot import name 'MosaickingOrder' from 'sentinelhub.constants' (C:\Users\Darren\Anaconda3\lib\site-packages\sentinelhub\constants.py)
I have sentinel version 3.5.2 installed according to conda list

7 replies

  • 4852 posts replied to
  • April 26, 2024

Hi!

It seems like there is an issue with your installation. Did you install it via pip?
You can also double-check the version like this:

>>> import sentinelhub
>>> sentinelhub.__version__
'3.5.2'

If your version is indeed 3.5.2 then maybe try re-installing the package.


  • Author
  • 3963 posts replied to
  • April 26, 2024

Hi,
Thanks for the help!
I reinstalled conda as I think there was a dependency issue. After reinstalling, I used sentinelhub.__version__ and found sentinel hub was on 3.4.4 even after a fresh installation using:
$ conda install -c conda-forge sentinelhub[AWS]
When checking conda list after a restart, I get:
sentinelhub 3.4.4 pyhd8ed1ab_0 conda-forge


  • 4852 posts replied to
  • April 26, 2024

The conda-forge usually lags a bit behind with the versions. In the 3.4.4 version there is no MosaickingOrder yet, so it cannot be imported.

But you can just use a string instead, so MosaickingOrder.LEAST_RECENT is equivalent to "leastRecent". Even in the later versions strings are still an acceptable input, so the code shouldn’t break after the package is updated.


  • Author
  • 3963 posts replied to
  • April 26, 2024

Hi!
Thanks for your help! 🙂


  • Author
  • 3963 posts replied to
  • April 26, 2024

Hi,

I’m getting the same error. I have version 3.5.2 installed, have uninstalled and reinstalled with conda, still getting the same error, and still on version 3.5.2.

I can’t check the version as suggested above with sentinelhub.version, as the package won’t even import.

Is the fix here to revert to version 3.4.4? Bit confused, would appreciate any help!


  • 4852 posts replied to
  • April 26, 2024

Hi,

The highest sentinelhub-py version available for installation with Conda is 3.4.4. Installing the latest version 3.5.2 can only be done with pip.


  • Author
  • 3963 posts replied to
  • April 26, 2024

Oh right okay, just realised it never properly uninstalled the original version I installed with pip.
So which .py file is ziga.luksic suggesting to alter?