gee-community/geemap

Activation Code Error

Closed this issue · 2 comments

Environment Information MacBook Pro M3 / Safari Browser

Please run the following code on your computer and share the output with us so that we can better debug your issue:

import geemap
geemap.Report()

Description

entered the code from google

What I Did


PermissionError Traceback (most recent call last)
File /opt/miniconda3/envs/gee/lib/python3.8/site-packages/ee/oauth.py:177, in write_private_json(json_path, info_dict)
176 try:
--> 177 os.makedirs(dirname)
178 except OSError as e:

File /opt/miniconda3/envs/gee/lib/python3.8/os.py:223, in makedirs(name, mode, exist_ok)
222 try:
--> 223 mkdir(name, mode)
224 except OSError:
225 # Cannot rely on checking for EEXIST, since the operating system
226 # could give priority to other errors like EACCES or EROFS

PermissionError: [Errno 13] Permission denied: '/Users/douglasgray/.config/earthengine'

During handling of the above exception, another exception occurred:

Exception Traceback (most recent call last)
Cell In[7], line 3
1 import ee
2 import geemap
----> 3 ee.Authenticate()
4 ee.Initialize(project='ee-dgray')
5 m = geemap.Map()

File /opt/miniconda3/envs/gee/lib/python3.8/site-packages/ee/init.py:124, in Authenticate(authorization_code, quiet, code_verifier, auth_mode, scopes, force)
93 def Authenticate(
94 authorization_code: Optional[str] = None,
95 quiet: Optional[bool] = None,
(...)
99 force: bool = False,
100 ) -> Optional[bool]:
101 """Prompts the user to authorize access to Earth Engine via OAuth2.
102
103 Args:
(...)
122 True if we found valid credentials and didn't run the auth flow.
123 """
--> 124 return oauth.authenticate(authorization_code, quiet, code_verifier, auth_mode,
125 scopes, force)

File /opt/miniconda3/envs/gee/lib/python3.8/site-packages/ee/oauth.py:512, in authenticate(cli_authorization_code, quiet, cli_code_verifier, auth_mode, scopes, force)
509 if flow.display_instructions(quiet):
510 _open_new_browser(flow.auth_url)
--> 512 flow.save_code()

File /opt/miniconda3/envs/gee/lib/python3.8/site-packages/ee/oauth.py:562, in Flow.save_code(self, code)
560 redirect_uri = self.server.url
561 code = self.server.fetch_code() # Waits for oauth callback
--> 562 _obtain_and_write_token(code, self.code_verifier, self.scopes, redirect_uri)

File /opt/miniconda3/envs/gee/lib/python3.8/site-packages/ee/oauth.py:247, in _obtain_and_write_token(auth_code, code_verifier, scopes, redirect_uri)
245 client_info['refresh_token'] = token
246 client_info['scopes'] = scopes
--> 247 write_private_json(get_credentials_path(), client_info)
248 print('\nSuccessfully saved authorization token.')

File /opt/miniconda3/envs/gee/lib/python3.8/site-packages/ee/oauth.py:181, in write_private_json(json_path, info_dict)
178 except OSError as e:
179 if e.errno != errno.EEXIST:
180 # pylint:disable=broad-exception-raised,raise-missing-from
--> 181 raise Exception('Error creating directory %s: %s' % (dirname, e))
182 # pylint:enable=broad-exception-raised,raise-missing-from
184 file_content = json.dumps(info_dict)

Exception: Error creating directory /Users/douglasgray/.config/earthengine: [Errno 13] Permission denied: '/Users/douglasgray/.config/earthengine'

report:

Thu Jul 18 10:26:39 2024 EDT
OS Darwin (macOS 14.5) CPU(s) 16 Machine arm64
Architecture 64bit RAM 128.0 GiB Environment Jupyter
File system apfs
Python 3.8.18 | packaged by conda-forge | (default, Dec 23 2023, 17:25:47) [Clang 16.0.6 ]
geemap 0.33.0 ee 0.1.411 ipyleaflet 0.18.2
folium 0.17.0 jupyterlab 4.2.3 notebook 7.2.1
ipyevents 2.0.2

This is not really a geemap issue. It is your miniconda installation issue. You should not install it to /opt/miniconda3/, which your user does not have permission to write files to. You should create new env under your user directory.