Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emmo_units.csv not found #2

Closed
yoavnash opened this issue May 4, 2023 · 0 comments · Fixed by #3
Closed

emmo_units.csv not found #2

yoavnash opened this issue May 4, 2023 · 0 comments · Fixed by #3
Labels
🐛 bug Something isn't working

Comments

@yoavnash
Copy link
Member

yoavnash commented May 4, 2023

The line from data2rdf.annotation_pipeline import AnnotationPipeline generates the following error:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Cell In[4], line 1
----> 1 from data2rdf.annotation_pipeline import AnnotationPipeline

File /opt/conda/lib/python3.10/site-packages/data2rdf/annotation_pipeline.py:13
     11 from data2rdf.excel_parser import ExcelParser
     12 from data2rdf.mapper import Mapper, merge_same_as_individuals
---> 13 from data2rdf.rdf_generation import RDFGenerator
     15 parser_choice = {
     16     "csv": CSVParser,
     17     "excel": ExcelParser,
     18 }
     21 class AnnotationPipeline:

File /opt/conda/lib/python3.10/site-packages/data2rdf/rdf_generation.py:7
      4 from rdflib import Graph
      6 from data2rdf.annotation_confs import annotations
----> 7 from data2rdf.emmo_lib import emmo_utils
     10 class RDFGenerator:
     12     """
     13     Transforms the generic excel sheet to RDF
     14     """

File /opt/conda/lib/python3.10/site-packages/data2rdf/emmo_lib/emmo_utils.py:6
      2 import os
      4 import pandas as pd
----> 6 unit_df = pd.read_csv(
      7     os.path.join(os.path.dirname(os.path.abspath(__file__)), "emmo_units.csv"),
      8     index_col=0,
      9 )
     10 prefix_df = pd.read_csv(
     11     os.path.join(
     12         os.path.dirname(os.path.abspath(__file__)), "emmo_unit_prefixes.csv"
     13     ),
     14     index_col=0,
     15 )
     18 def simple_unit_lookup(parsed_unit):

File /opt/conda/lib/python3.10/site-packages/pandas/util/_decorators.py:211, in deprecate_kwarg.<locals>._deprecate_kwarg.<locals>.wrapper(*args, **kwargs)
    209     else:
    210         kwargs[new_arg_name] = new_arg_value
--> 211 return func(*args, **kwargs)

File /opt/conda/lib/python3.10/site-packages/pandas/util/_decorators.py:331, in deprecate_nonkeyword_arguments.<locals>.decorate.<locals>.wrapper(*args, **kwargs)
    325 if len(args) > num_allow_args:
    326     warnings.warn(
    327         msg.format(arguments=_format_argument_list(allow_args)),
    328         FutureWarning,
    329         stacklevel=find_stack_level(),
    330     )
--> 331 return func(*args, **kwargs)

File /opt/conda/lib/python3.10/site-packages/pandas/io/parsers/readers.py:950, 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, encoding_errors, dialect, error_bad_lines, warn_bad_lines, on_bad_lines, delim_whitespace, low_memory, memory_map, float_precision, storage_options)
    935 kwds_defaults = _refine_defaults_read(
    936     dialect,
    937     delimiter,
   (...)
    946     defaults={"delimiter": ","},
    947 )
    948 kwds.update(kwds_defaults)
--> 950 return _read(filepath_or_buffer, kwds)

File /opt/conda/lib/python3.10/site-packages/pandas/io/parsers/readers.py:605, in _read(filepath_or_buffer, kwds)
    602 _validate_names(kwds.get("names", None))
    604 # Create the parser.
--> 605 parser = TextFileReader(filepath_or_buffer, **kwds)
    607 if chunksize or iterator:
    608     return parser

File /opt/conda/lib/python3.10/site-packages/pandas/io/parsers/readers.py:1442, in TextFileReader.__init__(self, f, engine, **kwds)
   1439     self.options["has_index_names"] = kwds["has_index_names"]
   1441 self.handles: IOHandles | None = None
-> 1442 self._engine = self._make_engine(f, self.engine)

File /opt/conda/lib/python3.10/site-packages/pandas/io/parsers/readers.py:1735, in TextFileReader._make_engine(self, f, engine)
   1733     if "b" not in mode:
   1734         mode += "b"
-> 1735 self.handles = get_handle(
   1736     f,
   1737     mode,
   1738     encoding=self.options.get("encoding", None),
   1739     compression=self.options.get("compression", None),
   1740     memory_map=self.options.get("memory_map", False),
   1741     is_text=is_text,
   1742     errors=self.options.get("encoding_errors", "strict"),
   1743     storage_options=self.options.get("storage_options", None),
   1744 )
   1745 assert self.handles is not None
   1746 f = self.handles.handle

File /opt/conda/lib/python3.10/site-packages/pandas/io/common.py:856, in get_handle(path_or_buf, mode, encoding, compression, memory_map, is_text, errors, storage_options)
    851 elif isinstance(handle, str):
    852     # Check whether the filename is to be opened in binary mode.
    853     # Binary mode does not support 'encoding' and 'newline'.
    854     if ioargs.encoding and "b" not in ioargs.mode:
    855         # Encoding
--> 856         handle = open(
    857             handle,
    858             ioargs.mode,
    859             encoding=ioargs.encoding,
    860             errors=errors,
    861             newline="",
    862         )
    863     else:
    864         # Binary mode
    865         handle = open(handle, ioargs.mode)

FileNotFoundError: [Errno 2] No such file or directory: '/opt/conda/lib/python3.10/site-packages/data2rdf/emmo_lib/emmo_units.csv'

By examining the folder /opt/conda/lib/python3.10/site-packages/data2rdf/emmo_lib/, this file is indeed missing:
image

@yoavnash yoavnash added the 🐛 bug Something isn't working label May 4, 2023
@yoavnash yoavnash linked a pull request May 4, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant