Skip to content

_rrule maximum recursion depth exceeded on multiprocessing usage #7852

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

Closed
ahcub opened this issue Jan 17, 2017 · 2 comments
Closed

_rrule maximum recursion depth exceeded on multiprocessing usage #7852

ahcub opened this issue Jan 17, 2017 · 2 comments
Milestone

Comments

@ahcub
Copy link
Contributor

ahcub commented Jan 17, 2017

To help us understand and resolve your issue, please fill out the form to the best of your ability. You can feel free to delete the sections that do not apply.

Bug report

  • A short 1-2 sentences that succinctly describes the bug

get function of multiprocessing.AsyncResult fails in case of plotting pandas.DataFrame with using non-UTC DatetimeIndex

Code for reproduction

  • A minimum code snippet required to reproduce the bug, also minimizing the number of dependencies required
from multiprocessing.pool import Pool
import pandas as pd
from matplotlib import pyplot as plt

def func(df):
    fig, ax = plt.subplots()
    df.plot(ax=ax)
    return 'title', fig

if __name__ == '__main__':
    index = pd.DatetimeIndex(pd.date_range('2016-10-05', periods=10, freq='T', tz='UTC'))
    index = index.tz_convert('America/Chicago')
    df = pd.DataFrame(list(range(10)), index=index, columns=['a'])
    with Pool(3) as pool:
        proc = pool.apply_async(func, (df,))
        title, fig = proc.get()
        fig.savefig(r'.\test.png')

Actual outcome

  • The output produced by the above code, which may be a screenshot, console output, etc.
Traceback (most recent call last):
  File "C:\miniconda\envs\p3\lib\threading.py", line 914, in _bootstrap_inner
    self.run()
  File "C:\miniconda\envs\p3\lib\threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "C:\miniconda\envs\p3\lib\multiprocessing\pool.py", line 429, in _handle_results
    task = get()
  File "C:\miniconda\envs\p3\lib\multiprocessing\connection.py", line 251, in recv
    return ForkingPickler.loads(buf.getbuffer())
  File "C:\miniconda\envs\p3\lib\site-packages\matplotlib\dates.py", line 730, in __getattr__
    return getattr(self._rrule, name)

  ...

  File "C:\miniconda\envs\p3\lib\site-packages\matplotlib\dates.py", line 730, in __getattr__
    return getattr(self._rrule, name)
RecursionError: maximum recursion depth exceeded

Expected outcome

  • A description of the expected outcome from the code snippet
  • If this used to work in an earlier version of Matplotlib, please note the version it used to work on

it should save a valid figure to the test.png

Matplotlib version

  • Matplotlib version, Python version and Platform (Windows, OSX, Linux ...)
  • How did you install Matplotlib and Python (pip, anaconda, from source ...)

Matplotlib version:

matplotlib.version
'1.5.3'

Python version:
Python 3.5.2

Platform:
Windows

installed using mini-conda like:
conda install matplotlib

@ahcub
Copy link
Contributor Author

ahcub commented Jan 17, 2017

the issue can be solved by adding the following code into rrulewrapper.__getattr__ function before the if namу in self.dict statement
matplotlib/dates.py line: 728

        if name in ['__getstate__', '__setstate__']:
            return object.__getattr__(self, name)

ahcub added a commit to ahcub/matplotlib that referenced this issue Jan 17, 2017
@efiring
Copy link
Member

efiring commented Jan 17, 2017

Would you submit a PR for this, please? Maybe with a comment to explain how this case occurs.

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

3 participants