Select to view content in your preferred language

ArcGIS API Conda Environment SSL Issues

914
4
06-09-2023 02:39 PM
Labels (1)
blueautumn
New Contributor

I'm on a M1 mac and use a VDI for windows. I created a conda environment in each (arcgis-env) and used pip install arcgis. I also only have access to ArcGIS Online, not Pro.

When I run the following in Jupyter Notebooks Visual Studio Code:

import arcgis
from arcgis.gis import GIS

gis = GIS()
map = gis.map()
map.basemap = "streets"
map

I get this error in both os:

TypeError                                 Traceback (most recent call last)
Cell In[1], line 4
      1 import arcgis
      2 from arcgis.gis import GIS
----> 4 gis = GIS()
      5 map = gis.map()
      6 map.basemap = "streets"

File /opt/homebrew/Caskroom/miniforge/base/envs/arcgis-env/lib/python3.9/site-packages/arcgis/gis/__init__.py:586, in GIS.__init__(self, url, username, password, key_file, cert_file, verify_cert, set_active, client_id, profile, **kwargs)
    580         raise RuntimeError(
    581             "An untrusted SSL error occurred when attempting to connect to the provided GIS.\n"
    582             "If you trust this server and want to proceed, add 'verify_cert=False' as an "
    583             "argument when connecting to the GIS."
    584         )
    585     else:
--> 586         raise e
    587 try:
    588     if (
    589         url.lower().find("arcgis.com") > -1
    590         and self._portal.is_logged_in
    591         and self._portal.con._auth.lower() == "oauth"
    592     ):

File /opt/homebrew/Caskroom/miniforge/base/envs/arcgis-env/lib/python3.9/site-packages/arcgis/gis/__init__.py:525, in GIS.__init__(self, url, username, password, key_file, cert_file, verify_cert, set_active, client_id, profile, **kwargs)
...
    541     )
    542     self._session.mount("http://", a)
    543     self._session.mount("https://", a)

TypeError: __init__() got an unexpected keyword argument 'method_whitelist'

What can I do to fix this? For the VDI, should I also do pip install arcgispro?

0 Kudos
4 Replies
DanPatterson
MVP Esteemed Contributor

Did you go through the recommended installation documents?

Package managers | ArcGIS API for Python


... sort of retired...
0 Kudos
blueautumn
New Contributor

So for the VDI, it turns out there were problems with downloading all the packages and I just had to wait it out and remake the environment etc. However, I'm still facing issues with my M1 MacBook. The "conda install -c esri arcgis" gives me the following error:

 

Retrieving notices: ...working... done
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - arcgis

Current channels:

  - https://conda.anaconda.org/esri/osx-arm64
  - https://conda.anaconda.org/esri/noarch
  - https://conda.anaconda.org/conda-forge/osx-arm64
  - https://conda.anaconda.org/conda-forge/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

 

I also get the same SSL error when I run the code in the original post within VS Code using the Jupyter Extension.

0 Kudos
DanPatterson
MVP Esteemed Contributor

See

Step by Step on macOS: A GIS Environment

Understanding Conda | ArcGIS API for Python

or check

Esri/arcgis-python-api: Documentation and samples for ArcGIS API for Python (github.com)

for related "Issues" on their github site


... sort of retired...
0 Kudos
blueautumn
New Contributor

So it turns out that the package managers recommended for macs did not even have arcgis, including the official Anaconda one (at least for M1 Arm). The pipenv method never worked on either, I'm assuming because it's installing/not installing so many things compared to conda. My VDI also ended up getting blocked by the company's firewall. So, I'm jus going to go between using Docker and Parallels for Desktop. Thanks for your help! Let me know if I got it wrong somewhere.

0 Kudos