Forum Discussion
%%configure not starting session with given environment id and environment name
seems like there is a new issue in fabric pipeline run, in pipeline, while trying to run the notebook by passing the environment id and the name of the environment, we are getting this failure
and we tried checking the environment id from the workspace, it is same as this only
same thing is happening in other workspace also, and this starting happening recently only.
and we also tried running the notebook manually also with %%configure, still getting same failure
any help would be appreciated.
thanks!
deborshi_nag thanks for your insights, but i wanted to try this approach only, no issues this issue have been resolved apprently, after some hours it started working the way before, probably some intermitten issue was there.
thanks!
4 Replies
- deborshi_nag
Super User
Hello YashRaj5
When you want to run a PySpark notebook from a Fabric pipeline, you need to think of the environment as something that belongs to the notebook, not the pipeline. The pipeline doesn’t control Spark at all — it just triggers the notebook, which then starts Spark using whatever environment it’s already attached to.
For anything you care about running reliably, you should attach a published Fabric Environment to the notebook. That’s where you define the Spark runtime, Python libraries, and compute sizing so every run behaves the same whether it’s interactive or triggered by a pipeline.
Once the notebook is bound to an environment, pipeline runs become predictable. Spark always starts with the same configuration, libraries are guaranteed to be available, and you avoid the usual “it worked yesterday but not today” surprises.
This is also why you shouldn’t rely on notebook‑level tweaks for pipelines. Pipelines can reuse Spark sessions or initialise Spark before your notebook code runs, which means inline configuration can be skipped without warning.
That’s where %%configure fits in. You use it when you’re working interactively and just want to experiment — for example, testing memory settings, executor counts, or Spark SQL tuning while debugging performance.
What you don’t want to do is treat %%configure as a production mechanism. It’s session‑scoped, easy to miss, and not guaranteed to apply in pipeline runs, which makes it risky and hard to govern.
In short, if the configuration needs to be consistent, repeatable, and pipeline‑safe, you attach an environment to the notebook. If you’re just exploring or tuning things in an ad‑hoc session, that’s when %%configure makes sense.
- YashRaj5Frequent Visitor
deborshi_nag thanks for your insights, but i wanted to try this approach only, no issues this issue have been resolved apprently, after some hours it started working the way before, probably some intermitten issue was there.
thanks!
- v-karpurapud
Community Support
Hi YashRaj5
Thank you for the update. If you have any more questions, please let us know and we’ll be happy to help.
Regards,
Microsoft Fabric Community Support Team
- tayloramy
Super User
I agree with deborshi_nag here, you should be attaching the environment to the notebook though the UI not through the magic command.