Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
SentinelHubRequest
✓ from sentinelhub import SentinelHubRequest
✗ from sentinelhub.request import SentinelHubRequest
Request moved to top-level in v3.0, old submodule breaks
BBox
✓ from sentinelhub import BBox
✗ from sentinelhub.geometry import BBox
BBox moved to top-level in v3.0
CRS
✓ from sentinelhub import CRS
CRS is a top-level class in v3.x
DataCollection
✓ from sentinelhub import DataCollection
✗ from sentinelhub.constants import DataCollection
DataCollection moved to top-level in v3.0
Fetches a Sentinel-2 L2A image (single band) as a numpy array. Requires SH_CLIENT_ID and SH_CLIENT_SECRET environment variables.
from sentinelhub import SentinelHubRequest, BBox, CRS, MimeType, DataCollection
import datetime
client_id = os.environ.get('SH_CLIENT_ID', '')
client_secret = os.environ.get('SH_CLIENT_SECRET', '')
if client_id and client_secret:
from sentinelhub import SHConfig
config = SHConfig()
config.sh_client_id = client_id
config.sh_client_secret = client_secret
bbox = BBox([14.06, 45.77, 14.97, 46.23], crs=CRS.WGS84)
request = SentinelHubRequest(
evalscript='//VERSION=3\nfunction setup() { return { input: ["B02"], output: { bands: 1 } }; }\nfunction evaluatePixel(sample) { return [sample.B02]; }',
input_data=[
SentinelHubRequest.input_data(
data_collection=DataCollection.SENTINEL2_L2A,
time_interval=('2023-07-01', '2023-07-31')
)
],
responses=[
SentinelHubRequest.output_response('default', MimeType.PNG)
],
bbox=bbox,
size=[512, 512],
config=config
)
image = request.get_data()[0]
print('Image shape:', image.shape)
Debug
Known issues
breakingVersion 3.0.0 restructured imports: many classes moved to top-level. Old import paths like sentinelhub.request, sentinelhub.geometry, sentinelhub.constants no longer work.fixUpdate imports to from sentinelhub import SentinelHubRequest, BBox, CRS, DataCollection, MimeType, SHConfig
affects: <3.0.0 -> >=3.0.0
deprecatedSentinelHubRequest.get_data() returns a list of numpy arrays; the method get_data_list() is deprecated in favor of get_data().fixUse get_data()[0] instead of get_data_list()[0]
affects: >=3.10.0
gotchaAuthentication using SHConfig must be passed explicitly to SentinelHubRequest; without config, it falls back to environment variables which may not be set.fixAlways create a config with your credentials and pass it as the config parameter.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'sentinelhub.request'
Import path changed in v3.0.
fixUse from sentinelhub import SentinelHubRequest
AttributeError: module 'sentinelhub' has no attribute 'constants'
Constants moved to top-level in v3.0.
fixUse from sentinelhub import DataCollection, MimeType, CRS
sentinelhub.SHConfigError: No credentials provided
No client id/secret provided.
fixSet SH_CLIENT_ID and SH_CLIENT_SECRET environment variables or create an SHConfig object with credentials.
Upgrade
Version history
3.11.5latest on PyPI · released Mar 10, 2026
Audit
Dependencies
numpyrequiredImage processing
requestsrequiredHTTP calls
oauthlibrequiredAuthentication
PillowrequiredImage handling
shapelyoptionalGeometries