Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot import name 'Literal' from 'typing' #55

Closed
leomiquelutti opened this issue Nov 26, 2021 · 1 comment
Closed

cannot import name 'Literal' from 'typing' #55

leomiquelutti opened this issue Nov 26, 2021 · 1 comment

Comments

@leomiquelutti
Copy link

Dear,

in Python 3.7 with a simple import subsurface I get the following error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_16000/343840351.py in <module>
----> 1 import subsurface as sb
     2 from subsurface.reader import ReaderFilesHelper
     3 from subsurface.reader.wells import read_collar, read_lith, read_survey, WellyToSubsurfaceHelper, welly_to_subsurface

~\anaconda3\envs\gempy\lib\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py in _import(name, *args, **kwargs)
   140         flag = -1
   141     pyside_feature_dict[importing_module] = flag
--> 142     return original_import(name, *args, **kwargs)
   143 
   144 _is_initialized = False

~\anaconda3\envs\gempy\lib\site-packages\subsurface\__init__.py in <module>
----> 1 import subsurface.reader
     2 import subsurface.interfaces
     3 import subsurface.writer
     4 from subsurface.structs import *
     5 from ._version import __version__

~\anaconda3\envs\gempy\lib\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py in _import(name, *args, **kwargs)
   140         flag = -1
   141     pyside_feature_dict[importing_module] = flag
--> 142     return original_import(name, *args, **kwargs)
   143 
   144 _is_initialized = False

~\anaconda3\envs\gempy\lib\site-packages\subsurface\reader\__init__.py in <module>
     3 from .profiles import *
     4 
----> 5 from .topography.topo_core import read_structured_topography, read_unstructured_topography
     6 
     7 from .readers_data import ReaderFilesHelper, ReaderWellsHelper, RawDataOptions

~\anaconda3\envs\gempy\lib\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py in _import(name, *args, **kwargs)
   140         flag = -1
   141     pyside_feature_dict[importing_module] = flag
--> 142     return original_import(name, *args, **kwargs)
   143 
   144 _is_initialized = False

~\anaconda3\envs\gempy\lib\site-packages\subsurface\reader\topography\topo_core.py in <module>
     1 import numpy as np
     2 
----> 3 from subsurface.reader.readers_data import ReaderFilesHelper, ReaderUnstructuredHelper
     4 from subsurface.structs import StructuredData, UnstructuredData
     5 from subsurface.reader.mesh.surfaces_api import read_2d_mesh_to_unstruct

~\anaconda3\envs\gempy\lib\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py in _import(name, *args, **kwargs)
   140         flag = -1
   141     pyside_feature_dict[importing_module] = flag
--> 142     return original_import(name, *args, **kwargs)
   143 
   144 _is_initialized = False

~\anaconda3\envs\gempy\lib\site-packages\subsurface\reader\readers_data.py in <module>
     2 import io
     3 from dataclasses import dataclass, field
----> 4 from typing import Union, Literal, Dict, Optional, List, Callable, Any
     5 
     6 import numpy as np

ImportError: cannot import name 'Literal' from 'typing' (C:\Users\leomi\anaconda3\envs\gempy\lib\typing.py)

I assume the error is because typing.Literal is only available from Python 3.8 and up. However, the setup.py file in the subsurface repo states that it should work on Python 3.7.

Any ideas?

@Japhiolite
Copy link
Member

Hi @leomiquelutti

it's a bit late, but...: Yes, Literal is implemented with Python 3.8. Thus, the setup.py should be updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants