cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

'File not found' error when executing %run magic command

OliverCadman
New Contributor III

I'm just walking through a simple exercise presented in the Databricks Platform Lab notebook, in which I'm executing a remote notebook from within using the %run command. The remote notebook resides in the same directory as the Platform Lab notebook, and is named 'Notebook_B'. However, when I try to run it, a 'File not found' error is thrown. I've determined that the relative path to the notebook is correct. Might I be missing some extra bit of configuration? I've attached screenshots to illustrate.

Thanks for your time and assistance!

 

 

7 REPLIES 7

OliverCadman
New Contributor III

Hi Kaniz,

Thank you for taking the time to respond to my query. I will take your advice on board and give it a shot. Much appreciated!

OliverCadman
New Contributor III

I have stepped through your recommendations and I've not yet been able to successfully execute the %run command. I will check again and report back! Thanks

aslaleratu
New Contributor II

Thank you for taking the time to respond to my query.

MuthuLakshmi
Databricks Employee
Databricks Employee

The %run command is a specific Jupyter magic command.

The ipykernel used in Databricks examines the initial line of code to determine the appropriate compiler or language for execution.

To minimize the likelihood of encountering errors, it is advisable to position the %run command as the first line in the cell and not have any command in the cell.

Hi,

I'm trying to run a notebook nested in a for loop in another notebook. %run command doesn't work in this case. Now I see the reason. Do you happen to know if there are other ways to run a notebook instead of using %run? Thank you.

BapsDBC
New Contributor III

This is exactly what I encountered. Even a # Comment line was giving me the same error. Removing the comment from that cell worked.

ArturOA
New Contributor III

I have seen this error popping up when you define a Python file without the header:

 
# Databricks notebook source
 
Databricks has a hard time running the file as a nested notebook and you can get some weird errors.
 
 

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group