adamerose / PandasGUI

A GUI for Pandas DataFrames
MIT No Attribution
3.18k stars 230 forks source link

It doesn't work although I followed the .readme #130

Closed david03kimo closed 3 years ago

david03kimo commented 3 years ago

PLEASE FILL OUT THE TEMPLATE

Describe the bug
I run the sample code and get the error message.

File "/Users/davidliao/Documents/程式/code/Github/PythonBacktest/sample/test.py", line 2, in from pandasgui import show File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandasgui/init.py", line 15, in from pandasgui.gui import show File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandasgui/gui.py", line 13, in from pandasgui.store import PandasGuiStore, PandasGuiDataFrameStore File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandasgui/store.py", line 4, in from typing import Dict, List, Union, Iterable, Literal ImportError: cannot import name 'Literal' from 'typing' (/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/typing.py)

here's the sample code:

import pandas as pd from pandasgui import show df = pd.DataFrame({'a':[1,2,3], 'b':[4,5,6], 'c':[7,8,9]}) show(df)

Environment OS: 11.2.3 Python: 3.7.9 IDE: vscode

Package versions
TO GET ALL RELEVANT PACKAGE VERSIONS, RUN THIS COMMAND IN BASH AND PASTE THE OUTPUT

Davidde-MacBook-Pro:Backtest davidliao$ pip freeze | grep -i "pyqt|pandasgui|plotly|ipython|jupyter|notebook" ipython==7.18.1 ipython-genutils==0.2.0 jupyter==1.0.0 jupyter-client==6.1.7 jupyter-console==6.2.0 jupyter-core==4.6.3 jupyterlab-pygments==0.1.1 notebook==6.1.4 pandasgui @ git+https://github.com/adamerose/pandasgui.git@40327cd2763d830e761475df00d62b8cb29c3438 plotly==4.9.0 PyQt5==5.15.4 PyQt5-Qt5==5.15.2 PyQt5-sip==12.8.1 PyQtWebEngine==5.15.4 PyQtWebEngine-Qt5==5.15.2

adamerose commented 3 years ago

This is because I use typing.Literal which is only available in Python 3.8 and above. So a quick fix would be upgrade to Python 3.8. Fortunately it looks like it's possible to add backwards compatibility, so I'll do that when I get a chance and continue supporting Python 3.7

https://www.python.org/dev/peps/pep-0586/#backwards-compatibility