Closed
Description
Code Sample:
$mkvirtualenv pandas-deprecation-repro --python=python2.7
$workon pandas-deprecation-repro
$pip install pandas
$PYTHONWARNINGS=error::FutureWarning python -c "import pandas"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/davidchudzicki/.virtualenvs/pandas-deprecation-repro/lib/python2.7/site-packages/pandas/__init__.py", line 84, in <module>
from ._version import get_versions
File "/Users/davidchudzicki/.virtualenvs/pandas-deprecation-repro/lib/python2.7/site-packages/pandas/_version.py", line 9, in <module>
import json
File "/Users/davidchudzicki/.virtualenvs/pandas-deprecation-repro/lib/python2.7/site-packages/pandas/json.py", line 6, in <module>
"pandas.io.json instead", FutureWarning, stacklevel=2)
FutureWarning: The pandas.json module is deprecated and will be removed in a future version. Please import from pandas.io.json instead
Problem description
I help with a package that wants to run our tests with PYTHONWARNINGS=error::FutureWarning
, so that we can learn about changes in our dependencies and can avoid passing on deprecation warnings to our users. When we turn this on, import pandas
gives us an error.
It looks like _version.py
(autogenerated as part of your release process?) includes an import json
that's interpreted (incorrectly) as referring to the old pandas.json
.
$cat /Users/davidchudzicki/.virtualenvs/pandas-deprecation-repro/lib/python2.7/site-packages/pandas/_version.py
# This file was generated by 'versioneer.py' (0.15) from
# revision-control system data, or from the parent directory name of an
# unpacked source archive. Distribution tarballs contain a pre-generated copy
# of this file.
from warnings import catch_warnings
with catch_warnings(record=True):
import json
import sys
version_json = '''
{
"dirty": false,
"error": null,
"full-revisionid": "a00154dcfe5057cb3fd86653172e74b6893e337d",
"version": "0.22.0"
}
''' # END VERSION_JSON
def get_versions():
return json.loads(version_json)
Output of pd.show_versions()
>>> import pandas as pd
>>> pd.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 2.7.13.final.0
python-bits: 64
OS: Darwin
OS-release: 16.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: None.None
pandas: 0.22.0
pytest: None
pip: 9.0.1
setuptools: 38.5.1
Cython: None
numpy: 1.14.1
scipy: None
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2018.3
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None