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

Matplotlib errors with TypeError: 'NoneType' object is not callable #97

Closed
kmodexc opened this issue Apr 28, 2022 · 4 comments · Fixed by #100
Closed

Matplotlib errors with TypeError: 'NoneType' object is not callable #97

kmodexc opened this issue Apr 28, 2022 · 4 comments · Fixed by #100
Assignees
Labels

Comments

@kmodexc
Copy link

kmodexc commented Apr 28, 2022

Using matplotlib, pandas and yappi together to throw an error:

[...]
File "C:\Users\xxx\source\repos\ErrorAnalytics\env\lib\site-packages\numpy\core\getlimits.py", line 462, in __new__
    dtype = numeric.dtype(type(dtype))
TypeError: 'NoneType' object is not callable

Example-code:

import pandas as pd
import matplotlib.pyplot as plt
import yappi

with yappi.run():
    dataset = pd.DataFrame(data={
        'x': list(range(10)),
        'y': list(range(10))})
    plt.plot(data=dataset)
    plt.savefig("fig.png")

yappi.get_func_stats().print_all()
  • Python 3.10.4
  • pandas 1.4.2
  • matplotlib 3.5.1
  • yappi 1.3.3

I already posted on matplotlib here but it seems to be a problem from yappi.

@sumerc
Copy link
Owner

sumerc commented Apr 28, 2022

Hmmm. Interesting. I will be looking into this.

The relevant code in numpy:

try:
    dtype = numeric.dtype(dtype)
except TypeError:
    # In case a float instance was given
    dtype = numeric.dtype(type(dtype))

Weird. The first call to numeric.dtype throws TypeError and then None is not callable.

@sumerc sumerc added the bug label Apr 28, 2022
@sumerc sumerc self-assigned this Apr 28, 2022
@sumerc
Copy link
Owner

sumerc commented Apr 28, 2022

FI: The issue only happens on Python 3.10. I have successfully profiled above in 3.9.

@sumerc
Copy link
Owner

sumerc commented Apr 29, 2022

Found the issue. It is this line causing the problem on Python 3.10:

PyFrame_FastToLocals(fobj);

I still do not know how PyFrame_FastToLocals mutates an object. I will need to dig a bit deeper to understand the root cause before proposing a fix.

@sumerc
Copy link
Owner

sumerc commented May 20, 2022

Issue is fixed in latest release: 1.3.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants