custom dataset error no csv file found

akhil_reddy1: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/7/8/781189e5443aad7dc099388a9aa44113a9dbc06e.png" data-download-href="https://discuss.pytorch.org/uploads/default/781189e5443aad7dc099388a9aa44113a9dbc06e" title="Screenshot (42)"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/7/8/781189e5443aad7dc099388a9aa44113a9dbc06e_2_690x388.png" alt="Screenshot (42)" data-base62-sha1="h8aS7e7EF22h5TXo9KthyX8COrI" width="690" height="388" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/7/8/781189e5443aad7dc099388a9aa44113a9dbc06e_2_690x388.png, https://discuss.pytorch.org/uploads/default/optimized/3X/7/8/781189e5443aad7dc099388a9aa44113a9dbc06e_2_1035x582.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/7/8/781189e5443aad7dc099388a9aa44113a9dbc06e_2_1380x776.png 2x" data-dominant-color="E8E9EA"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">Screenshot (42)</span><span class="informations">1920×1080 243 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>FileNotFoundError                         Traceback (most recent call last)<br>
 in <br>
17<br>
18         return(image,y_label)<br>
—&gt; 19 dataset=plantpathology(train_csv=‘train_csv’, root_dir=‘plant_pathology’, transform=transforms.ToTensor())</p>
<p> in <strong>init</strong>(self, train_csv, root_dir, transform)<br>
1 class plantpathology(Dataset):<br>
2     def <strong>init</strong>(self, train_csv, root_dir, transform=None):<br>
----&gt; 3         self.annotations= pd.read_csv(train_csv)<br>
4         self.root_dir=root_dir<br>
5         self.transform =transform</p>
<p>/opt/conda/lib/python3.7/site-packages/pandas/io/parsers.py in read_csv(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, dialect, error_bad_lines, warn_bad_lines, delim_whitespace, low_memory, memory_map, float_precision, storage_options)<br>
603     kwds.update(kwds_defaults)<br>
604<br>
 → 605     return _read(filepath_or_buffer, kwds)<br>
606<br>
607</p>
<p>/opt/conda/lib/python3.7/site-packages/pandas/io/parsers.py in _read(filepath_or_buffer, kwds)<br>
455<br>
456     # Create the parser.<br>
 → 457     parser = TextFileReader(filepath_or_buffer, **kwds)<br>
458<br>
459     if chunksize or iterator:</p>
<p>/opt/conda/lib/python3.7/site-packages/pandas/io/parsers.py in <strong>init</strong>(self, f, engine, **kwds)<br>
812             self.options[“has_index_names”] = kwds[“has_index_names”]<br>
813<br>
 → 814         self._engine = self._make_engine(self.engine)<br>
815<br>
816     def close(self):</p>
<p>/opt/conda/lib/python3.7/site-packages/pandas/io/parsers.py in _make_engine(self, engine)<br>
1043             )<br>
1044         # error: Too many arguments for “ParserBase”<br>
 → 1045         return mapping[engine](self.f, **self.options)  # type: ignore[call-arg]<br>
1046<br>
1047     def _failover_to_python(self):</p>
<p>/opt/conda/lib/python3.7/site-packages/pandas/io/parsers.py in <strong>init</strong>(self, src, **kwds)<br>
1860<br>
1861         # open handles<br>
 → 1862         self._open_handles(src, kwds)<br>
1863         assert self.handles is not None<br>
1864         for key in (“storage_options”, “encoding”, “memory_map”, “compression”):</p>
<p>/opt/conda/lib/python3.7/site-packages/pandas/io/parsers.py in _open_handles(self, src, kwds)<br>
1361             compression=kwds.get(“compression”, None),<br>
1362             memory_map=kwds.get(“memory_map”, False),<br>
 → 1363             storage_options=kwds.get(“storage_options”, None),<br>
1364         )<br>
1365</p>
<p>/opt/conda/lib/python3.7/site-packages/pandas/io/common.py in get_handle(path_or_buf, mode, encoding, compression, memory_map, is_text, errors, storage_options)<br>
642                 encoding=ioargs.encoding,<br>
643                 errors=errors,<br>
 → 644                 newline=“”,<br>
645             )<br>
646         else:</p>
<p>FileNotFoundError: [Errno 2] No such file or directory: ‘train_csv’</p>
<p>Search Stack Overflow</p>

ptrblck: <p>This error is raised by <code>pandas</code>, as it cannot find the specified file:</p>
<pre><code class="lang-python">FileNotFoundError: [Errno 2] No such file or directory: ‘train_csv’
</code></pre>
<p>Make sure the <code>train_csv</code> is located in the current working directly or adjust the path appropriately.</p>
<p>PS: you can post code snippets by wrapping them into three backticks ```, which makes debugging easier and indexing possible. <img src="https://discuss.pytorch.org/images/emoji/apple/wink.png?v=9" title=":wink:" class="emoji" alt=":wink:"></p>