Forum Discussion
Notebook Resources | Spark not recognized in local machine | File not recognized in local machine
Serogio
hey..sorry for replying a little bit late.
again, really appriecate the feedback of the Synapse VS Code experience and I am more than happy to run into a call to discuss further, feel free to reach out to me via: [email protected].
for the "spark" variable issue, there is the quick workaround that might help to address the warning.
The pre-run code I mentiond actually stay in the local desktop, too. It is sub-folder under your Home directory as: .ipython/profile_default/startup/init_lighter.py.
so in your own .py file, you can import that "init_lighter.py" module.
import sys
import os
home_directory = os.path.expanduser("~")
directory_to_append = os.path.join(home_directory, ".ipython/profile_default/startup/")
sys.path.append(directory_to_append)
from init_lighter import spark
print("Spark version: " + spark.version)
now within you own .py file, you can call the method from the "Spark" variable without any warning from Python interperter.
for the second issue, one thing need to call out in current release, ONLY the spark code will be posted/synced to the remote workspace for the execution, the pure python code would be still execute locally in your desktop, that explain why the you will need a local folder path macth to the lakehosue log.
qixiao
Hi QixiaoWang !
Just wanted to give you (and other users) an update about this issue.
I was able to surpass the 'Import "init_lighter" could not be resolved' error, that I have described previously, by adding the module path to my user settings.json from VS Code (for a reference on how I did it, please check this link ).
However, even when importing this module, the spark object is not recognized and, therefore, I still have an error in the end.
At this point I think it is simpler, if one just initialize (and terminate) the spark session within the notebook when working in local folder unless, of course, you have some other solution?
Thank you.