{
  "id": 427950,
  "title": "error in kaggle notebook",
  "url": "/competitions/hubmap-hacking-the-human-vasculature/discussion/427950",
  "author_name": "Funee Monkee",
  "post_date": "2023-07-30T12:30:43.124000",
  "votes": 1,
  "comment_count": 2,
  "views": 0,
  "content": "<p>Hello, I don't understand that sometimes when i run this i get error from plt.imshow<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11653494%2F1ae5ab752e414440a864609d693e9d47%2FScreenshot%202023-07-30%20143337.png?generation=1690720473696319&amp;alt=media\" alt=\"\"></p>\n<p>here is the code:<br>\nplt.imread(\"/kaggle/input/hubmap-hacking-the-human-vasculature/test/72e40acccadf.tif\") </p>\n<p>here are the logs:</p>\n<pre><code>Unexpected exception formatting exception. Falling back to standard exception\nTraceback (most recent call last):\n  File , line ,  imread\n    pil_to_array(image))\n  File , line ,  pil_to_array\n     np.asarray(pilImage)\n  File , line ,  __array_interface__\n    self.mode = mode\n  File , line ,  tobytes\n  File , line ,  load\n     self._load_libtiff()\n  File , line ,  _load_libtiff\n    self.load_end()\n  File , line ,  load_end\n    self.fp.tell()\nOSError: [Errno ] Bad file descriptor\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File , line ,  run_code\n    (code_obj, self.user_global_ns, self.user_ns)\n  File , line ,  &lt;module&gt;\n    inp = torch.tensor(plt.imread(file_path) / ) \n  File , line ,  imread\n     matplotlib.image.imread(fname, )\n  File , line ,  imread\n     img_open(fname)  image:\n  File , line ,  __exit__\n    self.pyaccess = \nOSError: [Errno ] Bad file descriptor\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File , line ,  showtraceback\n    stb = self.InteractiveTB.structured_traceback(\n  File , line ,  structured_traceback\n     FormattedTB.structured_traceback(\n  File , line ,  structured_traceback\n     VerboseTB.structured_traceback(\n  File , line ,  structured_traceback\n    formatted_exceptions += self.format_exception_as_a_whole(etype, evalue, etb, lines_of_context,\n  File , line ,  format_exception_as_a_whole\n    frames.append(self.format_record(record))\n  File , line ,  format_record\n    frame_info.lines, Colors, self.has_colors, lvals\n  File , line ,  lines\n     self._sd.lines\n  File , line ,  cached_property_wrapper\n    value = obj.__dict__[self.func.__name__] = self.func(obj)\n  File , line ,  lines\n    pieces = self.included_pieces\n  File , line ,  cached_property_wrapper\n    value = obj.__dict__[self.func.__name__] = self.func(obj)\n  File , line ,  included_pieces\n    pos = scope_pieces.index(self.executing_piece)\n  File , line ,  cached_property_wrapper\n    value = obj.__dict__[self.func.__name__] = self.func(obj)\n  File , line ,  executing_piece\n     only(\n  File , line ,  only\n     NotOneValueFound()\nexecuting.executing.NotOneValueFound: Expected one value, found \n</code></pre>",
  "messages": [
    {
      "id": 2365698,
      "postDate": "2023-07-30T12:30:43.123Z",
      "content": "<p>Hello, I don't understand that sometimes when i run this i get error from plt.imshow<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11653494%2F1ae5ab752e414440a864609d693e9d47%2FScreenshot%202023-07-30%20143337.png?generation=1690720473696319&amp;alt=media\" alt=\"\"></p>\n<p>here is the code:<br>\nplt.imread(\"/kaggle/input/hubmap-hacking-the-human-vasculature/test/72e40acccadf.tif\") </p>\n<p>here are the logs:</p>\n<pre><code>Unexpected exception formatting exception. Falling back to standard exception\nTraceback (most recent call last):\n  File , line ,  imread\n    pil_to_array(image))\n  File , line ,  pil_to_array\n     np.asarray(pilImage)\n  File , line ,  __array_interface__\n    self.mode = mode\n  File , line ,  tobytes\n  File , line ,  load\n     self._load_libtiff()\n  File , line ,  _load_libtiff\n    self.load_end()\n  File , line ,  load_end\n    self.fp.tell()\nOSError: [Errno ] Bad file descriptor\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File , line ,  run_code\n    (code_obj, self.user_global_ns, self.user_ns)\n  File , line ,  &lt;module&gt;\n    inp = torch.tensor(plt.imread(file_path) / ) \n  File , line ,  imread\n     matplotlib.image.imread(fname, )\n  File , line ,  imread\n     img_open(fname)  image:\n  File , line ,  __exit__\n    self.pyaccess = \nOSError: [Errno ] Bad file descriptor\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File , line ,  showtraceback\n    stb = self.InteractiveTB.structured_traceback(\n  File , line ,  structured_traceback\n     FormattedTB.structured_traceback(\n  File , line ,  structured_traceback\n     VerboseTB.structured_traceback(\n  File , line ,  structured_traceback\n    formatted_exceptions += self.format_exception_as_a_whole(etype, evalue, etb, lines_of_context,\n  File , line ,  format_exception_as_a_whole\n    frames.append(self.format_record(record))\n  File , line ,  format_record\n    frame_info.lines, Colors, self.has_colors, lvals\n  File , line ,  lines\n     self._sd.lines\n  File , line ,  cached_property_wrapper\n    value = obj.__dict__[self.func.__name__] = self.func(obj)\n  File , line ,  lines\n    pieces = self.included_pieces\n  File , line ,  cached_property_wrapper\n    value = obj.__dict__[self.func.__name__] = self.func(obj)\n  File , line ,  included_pieces\n    pos = scope_pieces.index(self.executing_piece)\n  File , line ,  cached_property_wrapper\n    value = obj.__dict__[self.func.__name__] = self.func(obj)\n  File , line ,  executing_piece\n     only(\n  File , line ,  only\n     NotOneValueFound()\nexecuting.executing.NotOneValueFound: Expected one value, found \n</code></pre>",
      "rawMarkdown": "Hello, I don't understand that sometimes when i run this i get error from plt.imshow\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11653494%2F1ae5ab752e414440a864609d693e9d47%2FScreenshot%202023-07-30%20143337.png?generation=1690720473696319&alt=media)\n\nhere is the code:\nplt.imread(\"/kaggle/input/hubmap-hacking-the-human-vasculature/test/72e40acccadf.tif\") \n\nhere are the logs:\n\n\n```\nUnexpected exception formatting exception. Falling back to standard exception\nTraceback (most recent call last):\n  File \"/opt/conda/lib/python3.10/site-packages/matplotlib/image.py\", line 1566, in imread\n    pil_to_array(image))\n  File \"/opt/conda/lib/python3.10/site-packages/matplotlib/image.py\", line 1710, in pil_to_array\n    return np.asarray(pilImage)\n  File \"/opt/conda/lib/python3.10/site-packages/PIL/Image.py\", line 696, in __array_interface__\n    self.mode = mode\n  File \"/opt/conda/lib/python3.10/site-packages/PIL/Image.py\", line 754, in tobytes\n  File \"/opt/conda/lib/python3.10/site-packages/PIL/TiffImagePlugin.py\", line 1202, in load\n    return self._load_libtiff()\n  File \"/opt/conda/lib/python3.10/site-packages/PIL/TiffImagePlugin.py\", line 1310, in _load_libtiff\n    self.load_end()\n  File \"/opt/conda/lib/python3.10/site-packages/PIL/TiffImagePlugin.py\", line 1227, in load_end\n    self.fp.tell()\nOSError: [Errno 9] Bad file descriptor\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/opt/conda/lib/python3.10/site-packages/IPython/core/interactiveshell.py\", line 3508, in run_code\n    exec(code_obj, self.user_global_ns, self.user_ns)\n  File \"/tmp/ipykernel_32/16705252.py\", line 8, in <module>\n    inp = torch.tensor(plt.imread(file_path) / 255) # imread returns (512, 512, 3)\n  File \"/opt/conda/lib/python3.10/site-packages/matplotlib/pyplot.py\", line 2195, in imread\n    return matplotlib.image.imread(fname, format)\n  File \"/opt/conda/lib/python3.10/site-packages/matplotlib/image.py\", line 1563, in imread\n    with img_open(fname) as image:\n  File \"/opt/conda/lib/python3.10/site-packages/PIL/Image.py\", line 568, in __exit__\n    self.pyaccess = None\nOSError: [Errno 9] Bad file descriptor\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/opt/conda/lib/python3.10/site-packages/IPython/core/interactiveshell.py\", line 2105, in showtraceback\n    stb = self.InteractiveTB.structured_traceback(\n  File \"/opt/conda/lib/python3.10/site-packages/IPython/core/ultratb.py\", line 1396, in structured_traceback\n    return FormattedTB.structured_traceback(\n  File \"/opt/conda/lib/python3.10/site-packages/IPython/core/ultratb.py\", line 1287, in structured_traceback\n    return VerboseTB.structured_traceback(\n  File \"/opt/conda/lib/python3.10/site-packages/IPython/core/ultratb.py\", line 1159, in structured_traceback\n    formatted_exceptions += self.format_exception_as_a_whole(etype, evalue, etb, lines_of_context,\n  File \"/opt/conda/lib/python3.10/site-packages/IPython/core/ultratb.py\", line 1055, in format_exception_as_a_whole\n    frames.append(self.format_record(record))\n  File \"/opt/conda/lib/python3.10/site-packages/IPython/core/ultratb.py\", line 955, in format_record\n    frame_info.lines, Colors, self.has_colors, lvals\n  File \"/opt/conda/lib/python3.10/site-packages/IPython/core/ultratb.py\", line 778, in lines\n    return self._sd.lines\n  File \"/opt/conda/lib/python3.10/site-packages/stack_data/utils.py\", line 144, in cached_property_wrapper\n    value = obj.__dict__[self.func.__name__] = self.func(obj)\n  File \"/opt/conda/lib/python3.10/site-packages/stack_data/core.py\", line 734, in lines\n    pieces = self.included_pieces\n  File \"/opt/conda/lib/python3.10/site-packages/stack_data/utils.py\", line 144, in cached_property_wrapper\n    value = obj.__dict__[self.func.__name__] = self.func(obj)\n  File \"/opt/conda/lib/python3.10/site-packages/stack_data/core.py\", line 681, in included_pieces\n    pos = scope_pieces.index(self.executing_piece)\n  File \"/opt/conda/lib/python3.10/site-packages/stack_data/utils.py\", line 144, in cached_property_wrapper\n    value = obj.__dict__[self.func.__name__] = self.func(obj)\n  File \"/opt/conda/lib/python3.10/site-packages/stack_data/core.py\", line 660, in executing_piece\n    return only(\n  File \"/opt/conda/lib/python3.10/site-packages/executing/executing.py\", line 190, in only\n    raise NotOneValueFound('Expected one value, found 0')\nexecuting.executing.NotOneValueFound: Expected one value, found 0\n```"
    },
    {
      "id": 2365866,
      "postDate": "2023-07-30T14:15:43.673Z",
      "rawMarkdown": "",
      "isDeleted": true,
      "replies": [
        {
          "id": 2365912,
          "postDate": "2023-07-30T14:58:12.593Z",
          "content": "<blockquote>\n  <p>I'm having the same problem what's going on someone should advice please. All the labour from the last day should not go down like that……. Who change the input image to binary abeg</p>\n</blockquote>\n<p>I used tifffile.imread instead and it seems to work<br>\nnow im facing submission error</p>",
          "rawMarkdown": "> I'm having the same problem what's going on someone should advice please. All the labour from the last day should not go down like that....... Who change the input image to binary abeg\n\nI used tifffile.imread instead and it seems to work\nnow im facing submission error\n\n"
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 2365866,
      "author_name": "",
      "author_url": "",
      "post_date": "2023-07-30T14:15:43.673000",
      "content": "",
      "votes": 0,
      "replies": [
        {
          "id": 2365912,
          "author_name": "Funee Monkee",
          "author_url": "",
          "post_date": "2023-07-30T14:58:12.593000",
          "content": "<blockquote>\n  <p>I'm having the same problem what's going on someone should advice please. All the labour from the last day should not go down like that……. Who change the input image to binary abeg</p>\n</blockquote>\n<p>I used tifffile.imread instead and it seems to work<br>\nnow im facing submission error</p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2365698": "Hello, I don't understand that sometimes when i run this i get error from plt.imshow\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11653494%2F1ae5ab752e414440a864609d693e9d47%2FScreenshot%202023-07-30%20143337.png?generation=1690720473696319&alt=media)\n\nhere is the code:\nplt.imread(\"/kaggle/input/hubmap-hacking-the-human-vasculature/test/72e40acccadf.tif\") \n\nhere are the logs:\n\n\n```\nUnexpected exception formatting exception. Falling back to standard exception\nTraceback (most recent call last):\n  File \"/opt/conda/lib/python3.10/site-packages/matplotlib/image.py\", line 1566, in imread\n    pil_to_array(image))\n  File \"/opt/conda/lib/python3.10/site-packages/matplotlib/image.py\", line 1710, in pil_to_array\n    return np.asarray(pilImage)\n  File \"/opt/conda/lib/python3.10/site-packages/PIL/Image.py\", line 696, in __array_interface__\n    self.mode = mode\n  File \"/opt/conda/lib/python3.10/site-packages/PIL/Image.py\", line 754, in tobytes\n  File \"/opt/conda/lib/python3.10/site-packages/PIL/TiffImagePlugin.py\", line 1202, in load\n    return self._load_libtiff()\n  File \"/opt/conda/lib/python3.10/site-packages/PIL/TiffImagePlugin.py\", line 1310, in _load_libtiff\n    self.load_end()\n  File \"/opt/conda/lib/python3.10/site-packages/PIL/TiffImagePlugin.py\", line 1227, in load_end\n    self.fp.tell()\nOSError: [Errno 9] Bad file descriptor\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/opt/conda/lib/python3.10/site-packages/IPython/core/interactiveshell.py\", line 3508, in run_code\n    exec(code_obj, self.user_global_ns, self.user_ns)\n  File \"/tmp/ipykernel_32/16705252.py\", line 8, in <module>\n    inp = torch.tensor(plt.imread(file_path) / 255) # imread returns (512, 512, 3)\n  File \"/opt/conda/lib/python3.10/site-packages/matplotlib/pyplot.py\", line 2195, in imread\n    return matplotlib.image.imread(fname, format)\n  File \"/opt/conda/lib/python3.10/site-packages/matplotlib/image.py\", line 1563, in imread\n    with img_open(fname) as image:\n  File \"/opt/conda/lib/python3.10/site-packages/PIL/Image.py\", line 568, in __exit__\n    self.pyaccess = None\nOSError: [Errno 9] Bad file descriptor\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/opt/conda/lib/python3.10/site-packages/IPython/core/interactiveshell.py\", line 2105, in showtraceback\n    stb = self.InteractiveTB.structured_traceback(\n  File \"/opt/conda/lib/python3.10/site-packages/IPython/core/ultratb.py\", line 1396, in structured_traceback\n    return FormattedTB.structured_traceback(\n  File \"/opt/conda/lib/python3.10/site-packages/IPython/core/ultratb.py\", line 1287, in structured_traceback\n    return VerboseTB.structured_traceback(\n  File \"/opt/conda/lib/python3.10/site-packages/IPython/core/ultratb.py\", line 1159, in structured_traceback\n    formatted_exceptions += self.format_exception_as_a_whole(etype, evalue, etb, lines_of_context,\n  File \"/opt/conda/lib/python3.10/site-packages/IPython/core/ultratb.py\", line 1055, in format_exception_as_a_whole\n    frames.append(self.format_record(record))\n  File \"/opt/conda/lib/python3.10/site-packages/IPython/core/ultratb.py\", line 955, in format_record\n    frame_info.lines, Colors, self.has_colors, lvals\n  File \"/opt/conda/lib/python3.10/site-packages/IPython/core/ultratb.py\", line 778, in lines\n    return self._sd.lines\n  File \"/opt/conda/lib/python3.10/site-packages/stack_data/utils.py\", line 144, in cached_property_wrapper\n    value = obj.__dict__[self.func.__name__] = self.func(obj)\n  File \"/opt/conda/lib/python3.10/site-packages/stack_data/core.py\", line 734, in lines\n    pieces = self.included_pieces\n  File \"/opt/conda/lib/python3.10/site-packages/stack_data/utils.py\", line 144, in cached_property_wrapper\n    value = obj.__dict__[self.func.__name__] = self.func(obj)\n  File \"/opt/conda/lib/python3.10/site-packages/stack_data/core.py\", line 681, in included_pieces\n    pos = scope_pieces.index(self.executing_piece)\n  File \"/opt/conda/lib/python3.10/site-packages/stack_data/utils.py\", line 144, in cached_property_wrapper\n    value = obj.__dict__[self.func.__name__] = self.func(obj)\n  File \"/opt/conda/lib/python3.10/site-packages/stack_data/core.py\", line 660, in executing_piece\n    return only(\n  File \"/opt/conda/lib/python3.10/site-packages/executing/executing.py\", line 190, in only\n    raise NotOneValueFound('Expected one value, found 0')\nexecuting.executing.NotOneValueFound: Expected one value, found 0\n```",
    "2365866": ""
  }
}