Catch any exception in `import_optional` (#5243)
Catch any exception in `import_optional` (#5243)

* Catch any exception in `import_optional`

Imports can trigger side effects which may result in any exception
potentially being thrown. In this case simply return None rather than
crashing on an optional import.

Fixes #5242

* Issue a warning if an optional import raises an exception

* Used logging module rather than warnings

* Removed redundant import

* Addressed review comments

* Addressed further review comments

* Remove unused variable

* Remove trailing whitesapce

aavanian/bokeh,percyfal/bokeh,rs2/bokeh,DuCorey/bokeh,rs2/bokeh,draperjames/bokeh,dennisobrien/bokeh,percyfal/bokeh,philippjfr/bokeh,philippjfr/bokeh,percyfal/bokeh,jakirkham/bokeh,aiguofer/bokeh,bokeh/bokeh,schoolie/bokeh,Karel-van-de-Plassche/bokeh,philippjfr/bokeh,DuCorey/bokeh,dennisobrien/bokeh,schoolie/bokeh,timsnyder/bokeh,draperjames/bokeh,DuCorey/bokeh,bokeh/bokeh,timsnyder/bokeh,dennisobrien/bokeh,rs2/bokeh,percyfal/bokeh,stonebig/bokeh,mindriot101/bokeh,aiguofer/bokeh,azjps/bokeh,azjps/bokeh,dennisobrien/bokeh,ericmjl/bokeh,timsnyder/bokeh,draperjames/bokeh,Karel-van-de-Plassche/bokeh,ericmjl/bokeh,ericmjl/bokeh,aiguofer/bokeh,stonebig/bokeh,jakirkham/bokeh,dennisobrien/bokeh,aavanian/bokeh,DuCorey/bokeh,aavanian/bokeh,mindriot101/bokeh,rs2/bokeh,Karel-van-de-Plassche/bokeh,percyfal/bokeh,bokeh/bokeh,ericmjl/bokeh,Karel-van-de-Plassche/bokeh,stonebig/bokeh,azjps/bokeh,schoolie/bokeh,rs2/bokeh,DuCorey/bokeh,aavanian/bokeh,philippjfr/bokeh,timsnyder/bokeh,mindriot101/bokeh,draperjames/bokeh,stonebig/bokeh,bokeh/bokeh,schoolie/bokeh,aavanian/bokeh,Karel-van-de-Plassche/bokeh,azjps/bokeh,jakirkham/bokeh,jakirkham/bokeh,aiguofer/bokeh,ericmjl/bokeh,philippjfr/bokeh,jakirkham/bokeh,aiguofer/bokeh,bokeh/bokeh,azjps/bokeh,timsnyder/bokeh,mindriot101/bokeh,schoolie/bokeh,draperjames/bokeh