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

File Not Found error in Jupyter Notebook when i use auto.assign_causal_mechnism #1142

Closed
bernddude opened this issue Jan 24, 2024 · 8 comments
Labels
question Further information is requested stale

Comments

@bernddude
Copy link

Ask your question
my model is working fine, however when i try to use the auto assignment feature
i get a stubborn File Not found error

Expected behavior
The same code ran fine before, is there any system variable setting required
This is a new notebook

Version information:

  • DoWhy version [e.g. 0.7]

Additional context
None

@bernddude bernddude added the question Further information is requested label Jan 24, 2024
@bloebp
Copy link
Member

bloebp commented Jan 24, 2024

Hi,

can you post the error stack?

@bernddude
Copy link
Author

Thank you so much for your quick response .... is this what you were looking for ?


FileNotFoundError Traceback (most recent call last)
Cell In[258], line 25
23 print('use auto')
24 q = gcm.auto.AssignmentQuality(Quality)
---> 25 gcm.auto.assign_causal_mechanisms(Icausal_model,based_on = dfOutS[list(nodesG)],quality=q,override_models=True)
27 # 2. Fitting the PCM to the data:
28 if classification:

File ~/anaconda3/envs/loki/lib/python3.9/site-packages/dowhy/gcm/auto.py:294, in assign_causal_mechanisms(causal_model, based_on, quality, override_models)
291 validate_causal_model_assignment(causal_model.graph, node)
292 continue
--> 294 model_performances = assign_causal_mechanism_node(causal_model, node, based_on, quality)
296 if is_root_node(causal_model.graph, node):
297 auto_assignment_summary.add_node_log_message(
298 node,
299 "Node %s is a root node. Therefore, assigning '%s' to the node representing the marginal distribution."
300 % (node, causal_model.causal_mechanism(node)),
301 )

File ~/anaconda3/envs/loki/lib/python3.9/site-packages/dowhy/gcm/auto.py:362, in assign_causal_mechanism_node(causal_model, node, based_on, quality)
359 else:
360 node_data = based_on[node].to_numpy()
--> 362 best_model, model_performances = select_model(
363 based_on[get_ordered_predecessors(causal_model.graph, node)].to_numpy(),
...
69 )
71 # Send sys_path and make sure the current directory will not be changed
72 d["sys_path"] = [p if p != "" else process.ORIGINAL_DIR for p in sys.path]

Overall Error stack

"name": "FileNotFoundError",
"message": "[Errno 2] No such file or directory",
"stack": "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)\nCell \u001b[0;32mIn[258], line 25\u001b[0m\n\u001b[1;32m 23\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124muse auto\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 24\u001b[0m q \u001b[38;5;241m=\u001b[39m gcm\u001b[38;5;241m.\u001b[39mauto\u001b[38;5;241m.\u001b[39mAssignmentQuality(Quality)\n\u001b[0;32m---> 25\u001b[0m \u001b[43mgcm\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mauto\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43massign_causal_mechanisms\u001b[49m\u001b[43m(\u001b[49m\u001b[43mIcausal_model\u001b[49m\u001b[43m,\u001b[49m\u001b[43mbased_on\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mdfOutS\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mlist\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mnodesG\u001b[49m\u001b[43m)\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43mquality\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mq\u001b[49m\u001b[43m,\u001b[49m\u001b[43moverride_models\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 27\u001b[0m \u001b[38;5;66;03m# 2. Fitting the PCM to the data:\u001b[39;00m\n\u001b[1;32m 28\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m classification: \n\nFile \u001b[0;32m~/anaconda3/envs/loki/lib/python3.9/site-packages/dowhy/gcm/auto.py:294\u001b[0m, in \u001b[0;36massign_causal_mechanisms\u001b[0;34m(causal_model, based_on, quality, override_models)\u001b[0m\n\u001b[1;32m 291\u001b[0m validate_causal_model_assignment(causal_model\u001b[38;5;241m.\u001b[39mgraph, node)\n\u001b[1;32m 292\u001b[0m \u001b[38;5;28;01mcontinue\u001b[39;00m\n\u001b[0;32m--> 294\u001b[0m model_performances \u001b[38;5;241m=\u001b[39m \u001b[43massign_causal_mechanism_node\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcausal_model\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnode\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbased_on\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mquality\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 296\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m is_root_node(causal_model\u001b[38;5;241m.\u001b[39mgraph, node):\n\u001b[1;32m 297\u001b[0m auto_assignment_summary\u001b[38;5;241m.\u001b[39madd_node_log_message(\n\u001b[1;32m 298\u001b[0m node,\n\u001b[1;32m 299\u001b[0m \u001b[38;5;124m"\u001b[39m\u001b[38;5;124mNode \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m is a root node. Therefore, assigning \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m to the node representing the marginal distribution.\u001b[39m\u001b[38;5;124m"\u001b[39m\n\u001b[1;32m 300\u001b[0m \u001b[38;5;241m%\u001b[39m (node, causal_model\u001b[38;5;241m.\u001b[39mcausal_mechanism(node)),\n\u001b[1;32m 301\u001b[0m )\n\nFile \u001b[0;32m~/anaconda3/envs/loki/lib/python3.9/site-packages/dowhy/gcm/auto.py:362\u001b[0m, in \u001b[0;36massign_causal_mechanism_node\u001b[0;34m(causal_model, node, based_on, quality)\u001b[0m\n\u001b[1;32m 359\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 360\u001b[0m node_data \u001b[38;5;241m=\u001b[39m based_on[node]\u001b[38;5;241m.\u001b[39mto_numpy()\n\u001b[0;32m--> 362\u001b[0m best_model, model_performances \u001b[38;5;241m=\u001b[39m \u001b[43mselect_model\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 363\u001b[0m \u001b[43m \u001b[49m\u001b[43mbased_on\u001b[49m\u001b[43m[\u001b[49m\u001b[43mget_ordered_predecessors\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcausal_model\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgraph\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnode\u001b[49m\u001b[43m)\u001b[49m\u001b[43m]\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mto_numpy\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 364\u001b[0m \u001b[43m \u001b[49m\u001b[43mnode_data\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 365\u001b[0m \u001b[43m \u001b[49m\u001b[43mquality\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 366\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 368\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(best_model, ClassificationModel):\n\u001b[1;32m 369\u001b[0m causal_model\u001b[38;5;241m.\u001b[39mset_causal_mechanism(node, ClassifierFCM(best_model))\n\nFile \u001b[0;32m~/anaconda3/envs/loki/lib/python3.9/site-packages/dowhy/gcm/auto.py:417\u001b[0m, in \u001b[0;36mselect_model\u001b[0;34m(X, Y, model_selection_quality)\u001b[0m\n\u001b[1;32m 415\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m best_model(), model_performances\n\u001b[1;32m 416\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 417\u001b[0m best_model, model_performances \u001b[38;5;241m=\u001b[39m \u001b[43mfind_best_model\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 418\u001b[0m \u001b[43m \u001b[49m\u001b[43mlist_of_regressor\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mX\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mY\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmodel_selection_splits\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmodel_selection_splits\u001b[49m\n\u001b[1;32m 419\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 420\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m best_model(), model_performances\n\nFile \u001b[0;32m~/anaconda3/envs/loki/lib/python3.9/site-packages/dowhy/gcm/auto.py:543\u001b[0m, in \u001b[0;36mfind_best_model\u001b[0;34m(prediction_model_factories, X, Y, metric, max_samples_per_split, model_selection_splits, n_jobs)\u001b[0m\n\u001b[1;32m 540\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mfloat\u001b[39m(np\u001b[38;5;241m.\u001b[39mmean(average_result))\n\u001b[1;32m 542\u001b[0m random_seeds \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mrandint(np\u001b[38;5;241m.\u001b[39miinfo(np\u001b[38;5;241m.\u001b[39mint32)\u001b[38;5;241m.\u001b[39mmax, size\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mlen\u001b[39m(prediction_model_factories))\n\u001b[0;32m--> 543\u001b[0m average_metric_scores \u001b[38;5;241m=\u001b[39m \u001b[43mParallel\u001b[49m\u001b[43m(\u001b[49m\u001b[43mn_jobs\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mn_jobs\u001b[49m\u001b[43m)\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 544\u001b[0m \u001b[43m \u001b[49m\u001b[43mdelayed\u001b[49m\u001b[43m(\u001b[49m\u001b[43mestimate_average_score\u001b[49m\u001b[43m)\u001b[49m\u001b[43m(\u001b[49m\u001b[43mprediction_model_factory\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mint\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mrandom_seed\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 545\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43;01mfor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mprediction_model_factory\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mrandom_seed\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01min\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43mzip\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mprediction_model_factories\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mrandom_seeds\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 546\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 547\u001b[0m sorted_results \u001b[38;5;241m=\u001b[39m \u001b[38;5;28msorted\u001b[39m(\n\u001b[1;32m 548\u001b[0m \u001b[38;5;28mzip\u001b[39m(prediction_model_factories, average_metric_scores, [metric_name] \u001b[38;5;241m*\u001b[39m \u001b[38;5;28mlen\u001b[39m(prediction_model_factories)),\n\u001b[1;32m 549\u001b[0m key\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mlambda\u001b[39;00m x: x[\u001b[38;5;241m1\u001b[39m],\n\u001b[1;32m 550\u001b[0m )\n\u001b[1;32m 552\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m sorted_results[\u001b[38;5;241m0\u001b[39m][\u001b[38;5;241m0\u001b[39m], sorted_results\n\nFile \u001b[0;32m~/anaconda3/envs/loki/lib/python3.9/site-packages/joblib/parallel.py:1950\u001b[0m, in \u001b[0;36mParallel.call\u001b[0;34m(self, iterable)\u001b[0m\n\u001b[1;32m 1944\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_call_ref \u001b[38;5;241m=\u001b[39m weakref\u001b[38;5;241m.\u001b[39mref(output)\n\u001b[1;32m 1946\u001b[0m \u001b[38;5;66;03m# The first item from the output is blank, but it makes the interpreter\u001b[39;00m\n\u001b[1;32m 1947\u001b[0m \u001b[38;5;66;03m# progress until it enters the Try/Except block of the generator and\u001b[39;00m\n\u001b[1;32m 1948\u001b[0m \u001b[38;5;66;03m# reach the first yield statement. This starts the aynchronous\u001b[39;00m\n\u001b[1;32m 1949\u001b[0m \u001b[38;5;66;03m# dispatch of the tasks to the workers.\u001b[39;00m\n\u001b[0;32m-> 1950\u001b[0m \u001b[38;5;28;43mnext\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43moutput\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1952\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m output \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mreturn_generator \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28mlist\u001b[39m(output)\n\nFile \u001b[0;32m~/anaconda3/envs/loki/lib/python3.9/site-packages/joblib/parallel.py:1588\u001b[0m, in \u001b[0;36mParallel._get_outputs\u001b[0;34m(self, iterator, pre_dispatch)\u001b[0m\n\u001b[1;32m 1586\u001b[0m detach_generator_exit \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[1;32m 1587\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 1588\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_start\u001b[49m\u001b[43m(\u001b[49m\u001b[43miterator\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpre_dispatch\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1589\u001b[0m \u001b[38;5;66;03m# first yield returns None, for internal use only. This ensures\u001b[39;00m\n\u001b[1;32m 1590\u001b[0m \u001b[38;5;66;03m# that we enter the try/except block and start dispatching the\u001b[39;00m\n\u001b[1;32m 1591\u001b[0m \u001b[38;5;66;03m# tasks.\u001b[39;00m\n\u001b[1;32m 1592\u001b[0m \u001b[38;5;28;01myield\u001b[39;00m\n\nFile \u001b[0;32m~/anaconda3/envs/loki/lib/python3.9/site-packages/joblib/parallel.py:1571\u001b[0m, in \u001b[0;36mParallel._start\u001b[0;34m(self, iterator, pre_dispatch)\u001b[0m\n\u001b[1;32m 1562\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_start\u001b[39m(\u001b[38;5;28mself\u001b[39m, iterator, pre_dispatch):\n\u001b[1;32m 1563\u001b[0m \u001b[38;5;66;03m# Only set self._iterating to True if at least a batch\u001b[39;00m\n\u001b[1;32m 1564\u001b[0m \u001b[38;5;66;03m# was dispatched. In particular this covers the edge\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1568\u001b[0m \u001b[38;5;66;03m# was very quick and its callback already dispatched all the\u001b[39;00m\n\u001b[1;32m 1569\u001b[0m \u001b[38;5;66;03m# remaining jobs.\u001b[39;00m\n\u001b[1;32m 1570\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_iterating \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[0;32m-> 1571\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdispatch_one_batch\u001b[49m\u001b[43m(\u001b[49m\u001b[43miterator\u001b[49m\u001b[43m)\u001b[49m:\n\u001b[1;32m 1572\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_iterating \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_original_iterator \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 1574\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdispatch_one_batch(iterator):\n\nFile \u001b[0;32m~/anaconda3/envs/loki/lib/python3.9/site-packages/joblib/parallel.py:1462\u001b[0m, in \u001b[0;36mParallel.dispatch_one_batch\u001b[0;34m(self, iterator)\u001b[0m\n\u001b[1;32m 1460\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[1;32m 1461\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1462\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_dispatch\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtasks\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1463\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m\n\nFile \u001b[0;32m~/anaconda3/envs/loki/lib/python3.9/site-packages/joblib/parallel.py:1384\u001b[0m, in \u001b[0;36mParallel._dispatch\u001b[0;34m(self, batch)\u001b[0m\n\u001b[1;32m 1379\u001b[0m batch_tracker \u001b[38;5;241m=\u001b[39m BatchCompletionCallBack(\n\u001b[1;32m 1380\u001b[0m dispatch_timestamp, batch_size, \u001b[38;5;28mself\u001b[39m\n\u001b[1;32m 1381\u001b[0m )\n\u001b[1;32m 1382\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_jobs\u001b[38;5;241m.\u001b[39mappend(batch_tracker)\n\u001b[0;32m-> 1384\u001b[0m job \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_backend\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mapply_async\u001b[49m\u001b[43m(\u001b[49m\u001b[43mbatch\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcallback\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbatch_tracker\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1385\u001b[0m batch_tracker\u001b[38;5;241m.\u001b[39mregister_job(job)\n\nFile \u001b[0;32m~/anaconda3/envs/loki/lib/python3.9/site-packages/joblib/_parallel_backends.py:600\u001b[0m, in \u001b[0;36mLokyBackend.apply_async\u001b[0;34m(self, func, callback)\u001b[0m\n\u001b[1;32m 598\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mapply_async\u001b[39m(\u001b[38;5;28mself\u001b[39m, func, callback\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m):\n\u001b[1;32m 599\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m"""Schedule a func to be run"""\u001b[39;00m\n\u001b[0;32m--> 600\u001b[0m future \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_workers\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msubmit\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfunc\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 601\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m callback \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 602\u001b[0m future\u001b[38;5;241m.\u001b[39madd_done_callback(callback)\n\nFile \u001b[0;32m~/anaconda3/envs/loki/lib/python3.9/site-packages/joblib/externals/loky/reusable_executor.py:225\u001b[0m, in \u001b[0;36m_ReusablePoolExecutor.submit\u001b[0;34m(self, fn, args, kwargs)\u001b[0m\n\u001b[1;32m 223\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21msubmit\u001b[39m(\u001b[38;5;28mself\u001b[39m, fn, \u001b[38;5;241m\u001b[39margs, \u001b[38;5;241m\u001b[39m\u001b[38;5;241m\u001b[39mkwargs):\n\u001b[1;32m 224\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_submit_resize_lock:\n\u001b[0;32m--> 225\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msubmit\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfn\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\nFile \u001b[0;32m~/anaconda3/envs/loki/lib/python3.9/site-packages/joblib/externals/loky/process_executor.py:1248\u001b[0m, in \u001b[0;36mProcessPoolExecutor.submit\u001b[0;34m(self, fn, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1245\u001b[0m \u001b[38;5;66;03m# Wake up queue management thread\u001b[39;00m\n\u001b[1;32m 1246\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_executor_manager_thread_wakeup\u001b[38;5;241m.\u001b[39mwakeup()\n\u001b[0;32m-> 1248\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_ensure_executor_running\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1249\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m f\n\nFile \u001b[0;32m~/anaconda3/envs/loki/lib/python3.9/site-packages/joblib/externals/loky/process_executor.py:1220\u001b[0m, in \u001b[0;36mProcessPoolExecutor._ensure_executor_running\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 1218\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_processes_management_lock:\n\u001b[1;32m 1219\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_processes) \u001b[38;5;241m!=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_max_workers:\n\u001b[0;32m-> 1220\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_adjust_process_count\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1221\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_start_executor_manager_thread()\n\nFile \u001b[0;32m~/anaconda3/envs/loki/lib/python3.9/site-packages/joblib/externals/loky/process_executor.py:1209\u001b[0m, in \u001b[0;36mProcessPoolExecutor._adjust_process_count\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 1207\u001b[0m p \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_context\u001b[38;5;241m.\u001b[39mProcess(target\u001b[38;5;241m=\u001b[39m_process_worker, args\u001b[38;5;241m=\u001b[39margs)\n\u001b[1;32m 1208\u001b[0m p\u001b[38;5;241m.\u001b[39m_worker_exit_lock \u001b[38;5;241m=\u001b[39m worker_exit_lock\n\u001b[0;32m-> 1209\u001b[0m \u001b[43mp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mstart\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1210\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_processes[p\u001b[38;5;241m.\u001b[39mpid] \u001b[38;5;241m=\u001b[39m p\n\u001b[1;32m 1211\u001b[0m mp\u001b[38;5;241m.\u001b[39mutil\u001b[38;5;241m.\u001b[39mdebug(\n\u001b[1;32m 1212\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m"\u001b[39m\u001b[38;5;124mAdjusted process count to \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_max_workers\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m: \u001b[39m\u001b[38;5;124m"\u001b[39m\n\u001b[1;32m 1213\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00m[(p\u001b[38;5;241m.\u001b[39mname,\u001b[38;5;250m \u001b[39mpid)\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mfor\u001b[39;00m\u001b[38;5;250m \u001b[39mpid,\u001b[38;5;250m \u001b[39mp\u001b[38;5;250m \u001b[39m\u001b[38;5;129;01min\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_processes\u001b[38;5;241m.\u001b[39mitems()]\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m"\u001b[39m\n\u001b[1;32m 1214\u001b[0m )\n\nFile \u001b[0;32m~/anaconda3/envs/loki/lib/python3.9/multiprocessing/process.py:121\u001b[0m, in \u001b[0;36mBaseProcess.start\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 118\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m _current_process\u001b[38;5;241m.\u001b[39m_config\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mdaemon\u001b[39m\u001b[38;5;124m'\u001b[39m), [\\n\u001b1;32m 119\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mdaemonic processes are not allowed to have children\u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[1;32m 120\u001b[0m _cleanup()\n\u001b[0;32m--> 121\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_popen \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_Popen\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 122\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_sentinel \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_popen\u001b[38;5;241m.\u001b[39msentinel\n\u001b[1;32m 123\u001b[0m \u001b[38;5;66;03m# Avoid a refcycle if the target function holds an indirect\u001b[39;00m\n\u001b[1;32m 124\u001b[0m \u001b[38;5;66;03m# reference to the process object (see bpo-30775)\u001b[39;00m\n\nFile \u001b[0;32m~/anaconda3/envs/loki/lib/python3.9/site-packages/joblib/externals/loky/backend/process.py:45\u001b[0m, in \u001b[0;36mLokyProcess._Popen\u001b[0;34m(process_obj)\u001b[0m\n\u001b[1;32m 43\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 44\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mpopen_loky_posix\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Popen\n\u001b[0;32m---> 45\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mPopen\u001b[49m\u001b[43m(\u001b[49m\u001b[43mprocess_obj\u001b[49m\u001b[43m)\u001b[49m\n\nFile \u001b[0;32m~/anaconda3/envs/loki/lib/python3.9/site-packages/joblib/externals/loky/backend/popen_loky_posix.py:48\u001b[0m, in \u001b[0;36mPopen.init\u001b[0;34m(self, process_obj)\u001b[0m\n\u001b[1;32m 46\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mreturncode \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 47\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_fds \u001b[38;5;241m=\u001b[39m []\n\u001b[0;32m---> 48\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_launch\u001b[49m\u001b[43m(\u001b[49m\u001b[43mprocess_obj\u001b[49m\u001b[43m)\u001b[49m\n\nFile \u001b[0;32m~/anaconda3/envs/loki/lib/python3.9/site-packages/joblib/externals/loky/backend/popen_loky_posix.py:99\u001b[0m, in \u001b[0;36mPopen._launch\u001b[0;34m(self, process_obj)\u001b[0m\n\u001b[1;32m 97\u001b[0m set_spawning_popen(\u001b[38;5;28mself\u001b[39m)\n\u001b[1;32m 98\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m---> 99\u001b[0m prep_data \u001b[38;5;241m=\u001b[39m \u001b[43mspawn\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_preparation_data\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 100\u001b[0m \u001b[43m \u001b[49m\u001b[43mprocess_obj\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_name\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 101\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mgetattr\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mprocess_obj\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m"\u001b[39;49m\u001b[38;5;124;43minit_main_module\u001b[39;49m\u001b[38;5;124;43m"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 102\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 103\u001b[0m reduction\u001b[38;5;241m.\u001b[39mdump(prep_data, fp)\n\u001b[1;32m 104\u001b[0m reduction\u001b[38;5;241m.\u001b[39mdump(process_obj, fp)\n\nFile \u001b[0;32m~/anaconda3/envs/loki/lib/python3.9/site-packages/joblib/externals/loky/backend/spawn.py:68\u001b[0m, in \u001b[0;36mget_preparation_data\u001b[0;34m(name, init_main_module)\u001b[0m\n\u001b[1;32m 60\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m"""Return info about parent needed by child to unpickle process object."""\u001b[39;00m\n\u001b[1;32m 61\u001b[0m _check_not_importing_main()\n\u001b[1;32m 62\u001b[0m d \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mdict\u001b[39m(\n\u001b[1;32m 63\u001b[0m log_to_stderr\u001b[38;5;241m=\u001b[39mutil\u001b[38;5;241m.\u001b[39m_log_to_stderr,\n\u001b[1;32m 64\u001b[0m authkey\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mbytes\u001b[39m(process\u001b[38;5;241m.\u001b[39mcurrent_process()\u001b[38;5;241m.\u001b[39mauthkey),\n\u001b[1;32m 65\u001b[0m name\u001b[38;5;241m=\u001b[39mname,\n\u001b[1;32m 66\u001b[0m sys_argv\u001b[38;5;241m=\u001b[39msys\u001b[38;5;241m.\u001b[39margv,\n\u001b[1;32m 67\u001b[0m orig_dir\u001b[38;5;241m=\u001b[39mprocess\u001b[38;5;241m.\u001b[39mORIGINAL_DIR,\n\u001b[0;32m---> 68\u001b[0m \u001b[38;5;28mdir\u001b[39m\u001b[38;5;241m=\u001b[39m\u001b[43mos\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetcwd\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m,\n\u001b[1;32m 69\u001b[0m )\n\u001b[1;32m 71\u001b[0m \u001b[38;5;66;03m# Send sys_path and make sure the current directory will not be changed\u001b[39;00m\n\u001b[1;32m 72\u001b[0m d[\u001b[38;5;124m"\u001b[39m\u001b[38;5;124msys_path\u001b[39m\u001b[38;5;124m"\u001b[39m] \u001b[38;5;241m=\u001b[39m [p \u001b[38;5;28;01mif\u001b[39;00m p \u001b[38;5;241m!=\u001b[39m \u001b[38;5;124m"\u001b[39m\u001b[38;5;124m"\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m process\u001b[38;5;241m.\u001b[39mORIGINAL_DIR \u001b[38;5;28;01mfor\u001b[39;00m p \u001b[38;5;129;01min\u001b[39;00m sys\u001b[38;5;241m.\u001b[39mpath]\n\n\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory"
}

@bloebp
Copy link
Member

bloebp commented Jan 25, 2024

That is weird. Did you make sure to have the newest version installed (0.11.1)? And is it only happening when you call assign_causal_mechnism?

Otherwise, if you can provide a short executable code snippet to reproduce this, I can take a look (you can simply use some dummy data).

@bernddude
Copy link
Author

bernddude commented Jan 25, 2024

Thank you so much for your continued help. Yes i install the code yesterday (on this machine).
and so far the only problem i have is this specific error. All the rest of my code which i used on other machines before runs just fine (actually i am positive surprised about that) :)
To be totally honest i was expecting that its just some issue with global settings on my side, i was just wondering / hoping that somebody might have run into the same issue before ?

pls don't worry to much , its not the biggest issue.
i will likely poke around a bit more 9on the machine) , just have to finish some other work right and .
i will leave a message here in case i find the cause & a solution

@bernddude
Copy link
Author

Hello Patrick, i found out what was the issue . The problem was that my Jupyter environment was referring to a non existing current directory . I am assuming that might be b/c i was running the code on a network drive.
I solved the issue by explicitly assigning a working directory and it all worked fine.

The clue that gave it away was that when i ran os.getcwd() i got the same error
i just had a hunch that its something like that , which is why i checked on the working directory
Once i got that error , i was pretty sure what's the issue and how to solve it

thx again for your help and i hope this might help the next guy :)

@bloebp
Copy link
Member

bloebp commented Jan 26, 2024

Great, glad to hear it is working now! :)

Copy link

This issue is stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added the stale label Feb 10, 2024
Copy link

This issue was closed because it has been inactive for 7 days since being marked as stale.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested stale
Projects
None yet
Development

No branches or pull requests

2 participants