FenTechSolutions / CausalDiscoveryToolbox

Package for causal inference in graphs and in the pairwise settings. Tools for graph structure recovery and dependencies are included.
https://fentechsolutions.github.io/CausalDiscoveryToolbox/html/index.html
MIT License
1.12k stars 197 forks source link

FileNotFoundError: [Errno 2] No such file or directory #73

Open ghost opened 4 years ago

ghost commented 4 years ago
from cdt import causality
pc = causality.graph.PC()
pc.create_graph_from_data(df)

~/opt/anaconda3/envs/panaya/lib/python3.8/site-packages/cdt/causality/graph/PC.py in create_graph_from_data(self, data, **kwargs) 275 self.arguments['{VERBOSE}'] = str(self.verbose).upper() 276 --> 277 results = self._run_pc(data, verbose=self.verbose) 278 279 return nx.relabel_nodes(nx.DiGraph(results),

~/opt/anaconda3/envs/panaya/lib/python3.8/site-packages/cdt/causality/graph/PC.py in _run_pc(self, data, fixedEdges, fixedGaps, verbose) 307 except Exception as e: 308 rmtree(run_dir) --> 309 raise e 310 except KeyboardInterrupt: 311 rmtree(run_dir)

~/opt/anaconda3/envs/panaya/lib/python3.8/site-packages/cdt/causality/graph/PC.py in _run_pc(self, data, fixedEdges, fixedGaps, verbose) 302 self.arguments['{SKELETON}'] = 'FALSE' 303 --> 304 pc_result = launch_R_script("{}/R_templates/pc.R".format(os.path.dirname(os.path.realpath(file))), 305 self.arguments, output_function=retrieve_result, verbose=verbose) 306 # Cleanup

~/opt/anaconda3/envs/panaya/lib/python3.8/site-packages/cdt/utils/R.py in launch_R_script(template, arguments, output_function, verbose, debug) 198 if not debug: 199 rmtree(base_dir) --> 200 raise e 201 except KeyboardInterrupt: 202 if not debug:

~/opt/anaconda3/envs/panaya/lib/python3.8/site-packages/cdt/utils/R.py in launch_R_script(template, arguments, output_function, verbose, debug) 192 stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) 193 process.wait() --> 194 output = output_function() 195 196 # Cleaning up

~/opt/anaconda3/envs/panaya/lib/python3.8/site-packages/cdt/causality/graph/PC.py in retrieve_result() 291 292 def retrieve_result(): --> 293 return read_csv('{}/result.csv'.format(run_dir), delimiter=',').values 294 295 try:

~/opt/anaconda3/envs/panaya/lib/python3.8/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) 684 ) 685 --> 686 return _read(filepath_or_buffer, kwds) 687 688

~/opt/anaconda3/envs/panaya/lib/python3.8/site-packages/pandas/io/parsers.py in _read(filepath_or_buffer, kwds) 450 451 # Create the parser. --> 452 parser = TextFileReader(fp_or_buf, **kwds) 453 454 if chunksize or iterator:

~/opt/anaconda3/envs/panaya/lib/python3.8/site-packages/pandas/io/parsers.py in init(self, f, engine, **kwds) 934 self.options["has_index_names"] = kwds["has_index_names"] 935 --> 936 self._make_engine(self.engine) 937 938 def close(self):

~/opt/anaconda3/envs/panaya/lib/python3.8/site-packages/pandas/io/parsers.py in _make_engine(self, engine) 1166 def _make_engine(self, engine="c"): 1167 if engine == "c": -> 1168 self._engine = CParserWrapper(self.f, **self.options) 1169 else: 1170 if engine == "python":

~/opt/anaconda3/envs/panaya/lib/python3.8/site-packages/pandas/io/parsers.py in init(self, src, kwds) 1996 kwds["usecols"] = self.usecols 1997 -> 1998 self._reader = parsers.TextReader(src, kwds) 1999 self.unnamed_cols = self._reader.unnamed_cols 2000

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader.cinit()

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._setup_parser_source()

FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/7l/27620by50812sxd514rjz_840000gn/T/cdt_pc_8de4b1da-bf55-411a-943d-a205b1ebce3d//result.csv'

ghost commented 4 years ago

I guess it is related to an R error which is not caught

diviyank commented 4 years ago

Which package version are you running ?

diviyank commented 4 years ago

Could you update your package to the latest version (0.5.21) and try again ?

yulaicui commented 3 years ago

I got a similar error trying to run GS. it is from lauch_R_script, R.py when a call to retrieving a csv file is called. the directory is okay, but it seems a result.csv is never created