joshspeagle / dynesty

Dynamic Nested Sampling package for computing Bayesian posteriors and evidences
https://dynesty.readthedocs.io/
MIT License
358 stars 78 forks source link

Only import Matplotlib if necessary #54

Closed pacargile closed 6 years ago

pacargile commented 7 years ago

When using dynesty on large parallel cpu clusters, matplotlib is many times not needed and sometimes not available resulting in a ImportError. Therefore, it would be better/more efficient if dynesty only imported matplotlib if the user wanted to use the visualization submodule.

joshspeagle commented 7 years ago

Good point. I can change __init__ to by default not import plotting. Are there any other instances where matplotlib is imported within the code?

pacargile commented 7 years ago

I don't think so, or at least I have not come across them yet.

joshspeagle commented 6 years ago

Resolved in 5927d4d882cdee6ac9968620f4f487e3da98c9eb.

pacargile commented 6 years ago

It still seems to be importing Matplotlib, I think it is due to the fact that you are using "from .dynesty import *", is this importing "plotting" even though it is not explicitly defined?

joshspeagle commented 6 years ago

Do you have a copy of the error where/when this import occurs?

pacargile commented 6 years ago

Sorry, I was still on version 0.8.2. I pulled the repo to 0.8.3 and the issue with matplotlib has gone away.