AttributeError: module 'pandas' has no attribute 'plotting' with tox
See original GitHub issuepandas
0.20.3 fails to import on every test when running tox.
tox
packages installed, besides my package:
cycler==0.10.0, matplotlib==2.0.2, numexpr==2.6.2, numpy==1.13.1, pandas==0.20.3, py==1.4.34, pyparsing==2.2.0, pytest==3.2.2, pytest-travis-fold==1.2.0, python-dateutil==2.6.1, pytz==2017.2, scipy==0.19.1, six==1.10.0, tables==3.4.2
-
platform linux -- Python 3.5.2, pytest-3.2.2, py-1.4.34, pluggy-0.4.0
-
all tests fail with the following error:
myfile.py:16: in <module>
import pandas as pd
.tox/3.5-nocov/lib/python3.5/site-packages/pandas/__init__.py:51: in <module>
plot_params = pandas.plotting._style._Options(deprecated=True)
E AttributeError: module 'pandas' has no attribute 'plotting'
Testing the same import in a virtualenv
without tox
works correctly.
Looks like it is a problem with pandas
, but could also be something regarding tox
(or even pytest
). Hopefully, someone more experienced with tox
can guide me here.
Output of pd.show_versions()
Taken from the virtualenv
I created to test outside tox
.
INSTALLED VERSIONS
commit: None python: 3.6.2.final.0 python-bits: 64 OS: Linux OS-release: 4.4.0-93-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: pt_PT.UTF-8
pandas: 0.20.3 pytest: 3.2.2 pip: 9.0.1 setuptools: 28.8.0 Cython: None numpy: 1.13.1 scipy: 0.19.1 xarray: None IPython: None sphinx: 1.6.3 patsy: None dateutil: 2.6.1 pytz: 2017.2 blosc: None bottleneck: None tables: 3.4.2 numexpr: 2.6.2 feather: None matplotlib: 2.0.2 openpyxl: None xlrd: None xlwt: None xlsxwriter: None lxml: None bs4: None html5lib: None sqlalchemy: None pymysql: None psycopg2: None jinja2: 2.9.6 s3fs: None pandas_gbq: None pandas_datareader: None None
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
Ahh, yeah that issue has been an unanticipated headache of switching to pytest.
I think there was a workaround where you add the change in https://github.com/pandas-dev/pandas/pull/16797/files to your conftest.py and pytest won’t complain? Otherwise, the next release is in about 2 weeks, and things should work.
Apologies for not being so concise, but I wanted to illustrate my
tox.ini
without omitting the potential source of the problem.I already tested your example in my machine and it is working.
So my next step was to build up step by step from that until I get the error reported, and it looks it comes from
pytest
.I have the following configuration in
setup.cfg
:After a quick test I found that the
--strict
option is the root of all evil. This led me to #16852 and #16680. Apparently you have already tackled this issue. I just complicated it a lot more because I could not identify the problem immediately. Hopefully, this should be fixed in the next bugfix release.