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:ย 

# Databricks notebook source throws FileNotFoundError: [Errno 2] No such file with PyCharm plugin

aleknandrius
New Contributor

I started using Databricks plugin in Pycharm.
If I have first line in my code:

# Databricks notebook source
...

Running such a notebook with a plugin on cluster fails with the message:

FileNotFoundError: [Errno 2] No such file or directory: '/Workspace/Users/<user>/.ide/databricks-Python-e6507fa0/project_name/deployment/model_deployment/notebooks/Test.py'

I checked the directory, the file exists.
Removing:

# Databricks notebook source

Test.py runs as expected.
Any help would be appreciated.

1 REPLY 1

Brahmareddy
Valued Contributor II

Hi @aleknandrius,

How are you doing today?

As per my understanding, It seems that the # Databricks notebook source line is causing confusion when running your PyCharm code on Databricks. This line is usually added to identify notebook cells, but in a Python file, it might be misinterpreted by the environment. Consider removing the # Databricks notebook source line when running Python scripts through PyCharm on a cluster, as itโ€™s only necessary when running inside a Databricks notebook. Another option is to ensure that the file is treated purely as a script rather than a notebook when running it in this environment. You might also want to double-check the Databricks plugin configuration in PyCharm to ensure it is set up correctly for running standalone Python scripts.

Please give  a try and let me know for any queries.

Regards,

Brahma

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