cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Import from repo

Kibour
New Contributor III

Hi all,

I am trying the new "git folder" feature, with a repo that works fine from the "Repos". In the new folder location, my imports from my own repo don't work anymore. Anyone faced something similar?

Thanks in advance for sharing your experience

1 ACCEPTED SOLUTION

Accepted Solutions

Kaniz
Community Manager
Community Manager

Hi @Kibour

  • Ensure that the Databricks Repos feature is enabled. Sometimes, this issue arises when Repos are not properly activated.
  • Additionally, verify that Repos are allowed for DBR 8.4+ versions.
  • Confirm that your folder structure adheres to the correct path style (e.g., folder.subfolder.file).
  • Double-check that youโ€™re using the full folder path when importing modules.
  • Make sure the files youโ€™re trying to import are not notebook files but actual Python .py files.
  • Experiment with importing modules using sys.path. Ensure that the path to your repo is correctly added to sys.path.
  • If youโ€™re importing within the same repo, try locating the module using relative paths.
  • Verify that your cluster version is DBR 9.1.
  • Confirm that you can use Git features and view/edit .py files successfully.

View solution in original post

2 REPLIES 2

Kaniz
Community Manager
Community Manager

Hi @Kibour

  • Ensure that the Databricks Repos feature is enabled. Sometimes, this issue arises when Repos are not properly activated.
  • Additionally, verify that Repos are allowed for DBR 8.4+ versions.
  • Confirm that your folder structure adheres to the correct path style (e.g., folder.subfolder.file).
  • Double-check that youโ€™re using the full folder path when importing modules.
  • Make sure the files youโ€™re trying to import are not notebook files but actual Python .py files.
  • Experiment with importing modules using sys.path. Ensure that the path to your repo is correctly added to sys.path.
  • If youโ€™re importing within the same repo, try locating the module using relative paths.
  • Verify that your cluster version is DBR 9.1.
  • Confirm that you can use Git features and view/edit .py files successfully.

Kibour
New Contributor III

Hi @Kaniz ,

Thanks for all the suggested options.

I tried again with a brand new git folder. I just changed cluster from DBR 14.2 ML to 14.3 ML, and now the imports work as expected.

Kind regards

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.