IBM / HNCDI-Explain-GeoDN

HNCDI Explain course notebooks for GeoDN
MIT License
2 stars 1 forks source link

Error thrown by contextily #2

Closed rosielickorish closed 7 months ago

rosielickorish commented 7 months ago

Seeing an error coming from cx.add_basemap(ax, alpha=0.5) in Part_1/3. Impact Function.ipynb. The issue appears to be related to the OpenSSL library used by contextily.

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
File /usr/lib64/python3.9/hashlib.py:164, in __hash_new(name, data, **kwargs)
    163 try:
--> 164     return _hashlib.new(name, data, **kwargs)
    165 except ValueError:
    166     # If the _hashlib module (OpenSSL) doesn't support the named
    167     # hash, try using our builtin implementations.
    168     # This allows for SHA224/256 and SHA384/512 support even though
    169     # the OpenSSL library prior to 0.9.8 doesn't provide them.

ValueError: [digital envelope routines] unsupported

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
Cell In[11], line 27
     24     plt.show()
     26 df = gdf.to_crs(epsg=3857)
---> 27 plot_buildings(df, building_type_column="archtype", basemap=True)

Cell In[11], line 19, in plot_buildings(gdf, building_type_column, legend_loc, figsize, basemap)
     17 # Add a basemap
     18 if basemap:
---> 19     cx.add_basemap(ax, alpha=0.5)
     21 # Show the plot
     22 plt.axis("off")

File /opt/app-root/lib64/python3.9/site-packages/contextily/plotting.py:134, in add_basemap(ax, zoom, source, interpolation, attribution, attribution_size, reset_extent, crs, resampling, zoom_adjust, **extra_imshow_args)
    130     left, right, bottom, top = _reproj_bb(
    131         left, right, bottom, top, crs, "epsg:3857"
    132     )
    133 # Download image
--> 134 image, extent = bounds2img(
    135     left, bottom, right, top, zoom=zoom, source=source, ll=False, zoom_adjust=zoom_adjust
    136 )
    137 # Warping
    138 if crs is not None:

File /opt/app-root/lib64/python3.9/site-packages/contextily/tile.py:262, in bounds2img(w, s, e, n, zoom, source, ll, wait, max_retries, n_connections, use_cache, zoom_adjust)
    260 preferred_backend = "threads" if (n_connections == 1 or not use_cache) else "processes"
    261 fetch_tile_fn = memory.cache(_fetch_tile) if use_cache else _fetch_tile
--> 262 arrays = Parallel(n_jobs=n_connections, prefer=preferred_backend)(
    263     delayed(fetch_tile_fn)(tile_url, wait, max_retries) for tile_url in tile_urls)
    264 # merge downloaded tiles
    265 merged, extent = _merge_tiles(tiles, arrays)

File /opt/app-root/lib64/python3.9/site-packages/joblib/parallel.py:1863, in Parallel.__call__(self, iterable)
   1861     output = self._get_sequential_output(iterable)
   1862     next(output)
-> 1863     return output if self.return_generator else list(output)
   1865 # Let's create an ID that uniquely identifies the current call. If the
   1866 # call is interrupted early and that the same instance is immediately
   1867 # re-used, this id will be used to prevent workers that were
   1868 # concurrently finalizing a task from the previous call to run the
   1869 # callback.
   1870 with self._lock:

File /opt/app-root/lib64/python3.9/site-packages/joblib/parallel.py:1792, in Parallel._get_sequential_output(self, iterable)
   1790 self.n_dispatched_batches += 1
   1791 self.n_dispatched_tasks += 1
-> 1792 res = func(*args, **kwargs)
   1793 self.n_completed_tasks += 1
   1794 self.print_progress()

File /opt/app-root/lib64/python3.9/site-packages/joblib/memory.py:655, in MemorizedFunc.__call__(self, *args, **kwargs)
    654 def __call__(self, *args, **kwargs):
--> 655     return self._cached_call(args, kwargs)[0]

File /opt/app-root/lib64/python3.9/site-packages/joblib/memory.py:528, in MemorizedFunc._cached_call(self, args, kwargs, shelving)
    500 def _cached_call(self, args, kwargs, shelving=False):
    501     """Call wrapped function and cache result, or read cache if available.
    502 
    503     This function returns the wrapped function output and some metadata.
   (...)
    526         Some metadata about wrapped function call (see _persist_input()).
    527     """
--> 528     func_id, args_id = self._get_output_identifiers(*args, **kwargs)
    529     metadata = None
    530     msg = None

File /opt/app-root/lib64/python3.9/site-packages/joblib/memory.py:699, in MemorizedFunc._get_output_identifiers(self, *args, **kwargs)
    697 """Return the func identifier and input parameter hash of a result."""
    698 func_id = _build_func_identifier(self.func)
--> 699 argument_hash = self._get_argument_hash(*args, **kwargs)
    700 return func_id, argument_hash

File /opt/app-root/lib64/python3.9/site-packages/joblib/memory.py:693, in MemorizedFunc._get_argument_hash(self, *args, **kwargs)
    692 def _get_argument_hash(self, *args, **kwargs):
--> 693     return hashing.hash(filter_args(self.func, self.ignore, args, kwargs),
    694                         coerce_mmap=(self.mmap_mode is not None))

File /opt/app-root/lib64/python3.9/site-packages/joblib/hashing.py:262, in hash(obj, hash_name, coerce_mmap)
    258     raise ValueError("Valid options for 'hash_name' are {}. "
    259                      "Got hash_name={!r} instead."
    260                      .format(valid_hash_names, hash_name))
    261 if 'numpy' in sys.modules:
--> 262     hasher = NumpyHasher(hash_name=hash_name, coerce_mmap=coerce_mmap)
    263 else:
    264     hasher = Hasher(hash_name=hash_name)

File /opt/app-root/lib64/python3.9/site-packages/joblib/hashing.py:169, in NumpyHasher.__init__(self, hash_name, coerce_mmap)
    159 """
    160     Parameters
    161     ----------
   (...)
    166         objects.
    167 """
    168 self.coerce_mmap = coerce_mmap
--> 169 Hasher.__init__(self, hash_name=hash_name)
    170 # delayed import of numpy, to avoid tight coupling
    171 import numpy as np

File /opt/app-root/lib64/python3.9/site-packages/joblib/hashing.py:59, in Hasher.__init__(self, hash_name)
     57 Pickler.__init__(self, self.stream, protocol=protocol)
     58 # Initialise the hash obj
---> 59 self._hash = hashlib.new(hash_name)

File /usr/lib64/python3.9/hashlib.py:170, in __hash_new(name, data, **kwargs)
    164     return _hashlib.new(name, data, **kwargs)
    165 except ValueError:
    166     # If the _hashlib module (OpenSSL) doesn't support the named
    167     # hash, try using our builtin implementations.
    168     # This allows for SHA224/256 and SHA384/512 support even though
    169     # the OpenSSL library prior to 0.9.8 doesn't provide them.
--> 170     return __get_builtin_constructor(name)(data)

File /usr/lib64/python3.9/hashlib.py:86, in __get_builtin_constructor(name)
     84 def __get_builtin_constructor(name):
     85     if _hashlib.get_fips_mode():
---> 86         raise ValueError('unsupported hash type ' + name + '(in FIPS mode)')
     87     cache = __builtin_constructor_cache
     88     constructor = cache.get(name)

ValueError: unsupported hash type md5(in FIPS mode)
rosielickorish commented 7 months ago

Removed add_basemap function.