Skip to main content

I was using sentinel hub OGC API to download some Sentinel 2A products and was using Jupiter notebook to download the data. As a process I mention my configuration id that gives access to the data layer and then call for the download request. It was working perfectly fine until today when I upgraded the sentinel hub library in python 3.9 and now its constantly throwing the error of permission denied (Err no 13)


Traceback (most recent call last):


PermissionError: [Errno 13] Permission denied: ‘/Users/jagriti/.config/sentinelhub’


please assist to resolve this

Hi,


As part of the new release of the Sentinel Hub Python Package, changes were made regarding the Sentinel Hub configuration file. You can read more about this in the Release Notes.


I would suggest reading through them and adjusting your configuration accordingly.


But it was working absolutely fine till now and only the upgrade issue threw this problem.


and the same account has been configured in a different system and it works perfectly fine there?


Could you please help in setting my sentinel hub account in python 3.9?


As I said, changes have been made to the configuration. Please go through the documentation on this here.


I have also just updated my Sentinel Hub Python Package to 3.9.0 and needed to reenter my sh_client_id and sh_client_secret so I expect that you will need to do the same.




this is the error I am getting. I am not even allowed to change anything in the config file

In your command line you should be able to run the following command. If you are using a virtual environment make sure that it is activated.


sentinelhub.config --sh_client_id 'xxxxxxxxxxxx' --sh_client_secret 'xxxxxxxxxxxxxxxxxxxxx'



william.ray:


--sh_client_secret



still same error William, its not even allowing me to touch the config file or do any changes in them. but this same things works completely on a different windows computer and without specifically mentioning the client id


OK I don’t have enough knowledge of the permissions and settings that are on your system. Can you confirm your operating system and environment please, I am confused as you mention Windows but your screenshot is from Mac OS.


yes I am working on macOS Monterey, version 12.0.1. Also I am using python 3.9 to download data from sentinel hub WCS layers. I have been doing this since last year and never have I faced any problem. Today morning, I was showing it to one of my colleagues who has a windows system and it ran completely fine on his laptop.


during the same time, I accidentally upgraded sentinel hub and since then I am facing this issue. I tried uninstalling and reinstalling sentinel hub again, but the moment I call sentinel hub as a library, it says the permission is denied.


and he has used the id of configuration utility which I have setup on my sentinel hub account



Please run the following cells:


# Set up configuration tool
config = SHConfig()

if not config.sh_client_id or not config.sh_client_secret:
print("Warning! To use Process API, please provide the credentials (OAuth client ID and client secret).")

Running the below cell will return your configuration (don’t share this in the public forum). If your client id and client secret are empty you will need reenter these credentials.


config



I tried entering my client ID and secret ID, but again, it throws this error

Please help me out, my entire work is stopper, I have tried to uninstall and reinstall multiple times, but still the same issue


Hi, in the recent update the configuration file was moved to the ~/.config/sentinelhub/config.toml, and, judging by the error, your python process seems to not have permissions to access/modify it.

Workaround

To avoid you having issues, here is a possible workaround:

config = SHConfig(use_defaults=True) 
# this will completely ignore looking into the file
# so the permission error should go away
config.instance_id = "somethingsomething"
...

You then have to pass this config around explicitly, any method that will be called without config=config might try to call SHConfig() inside and crash. So this is clearly just a temporary workaround so you can continue your work.

Possible solution

Looking at your full stack-trace, it could just be that the process does not have sufficient permissions to CREATE things. So try creating the following manually:

  • create the folder .config in /Users/jagriti/, inside create a folder sentinelhub
  • in /Users/jagriti/.config/sentinelhub/ create a file named config.toml
  • put the following in the config file (filling in the appropriate credentials ofcourse):
>default-profile]
instance_id = "your-instance-id"
sh_client_id = "your-client-id"
sh_client_secret = "your-client-secret"

Try calling SHConfig() afterwards.


Hi,

could you also provide the information on the permissions of the related files by running:

  • ls -l ~/.config | grep sentinelhub
  • ls -l ~/.config/sentinelhub

and showing us the output?

Cheers


Thanks for the response


For now I have installed sentinel hub version 3.8.4 and its working fine. I’ll try this solution next week as I am in process of executing an important code.


Reply