QInfer / python-qinfer

Library for Bayesian inference via sequential Monte Carlo for quantum parameter estimation.
BSD 3-Clause "New" or "Revised" License
92 stars 31 forks source link

Warning: Could not import IPython parallel #143

Open omarshehab opened 6 years ago

omarshehab commented 6 years ago

I am getting the following warning when I type from qinfer import simple_est_prec.

/home/shehab/anaconda2/envs/py36/lib/python3.6/site-packages/IPython/parallel.py:13: ShimWarning: The `IPython.parallel` package has been deprecated since IPython 4.0. You should import from ipyparallel instead.
  "You should import from ipyparallel instead.", ShimWarning)
/home/shehab/anaconda2/envs/py36/lib/python3.6/site-packages/qinfer/parallel.py:52: UserWarning: Could not import IPython parallel. Parallelization support will be disabled.
  "Could not import IPython parallel. "
ihincks commented 6 years ago

That warning should not affect simple_est_prec; you will be fine. If you don't want to see it, which I understand, you can turn off warnings or install ipyparallel with, for example, conda install ipyparallel.

omarshehab commented 6 years ago

@ihincks : Thanks for your reply. Could you give me some idea about when this warning could matter?

ihincks commented 6 years ago

The only thing that depends on the ipyparallel module is the class DirectViewParallelizedModel in the file parallel.py. This class is not used by anything else, so this warning only matters when you want to use this class but don't have ipyparallel, and is slightly redundant because you would get an actual error if you tried. I believe the original rationale for throwing the warning was that we didn't want to add a dependency for a tangential feature.

However, I think there must be a smoother way to handle it, because it can hardly be considered an 'optional dependency' if one gets a red warning every time one tries to import qinfer.

MichalKononenko commented 6 years ago

ipyparallel interfaces with concurrent.futures now, so in the constructor of DirectViewParallelizedModel, we can ask for an Executor that would submit jobs to ipyparallel. It would also enable our code to work on the thread pool and process pool in the standard Python library as well.