subsurface icon indicating copy to clipboard operation
subsurface copied to clipboard

Pandas Import Typing Error

Open trhallam opened this issue 3 years ago • 1 comments

I am getting an ImportError because I think the latest version of Pandas (v1.4) has changed some internal references to the Types used by Subsurface.

It looks like FilePathorBuffer has been split into two separate types. Perhaps it is not a great idea to import private Types from Pandas?

tests\test_accessor.py:29: in <module>
    from subsurface import StructuredData
C:\Users\trhal\miniconda3\envs\s38\lib\site-packages\subsurface\__init__.py:1: in <module>
    import subsurface.reader
C:\Users\trhal\miniconda3\envs\s38\lib\site-packages\subsurface\reader\__init__.py:5: in <module>
    from .topography.topo_core import read_structured_topography, read_unstructured_topography
C:\Users\trhal\miniconda3\envs\s38\lib\site-packages\subsurface\reader\topography\topo_core.py:3: in <module>
    from subsurface.reader.readers_data import ReaderFilesHelper, ReaderUnstructuredHelper
C:\Users\trhal\miniconda3\envs\s38\lib\site-packages\subsurface\reader\readers_data.py:9: in <module>
    from pandas._typing import FilePathOrBuffer
E   ImportError: cannot import name 'FilePathOrBuffer' from 'pandas._typing' (C:\Users\trhal\miniconda3\envs\s38\lib\site-packages\pandas\_typing.py)

trhallam avatar Feb 08 '22 14:02 trhallam

for the time being, I've added a check for which pandas version is loaded, and then using the respective types...not very elegant probably

Japhiolite avatar Jun 30 '22 16:06 Japhiolite

implemented in #61

Japhiolite avatar Mar 28 '23 12:03 Japhiolite