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 'json_normalize' from 'pandas.io.json' #10

Open
wsnoble opened this issue Dec 3, 2023 · 1 comment
Open

cannot import name 'json_normalize' from 'pandas.io.json' #10

wsnoble opened this issue Dec 3, 2023 · 1 comment

Comments

@wsnoble
Copy link

wsnoble commented Dec 3, 2023

I just installed gnomad_python_api according to the instructions (i.e., git clone followed by pip install from requirements.txt). However, the first example I copied from the README yields the following error:

$ python gnomad_api_cli.py -filter_by=gene_name -search_by="BRCA1" -dataset="gnomad_r2_1" -sv_dataset="gnomad_sv_r2_1"
Traceback (most recent call last):
  File "/Users/wnoble/software/gnomad_python_api/gnomad_api_cli.py", line 10, in <module>
    from pandas.io.json import json_normalize as json_normalize
ImportError: cannot import name 'json_normalize' from 'pandas.io.json' (/opt/homebrew/Caskroom/miniconda/base/envs/gnomad/lib/python3.10/site-packages/pandas/io/json/__init__.py)

I suspect there may be a version mismatch problem w.r.t. pandas. Here is what I get from conda list:

$ conda list
# packages in environment at /opt/homebrew/Caskroom/miniconda/base/envs/gnomad:
#
# Name                    Version                   Build  Channel
altair                    5.2.0                    pypi_0    pypi
argparse                  1.4.0                    pypi_0    pypi
attrs                     23.1.0                   pypi_0    pypi
blinker                   1.7.0                    pypi_0    pypi
bzip2                     1.0.8                h620ffc9_4  
ca-certificates           2023.08.22           hca03da5_0  
cachetools                5.3.2                    pypi_0    pypi
certifi                   2023.11.17               pypi_0    pypi
charset-normalizer        3.3.2                    pypi_0    pypi
click                     8.1.7                    pypi_0    pypi
gitdb                     4.0.11                   pypi_0    pypi
gitpython                 3.1.40                   pypi_0    pypi
idna                      3.6                      pypi_0    pypi
importlib-metadata        6.11.0                   pypi_0    pypi
jinja2                    3.1.2                    pypi_0    pypi
jsonschema                4.20.0                   pypi_0    pypi
jsonschema-specifications 2023.11.2                pypi_0    pypi
libffi                    3.4.4                hca03da5_0  
markdown-it-py            3.0.0                    pypi_0    pypi
markupsafe                2.1.3                    pypi_0    pypi
mdurl                     0.1.2                    pypi_0    pypi
ncurses                   6.4                  h313beb8_0  
numpy                     1.26.2                   pypi_0    pypi
openssl                   3.0.12               h1a28f6b_0  
packaging                 23.2                     pypi_0    pypi
pandas                    2.1.3                    pypi_0    pypi
pillow                    10.1.0                   pypi_0    pypi
pip                       23.3.1          py310hca03da5_0  
plotly                    5.18.0                   pypi_0    pypi
protobuf                  4.25.1                   pypi_0    pypi
pyarrow                   14.0.1                   pypi_0    pypi
pydeck                    0.8.1b0                  pypi_0    pypi
pygments                  2.17.2                   pypi_0    pypi
python                    3.10.13              hb885b13_0  
python-dateutil           2.8.2                    pypi_0    pypi
pytz                      2023.3.post1             pypi_0    pypi
readline                  8.2                  h1a28f6b_0  
referencing               0.31.1                   pypi_0    pypi
requests                  2.31.0                   pypi_0    pypi
rich                      13.7.0                   pypi_0    pypi
rpds-py                   0.13.2                   pypi_0    pypi
setuptools                68.0.0          py310hca03da5_0  
six                       1.16.0                   pypi_0    pypi
smmap                     5.0.1                    pypi_0    pypi
sqlite                    3.41.2               h80987f9_0  
streamlit                 1.29.0                   pypi_0    pypi
tenacity                  8.2.3                    pypi_0    pypi
tk                        8.6.12               hb8d0fd4_0  
toml                      0.10.2                   pypi_0    pypi
toolz                     0.12.0                   pypi_0    pypi
tornado                   6.4                      pypi_0    pypi
tqdm                      4.66.1                   pypi_0    pypi
typing-extensions         4.8.0                    pypi_0    pypi
tzdata                    2023.3                   pypi_0    pypi
tzlocal                   5.2                      pypi_0    pypi
urllib3                   2.1.0                    pypi_0    pypi
validators                0.22.0                   pypi_0    pypi
wheel                     0.41.2          py310hca03da5_0  
xz                        5.4.2                h80987f9_0  
zipp                      3.17.0                   pypi_0    pypi
zlib                      1.2.13               h5a0b063_0  

What version of pandas do you use? I am using python 3.10.

@poria129
Copy link

poria129 commented Jan 9, 2024

Just change : from pandas.io.json import json_normalize as json_normalize
Into
from pandas import json_normalize
This API is outdated and requires a proper update.

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