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

qeds.themes.mpl_style() causes recursion errors in Google Colab #3

Closed
pjakobsen opened this issue Feb 7, 2020 · 7 comments · Fixed by #4
Closed

qeds.themes.mpl_style() causes recursion errors in Google Colab #3

pjakobsen opened this issue Feb 7, 2020 · 7 comments · Fixed by #4

Comments

@pjakobsen
Copy link
Contributor

---------------------------------------------------------------------------
RecursionError                            Traceback (most recent call last)
<ipython-input-8-9bae9beea5a0> in <module>()
      7 # activate plot theme
      8 import qeds
----> 9 qeds.themes.mpl_style();
     10 plotly_template = qeds.themes.plotly_template()
     11 colors = qeds.themes.COLOR_CYCLE

1 frames
... last 1 frames repeated, from the frame below ...

/usr/local/lib/python3.6/dist-packages/qeds/themes.py in mpl_style()
     49     rcp['axes.labelsize'] = 'large'
     50 
---> 51     plt.style.library["qeds"] = mpl_style()
     52     plt.style.reload_library()
     53     plt.style.use("qeds")

RecursionError: maximum recursion depth exceeded in comparison
@pjakobsen
Copy link
Contributor Author

pjakobsen commented Feb 7, 2020

I forked, looking through code. This self referential call inside mpl_style() here is either an oversight, or beyond my comprehension of pythonic best practices.

plt.style.library["qeds"] = mpl_style()

I will fix it if someone would tell me what the call is supposed to do, and then I can issue a pull request. Thanks :)

@wupeifan
Copy link
Contributor

wupeifan commented Feb 7, 2020

It turns out that we need to examine more than this function, as I can see several error messages when running codes under qeds on Colab. Thanks a lot for looking into this!

@sglyon
Copy link
Member

sglyon commented Feb 8, 2020

This line definitely shouldn't be there. not sure how it wasn't causing problems before 🤷‍♂

I'd gladly review a PR that addresses it

@sglyon
Copy link
Member

sglyon commented Feb 8, 2020

I think the fix would be to change that line to

plt.style.library["qeds"] = rcp

I'd make the change myself, but won't have time in the short run to properly test it and verify that it works

@jlperla
Copy link
Member

jlperla commented Feb 8, 2020

@wupeifan are you able to give it a shot with arnavs help for some testing?

@wupeifan
Copy link
Contributor

wupeifan commented Feb 8, 2020

Sure, I can help with testing myself too.

@pjakobsen
Copy link
Contributor Author

Thanks for the quick response. I will make the change, test it on various platforms, and issue a pull request.

pjakobsen added a commit to pjakobsen/qeds that referenced this issue Feb 11, 2020
pjakobsen added a commit to pjakobsen/qeds that referenced this issue Feb 11, 2020
This fixes QuantEcon#3 and has been tested on Colab
@sglyon sglyon closed this as completed in #4 Feb 12, 2020
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

Successfully merging a pull request may close this issue.

4 participants