Skip to content

Binder environment does not seem to render correctly #790

@Carsopre

Description

@Carsopre

Ra2ce version checks

  • I have checked that this issue has not already been reported.
  • I have checked that this bug exists on the latest version of Ra2ce in master here.

Reproducible example

  1. Go to https://mybinder.org/v2/gh/Deltares/ra2ce/jupyter-binder
  2. The environment should build correctly, and after a while, show you the available jupyter notebooks.
  3. Try to run example accessibility_equity_anylisis.ipnb.
  4. It will display several warnings as:
    • .../pyogrio/...: RuntimeWarning: driver GPKG does not support open option DRIVER.
    • .../pyogrio/...: RuntimeWarning: driver ESRI Shapefile does not support open option DRIVER.
  5. A final fatal error will be shown in step 11 (last from post-processing results):
---------------------------------------------------------------------------
LossySetitemError                         Traceback (most recent call last)
File /srv/conda/envs/notebook/lib/python3.11/site-packages/pandas/core/internals/blocks.py:1115, in Block.setitem(self, indexer, value)
   1114 try:
-> 1115     casted = np_can_hold_element(values.dtype, value)
   1116 except LossySetitemError:
   1117     # current dtype cannot store value, coerce to common dtype

File /srv/conda/envs/notebook/lib/python3.11/site-packages/pandas/core/dtypes/cast.py:1750, in np_can_hold_element(dtype, element)
   1748         return element
-> 1750     raise LossySetitemError
   1752 if dtype.kind == "f":

LossySetitemError: 

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
Cell In[12], line 11
      8 if u != v:
      9     # Check if the edge (u, v) exists in the DataFrame
     10     if (u, v) in var_values:
---> 11         gdf.loc[(gdf['u'] == u) & (gdf['v'] == v), var] = var_values[(u, v)]
     13         # Check if the reverse edge (v, u) exists and hasn't been assigned a value yet
     14         if (v, u) not in var_values:

File /srv/conda/envs/notebook/lib/python3.11/site-packages/pandas/core/indexing.py:938, in _LocationIndexer.__setitem__(self, key, value)
    933 self._has_valid_setitem_indexer(key)
    935 iloc: _iLocIndexer = (
    936     cast("_iLocIndexer", self) if self.name == "iloc" else self.obj.iloc
    937 )
--> 938 iloc._setitem_with_indexer(indexer, value, self.name)

File /srv/conda/envs/notebook/lib/python3.11/site-packages/pandas/core/indexing.py:1953, in _iLocIndexer._setitem_with_indexer(self, indexer, value, name)
   1950 # align and set the values
   1951 if take_split_path:
   1952     # We have to operate column-wise
-> 1953     self._setitem_with_indexer_split_path(indexer, value, name)
   1954 else:
   1955     self._setitem_single_block(indexer, value, name)

File /srv/conda/envs/notebook/lib/python3.11/site-packages/pandas/core/indexing.py:2044, in _iLocIndexer._setitem_with_indexer_split_path(self, indexer, value, name)
   2041 else:
   2042     # scalar value
   2043     for loc in ilocs:
-> 2044         self._setitem_single_column(loc, value, pi)

File /srv/conda/envs/notebook/lib/python3.11/site-packages/pandas/core/indexing.py:2181, in _iLocIndexer._setitem_single_column(self, loc, value, plane_indexer)
   2171 if dtype == np.void:
   2172     # This means we're expanding, with multiple columns, e.g.
   2173     #     df = pd.DataFrame({'A': [1,2,3], 'B': [4,5,6]})
   (...)
   2176     # Here, we replace those temporary `np.void` columns with
   2177     # columns of the appropriate dtype, based on `value`.
   2178     self.obj.iloc[:, loc] = construct_1d_array_from_inferred_fill_value(
   2179         value, len(self.obj)
   2180     )
-> 2181 self.obj._mgr.column_setitem(loc, plane_indexer, value)

File /srv/conda/envs/notebook/lib/python3.11/site-packages/pandas/core/internals/managers.py:1503, in BlockManager.column_setitem(self, loc, idx, value, inplace_only)
   1501     col_mgr.setitem_inplace(idx, value)
   1502 else:
-> 1503     new_mgr = col_mgr.setitem((idx,), value)
   1504     self.iset(loc, new_mgr._block.values, inplace=True)

File /srv/conda/envs/notebook/lib/python3.11/site-packages/pandas/core/internals/managers.py:604, in BaseBlockManager.setitem(self, indexer, value)
    600     # No need to split if we either set all columns or on a single block
    601     # manager
    602     self = self.copy(deep=True)
--> 604 return self.apply("setitem", indexer=indexer, value=value)

File /srv/conda/envs/notebook/lib/python3.11/site-packages/pandas/core/internals/managers.py:442, in BaseBlockManager.apply(self, f, align_keys, **kwargs)
    440         applied = b.apply(f, **kwargs)
    441     else:
--> 442         applied = getattr(b, f)(**kwargs)
    443     result_blocks = extend_blocks(applied, result_blocks)
    445 out = type(self).from_blocks(result_blocks, [ax.view() for ax in self.axes])

File /srv/conda/envs/notebook/lib/python3.11/site-packages/pandas/core/internals/blocks.py:1118, in Block.setitem(self, indexer, value)
   1115     casted = np_can_hold_element(values.dtype, value)
   1116 except LossySetitemError:
   1117     # current dtype cannot store value, coerce to common dtype
-> 1118     nb = self.coerce_to_target_dtype(value, raise_on_upcast=True)
   1119     return nb.setitem(indexer, value)
   1120 else:

File /srv/conda/envs/notebook/lib/python3.11/site-packages/pandas/core/internals/blocks.py:468, in Block.coerce_to_target_dtype(self, other, raise_on_upcast)
    465     raise_on_upcast = False
    467 if raise_on_upcast:
--> 468     raise TypeError(f"Invalid value '{other}' for dtype '{self.values.dtype}'")
    469 if self.values.dtype == new_dtype:
    470     raise AssertionError(
    471         f"Did not expect new dtype {new_dtype} to equal self.dtype "
    472         f"{self.values.dtype}. Please report a bug at "
    473         "https://github.com/pandas-dev/pandas/issues."
    474     )

TypeError: Invalid value '8.144307136535645' for dtype 'int64'

Current behaviour

Seems than binder does not deal correctly with the dependencies, potentially because of the ones being fed directly to the conda environment?

Needs to be investigated and fixed. Otherwise discuss the possibility to drop or reduce support of the binder environment (cost / value evaluation).

The error might be related to #787 .

Desired behaviour

  • It should both work locally and remotely.
  • It might be worth investigating running it under a higher version than Python 3.11, as we now offer support to at least 3.13.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage requiredIssues without priority assessment or milestone.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions