python-qinfer icon indicating copy to clipboard operation
python-qinfer copied to clipboard

Warning: Could not import IPython parallel

Open omarshehab opened this issue 7 years ago • 4 comments

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. "

omarshehab avatar Jan 25 '18 14:01 omarshehab

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.

ihincks avatar Jan 25 '18 14:01 ihincks

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

omarshehab avatar Jan 29 '18 14:01 omarshehab

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.

ihincks avatar Jan 29 '18 14:01 ihincks

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.

MichalKononenko avatar Apr 03 '18 17:04 MichalKononenko