prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Scipy now required dependency?
  The latest dev build of panel (panel-0.7.0a15-py_0) looks like it is trying to import scipy, but scipy is not among the required dependencies that are automatically installed through conda.
  
  ```
  $ conda create -n panel -c pyviz/label/dev panel
  ...
  $ conda activate panel
  (panel) $ python
  Python 3.7.4 (default, Aug 13 2019, 15:17:50) 
  [Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import panel
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/Users/rditlsc9/miniconda/envs/panel/lib/python3.7/site-packages/panel/__init__.py", line 6, in <module>
      from . import links # noqa
    File "/Users/rditlsc9/miniconda/envs/panel/lib/python3.7/site-packages/panel/links.py", line 12, in <module>
      from .pane.holoviews import HoloViews, generate_panel_bokeh_map, is_bokeh_element_plot
    File "/Users/rditlsc9/miniconda/envs/panel/lib/python3.7/site-packages/panel/pane/__init__.py", line 13, in <module>
      from .holoviews import HoloViews # noqa
    File "/Users/rditlsc9/miniconda/envs/panel/lib/python3.7/site-packages/panel/pane/holoviews.py", line 20, in <module>
      from ..widgets import Player
    File "/Users/rditlsc9/miniconda/envs/panel/lib/python3.7/site-packages/panel/widgets/__init__.py", line 12, in <module>
      from .misc import Audio, VideoStream # noqa
    File "/Users/rditlsc9/miniconda/envs/panel/lib/python3.7/site-packages/panel/widgets/misc.py", line 14, in <module>
      from scipy.io import wavfile
  ModuleNotFoundError: No module named 'scipy'
  ```
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `panel/widgets/misc.py`
  Content:
  ```
  1 """
  2 Miscellaneous widgets which do not fit into the other main categories.
  3 """
  4 from __future__ import absolute_import, division, unicode_literals
  5 
  6 import os
  7 
  8 from io import BytesIO
  9 from base64 import b64encode
  10 from six import string_types
  11 
  12 import param
  13 import numpy as np
  14 from scipy.io import wavfile
  15 
  16 from ..io.notebook import push
  17 from ..io.state import state
  18 from ..models import (Audio as _BkAudio,
  19                       VideoStream as _BkVideoStream)
  20 from .base import Widget
  21 
  22 
  23 class Audio(Widget):
  24 
  25     loop = param.Boolean(default=False, doc="""
  26         Whether the audio should loop""")
  27 
  28     time = param.Number(default=0, doc="""
  29         The current timestamp""")
  30 
  31     throttle = param.Integer(default=250, doc="""
  32         How frequently to sample the current playback time in milliseconds""")
  33 
  34     paused = param.Boolean(default=True, doc="""
  35         Whether the audio is currently paused""")
  36 
  37     sample_rate = param.Integer(default=44100, doc="""
  38         The sample_rate of the audio when given a NumPy array.""")
  39 
  40     value = param.ClassSelector(default='', class_=(string_types + (np.ndarray,)), doc="""
  41         The audio file either local or remote.""")
  42 
  43     volume = param.Number(default=None, bounds=(0, 100), doc="""
  44         The volume of the audio player.""")
  45 
  46     _widget_type = _BkAudio
  47 
  48     _rename = {'name': None, 'sample_rate': None}
  49 
  50     def _from_numpy(self, data):
  51         buffer = BytesIO()
  52         wavfile.write(buffer, self.sample_rate, data)
  53         return buffer
  54 
  55     def _process_param_change(self, msg):
  56         msg = super(Audio, self)._process_param_change(msg)
  57 
  58         if 'value' in msg:
  59             value =  msg['value']
  60             if isinstance(value, np.ndarray):
  61                 fmt = 'wav'
  62                 buffer = self._from_numpy(value)
  63                 data = b64encode(buffer.getvalue())
  64             elif os.path.isfile(value):
  65                 fmt = value.split('.')[-1]
  66                 with open(value, 'rb') as f:
  67                     data = f.read()
  68                 data = b64encode(data)
  69             elif value.lower().startswith('http'):
  70                 return msg
  71             elif not value:
  72                 data, fmt = b'', 'wav'
  73             else:
  74                 raise ValueError('Value should be either path to a sound file or numpy array')
  75             template = 'data:audio/{mime};base64,{data}'
  76             msg['value'] = template.format(data=data.decode('utf-8'),
  77                                            mime=fmt)
  78         return msg
  79 
  80 
  81 
  82 class VideoStream(Widget):
  83 
  84     format = param.ObjectSelector(default='png', objects=['png', 'jpeg'],
  85                                   doc="""
  86         The file format as which the video is returned.""")
  87 
  88     paused = param.Boolean(default=False, doc="""
  89         Whether the video is currently paused""")
  90 
  91     timeout = param.Number(default=None, doc="""
  92         Interval between snapshots in millisecons""")
  93 
  94     value = param.String(default='', doc="""
  95         A base64 representation of the video stream snapshot.""")
  96 
  97     _widget_type = _BkVideoStream
  98 
  99     _rename = {'name': None}
  100 
  101     def snapshot(self):
  102         """
  103         Triggers a snapshot of the current VideoStream state to sync
  104         the widget value.
  105         """
  106         for ref, (m, _) in self._models.items():
  107             m.snapshot = not m.snapshot
  108             (self, root, doc, comm) = state._views[ref]
  109             if comm and 'embedded' not in root.tags:
  110                 push(doc, comm)
  111
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/panel/widgets/misc.py b/panel/widgets/misc.py
  --- a/panel/widgets/misc.py
  +++ b/panel/widgets/misc.py
  @@ -11,7 +11,6 @@
   
   import param
   import numpy as np
  -from scipy.io import wavfile
   
   from ..io.notebook import push
   from ..io.state import state
  @@ -48,6 +47,7 @@
       _rename = {'name': None, 'sample_rate': None}
   
       def _from_numpy(self, data):
  +        from scipy.io import wavfile
           buffer = BytesIO()
           wavfile.write(buffer, self.sample_rate, data)
           return buffer
  
verification_info: {"golden_diff": "diff --git a/panel/widgets/misc.py b/panel/widgets/misc.py\n--- a/panel/widgets/misc.py\n+++ b/panel/widgets/misc.py\n@@ -11,7 +11,6 @@\n \n import param\n import numpy as np\n-from scipy.io import wavfile\n \n from ..io.notebook import push\n from ..io.state import state\n@@ -48,6 +47,7 @@\n     _rename = {'name': None, 'sample_rate': None}\n \n     def _from_numpy(self, data):\n+        from scipy.io import wavfile\n         buffer = BytesIO()\n         wavfile.write(buffer, self.sample_rate, data)\n         return buffer\n", "issue": "Scipy now required dependency?\nThe latest dev build of panel (panel-0.7.0a15-py_0) looks like it is trying to import scipy, but scipy is not among the required dependencies that are automatically installed through conda.\r\n\r\n```\r\n$ conda create -n panel -c pyviz/label/dev panel\r\n...\r\n$ conda activate panel\r\n(panel) $ python\r\nPython 3.7.4 (default, Aug 13 2019, 15:17:50) \r\n[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> import panel\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/Users/rditlsc9/miniconda/envs/panel/lib/python3.7/site-packages/panel/__init__.py\", line 6, in <module>\r\n    from . import links # noqa\r\n  File \"/Users/rditlsc9/miniconda/envs/panel/lib/python3.7/site-packages/panel/links.py\", line 12, in <module>\r\n    from .pane.holoviews import HoloViews, generate_panel_bokeh_map, is_bokeh_element_plot\r\n  File \"/Users/rditlsc9/miniconda/envs/panel/lib/python3.7/site-packages/panel/pane/__init__.py\", line 13, in <module>\r\n    from .holoviews import HoloViews # noqa\r\n  File \"/Users/rditlsc9/miniconda/envs/panel/lib/python3.7/site-packages/panel/pane/holoviews.py\", line 20, in <module>\r\n    from ..widgets import Player\r\n  File \"/Users/rditlsc9/miniconda/envs/panel/lib/python3.7/site-packages/panel/widgets/__init__.py\", line 12, in <module>\r\n    from .misc import Audio, VideoStream # noqa\r\n  File \"/Users/rditlsc9/miniconda/envs/panel/lib/python3.7/site-packages/panel/widgets/misc.py\", line 14, in <module>\r\n    from scipy.io import wavfile\r\nModuleNotFoundError: No module named 'scipy'\r\n```\n", "before_files": [{"content": "\"\"\"\nMiscellaneous widgets which do not fit into the other main categories.\n\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n\nimport os\n\nfrom io import BytesIO\nfrom base64 import b64encode\nfrom six import string_types\n\nimport param\nimport numpy as np\nfrom scipy.io import wavfile\n\nfrom ..io.notebook import push\nfrom ..io.state import state\nfrom ..models import (Audio as _BkAudio,\n                      VideoStream as _BkVideoStream)\nfrom .base import Widget\n\n\nclass Audio(Widget):\n\n    loop = param.Boolean(default=False, doc=\"\"\"\n        Whether the audio should loop\"\"\")\n\n    time = param.Number(default=0, doc=\"\"\"\n        The current timestamp\"\"\")\n\n    throttle = param.Integer(default=250, doc=\"\"\"\n        How frequently to sample the current playback time in milliseconds\"\"\")\n\n    paused = param.Boolean(default=True, doc=\"\"\"\n        Whether the audio is currently paused\"\"\")\n\n    sample_rate = param.Integer(default=44100, doc=\"\"\"\n        The sample_rate of the audio when given a NumPy array.\"\"\")\n\n    value = param.ClassSelector(default='', class_=(string_types + (np.ndarray,)), doc=\"\"\"\n        The audio file either local or remote.\"\"\")\n\n    volume = param.Number(default=None, bounds=(0, 100), doc=\"\"\"\n        The volume of the audio player.\"\"\")\n\n    _widget_type = _BkAudio\n\n    _rename = {'name': None, 'sample_rate': None}\n\n    def _from_numpy(self, data):\n        buffer = BytesIO()\n        wavfile.write(buffer, self.sample_rate, data)\n        return buffer\n\n    def _process_param_change(self, msg):\n        msg = super(Audio, self)._process_param_change(msg)\n\n        if 'value' in msg:\n            value =  msg['value']\n            if isinstance(value, np.ndarray):\n                fmt = 'wav'\n                buffer = self._from_numpy(value)\n                data = b64encode(buffer.getvalue())\n            elif os.path.isfile(value):\n                fmt = value.split('.')[-1]\n                with open(value, 'rb') as f:\n                    data = f.read()\n                data = b64encode(data)\n            elif value.lower().startswith('http'):\n                return msg\n            elif not value:\n                data, fmt = b'', 'wav'\n            else:\n                raise ValueError('Value should be either path to a sound file or numpy array')\n            template = 'data:audio/{mime};base64,{data}'\n            msg['value'] = template.format(data=data.decode('utf-8'),\n                                           mime=fmt)\n        return msg\n\n\n\nclass VideoStream(Widget):\n\n    format = param.ObjectSelector(default='png', objects=['png', 'jpeg'],\n                                  doc=\"\"\"\n        The file format as which the video is returned.\"\"\")\n\n    paused = param.Boolean(default=False, doc=\"\"\"\n        Whether the video is currently paused\"\"\")\n\n    timeout = param.Number(default=None, doc=\"\"\"\n        Interval between snapshots in millisecons\"\"\")\n\n    value = param.String(default='', doc=\"\"\"\n        A base64 representation of the video stream snapshot.\"\"\")\n\n    _widget_type = _BkVideoStream\n\n    _rename = {'name': None}\n\n    def snapshot(self):\n        \"\"\"\n        Triggers a snapshot of the current VideoStream state to sync\n        the widget value.\n        \"\"\"\n        for ref, (m, _) in self._models.items():\n            m.snapshot = not m.snapshot\n            (self, root, doc, comm) = state._views[ref]\n            if comm and 'embedded' not in root.tags:\n                push(doc, comm)\n", "path": "panel/widgets/misc.py"}], "after_files": [{"content": "\"\"\"\nMiscellaneous widgets which do not fit into the other main categories.\n\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n\nimport os\n\nfrom io import BytesIO\nfrom base64 import b64encode\nfrom six import string_types\n\nimport param\nimport numpy as np\n\nfrom ..io.notebook import push\nfrom ..io.state import state\nfrom ..models import (Audio as _BkAudio,\n                      VideoStream as _BkVideoStream)\nfrom .base import Widget\n\n\nclass Audio(Widget):\n\n    loop = param.Boolean(default=False, doc=\"\"\"\n        Whether the audio should loop\"\"\")\n\n    time = param.Number(default=0, doc=\"\"\"\n        The current timestamp\"\"\")\n\n    throttle = param.Integer(default=250, doc=\"\"\"\n        How frequently to sample the current playback time in milliseconds\"\"\")\n\n    paused = param.Boolean(default=True, doc=\"\"\"\n        Whether the audio is currently paused\"\"\")\n\n    sample_rate = param.Integer(default=44100, doc=\"\"\"\n        The sample_rate of the audio when given a NumPy array.\"\"\")\n\n    value = param.ClassSelector(default='', class_=(string_types + (np.ndarray,)), doc=\"\"\"\n        The audio file either local or remote.\"\"\")\n\n    volume = param.Number(default=None, bounds=(0, 100), doc=\"\"\"\n        The volume of the audio player.\"\"\")\n\n    _widget_type = _BkAudio\n\n    _rename = {'name': None, 'sample_rate': None}\n\n    def _from_numpy(self, data):\n        from scipy.io import wavfile\n        buffer = BytesIO()\n        wavfile.write(buffer, self.sample_rate, data)\n        return buffer\n\n    def _process_param_change(self, msg):\n        msg = super(Audio, self)._process_param_change(msg)\n\n        if 'value' in msg:\n            value =  msg['value']\n            if isinstance(value, np.ndarray):\n                fmt = 'wav'\n                buffer = self._from_numpy(value)\n                data = b64encode(buffer.getvalue())\n            elif os.path.isfile(value):\n                fmt = value.split('.')[-1]\n                with open(value, 'rb') as f:\n                    data = f.read()\n                data = b64encode(data)\n            elif value.lower().startswith('http'):\n                return msg\n            elif not value:\n                data, fmt = b'', 'wav'\n            else:\n                raise ValueError('Value should be either path to a sound file or numpy array')\n            template = 'data:audio/{mime};base64,{data}'\n            msg['value'] = template.format(data=data.decode('utf-8'),\n                                           mime=fmt)\n        return msg\n\n\n\nclass VideoStream(Widget):\n\n    format = param.ObjectSelector(default='png', objects=['png', 'jpeg'],\n                                  doc=\"\"\"\n        The file format as which the video is returned.\"\"\")\n\n    paused = param.Boolean(default=False, doc=\"\"\"\n        Whether the video is currently paused\"\"\")\n\n    timeout = param.Number(default=None, doc=\"\"\"\n        Interval between snapshots in millisecons\"\"\")\n\n    value = param.String(default='', doc=\"\"\"\n        A base64 representation of the video stream snapshot.\"\"\")\n\n    _widget_type = _BkVideoStream\n\n    _rename = {'name': None}\n\n    def snapshot(self):\n        \"\"\"\n        Triggers a snapshot of the current VideoStream state to sync\n        the widget value.\n        \"\"\"\n        for ref, (m, _) in self._models.items():\n            m.snapshot = not m.snapshot\n            (self, root, doc, comm) = state._views[ref]\n            if comm and 'embedded' not in root.tags:\n                push(doc, comm)\n", "path": "panel/widgets/misc.py"}]}