Error when running PC alg (some CSV file)
See original GitHub issueHi, As you know, I have installed most of the packages and attempted to run PC alg on sachs as well as fsgnn. I thought I was out of trouble as the R setup looked fine, but when calling the following python3.6 snippet
from cdt.causality.graph.PC import PC
pc = PC(CItest="hsic",method_indep="rcit")
pcgraph = pc.predict(data)
The interpreter spat out the following error message:
pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._setup_parser_source()
FileNotFoundError: [Errno 2] File b'/tmp/cdt_pc_0f4d2452-ff3c-4a84-81dd-73ab5b4d474b//result.csv' does not exist: b'/tmp/cdt_pc_0f4d2452-ff3c-4a84-81dd-73ab5b4d474b//result.csv'
Any idea of what this is about?
Regards, A.V
NB: here is the full error printout
--------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-50-db1fca6dbddc> in <module>
----> 1 pcgraph = pc.predict(data)
~/progtools/python/virtualenvs/tfcuda/lib/python3.6/site-packages/cdt/causality/graph/model.py in predict(self, df_data, graph, **kwargs)
61 """
62 if graph is None:
---> 63 return self.create_graph_from_data(df_data, **kwargs)
64 elif isinstance(graph, nx.DiGraph):
65 return self.orient_directed_graph(df_data, graph, **kwargs)
~/progtools/python/virtualenvs/tfcuda/lib/python3.6/site-packages/cdt/causality/graph/PC.py in create_graph_from_data(self, data, **kwargs)
257 self.arguments['{VERBOSE}'] = str(self.verbose).upper()
258
--> 259 results = self._run_pc(data, verbose=self.verbose)
260
261 return nx.relabel_nodes(nx.DiGraph(results),
~/progtools/python/virtualenvs/tfcuda/lib/python3.6/site-packages/cdt/causality/graph/PC.py in _run_pc(self, data, fixedEdges, fixedGaps, verbose)
300 except Exception as e:
301 rmtree(run_dir)
--> 302 raise e
303 except KeyboardInterrupt:
304 rmtree(run_dir)
~/progtools/python/virtualenvs/tfcuda/lib/python3.6/site-packages/cdt/causality/graph/PC.py in _run_pc(self, data, fixedEdges, fixedGaps, verbose)
296
297 pc_result = launch_R_script("{}/R_templates/pc.R".format(os.path.dirname(os.path.realpath(__file__))),
--> 298 self.arguments, output_function=retrieve_result, verbose=verbose)
299 # Cleanup
300 except Exception as e:
~/progtools/python/virtualenvs/tfcuda/lib/python3.6/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:
~/progtools/python/virtualenvs/tfcuda/lib/python3.6/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
~/progtools/python/virtualenvs/tfcuda/lib/python3.6/site-packages/cdt/causality/graph/PC.py in retrieve_result()
284
285 def retrieve_result():
--> 286 return read_csv('{}/result.csv'.format(run_dir), delimiter=',').values
287
288 try:
~/progtools/python/virtualenvs/tfcuda/lib/python3.6/site-packages/pandas/io/parsers.py in parser_f(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)
683 )
684
--> 685 return _read(filepath_or_buffer, kwds)
686
687 parser_f.__name__ = name
~/progtools/python/virtualenvs/tfcuda/lib/python3.6/site-packages/pandas/io/parsers.py in _read(filepath_or_buffer, kwds)
455
456 # Create the parser.
--> 457 parser = TextFileReader(fp_or_buf, **kwds)
458
459 if chunksize or iterator:
~/progtools/python/virtualenvs/tfcuda/lib/python3.6/site-packages/pandas/io/parsers.py in __init__(self, f, engine, **kwds)
893 self.options["has_index_names"] = kwds["has_index_names"]
894
--> 895 self._make_engine(self.engine)
896
897 def close(self):
~/progtools/python/virtualenvs/tfcuda/lib/python3.6/site-packages/pandas/io/parsers.py in _make_engine(self, engine)
1133 def _make_engine(self, engine="c"):
1134 if engine == "c":
-> 1135 self._engine = CParserWrapper(self.f, **self.options)
1136 else:
1137 if engine == "python":
~/progtools/python/virtualenvs/tfcuda/lib/python3.6/site-packages/pandas/io/parsers.py in __init__(self, src, **kwds)
1915 kwds["usecols"] = self.usecols
1916
-> 1917 self._reader = parsers.TextReader(src, **kwds)
1918 self.unnamed_cols = self._reader.unnamed_cols
1919
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] File b'/tmp/cdt_pc_0f4d2452-ff3c-4a84-81dd-73ab5b4d474b//result.csv' does not exist: b'/tmp/cdt_pc_0f4d2452-ff3c-4a84-81dd-73ab5b4d474b//result.csv'
Issue Analytics
- State:
- Created 4 years ago
- Comments:10
Top Results From Across the Web
5 most common parsing errors in CSV files (and ... - Medium
#2 — Text field with an unescaped delimiter If the column separator appears unescaped in a text field, this will cause the line...
Read more >Error-free import of CSV files using Pandas DataFrame
Therefore, I have laid out some steps to avoid any error while importing and loading a data file using pandas DataFrame. Reading and...
Read more >AQWA: Crashing when importing csv file
I have tried different csv files and in different simulations, it always crashes. Can someone help me find a way to solve this?...
Read more >Large csv files: MemoryError: Unable to allocate 3.25 GiB for ...
I'm wondering if there is a way to bypass this memory error, or if there is a different function I can use that...
Read more >[BUG] Issue when i use functions that use R functions #70
But when I use functions in the package that use R functions, I get an error (e.g. ImportError: R Package pcalg is not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry for the delay. To solve @ArnoVel 's issue, it originates from :
These two options are incompatible. to use RCIT, you should use CItest=‘randomized’. I should change the API to make it simpler to avoid these issues.
It should be much easier to understand, and errors might be avoided in the future 😃