question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AttributeError: module 'pandas' has no attribute 'plotting' with tox

See original GitHub issue

pandas 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:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
TomAugspurgercommented, Sep 14, 2017

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.

0reactions
cachitascommented, Sep 15, 2017

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:

[tool:pytest]
norecursedirs =
	.git
	.tox
	.env
	dist
	build
python_files =
	test_*.py
	*_test.py
	tests.py
addopts =
	-rxEfsw
	--strict
	--ignore=docs/conf.py
	--ignore=setup.py
	--ignore=.eggs
	--doctest-modules
	--doctest-glob=\*.rst
	--tb=short

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python module 'pandas' has no attribute 'plotting'
And I encounter some troubles in coding. I run the code below in Jupyter and it raises an AttributeError . import pandas as...
Read more >
attributeerror: module 'pandas' has no attribute 'plotting
You've import pandas as PD but then trying to call pandas. AttributeError: module 'pandas' has no attribute 'dataframe' Solution.
Read more >
module 'pandas' has no attribute 'plotting'" Error. : r/learnpython
Getting "AttributeError: module 'pandas' has no attribute 'plotting'" Error. I'm learning to use folium and this is the code I wrote:.
Read more >
Type Object 'Pandas._Libs.Tslib._Tsobject' Has No Attribute ...
I run the code below in Jupyter and it raises an AttributeError. import pandas as pd AttributeError: module 'pandas' has no attribute 'plotting'....
Read more >
AttributeError: module 'pandas' has no attribute 'panel' ( Solved )
The solution for this AttributeError is that you have to use the older version of the pandas module. The pandas.panel() function is not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found