PyCharm remote jupyter connection: invalid working dir

Answered

Hi,

I have noticed that when running a notebook on a remote jupyter server the working dir is not matching the notebook dir. However when running Jupyter Labs through web interface the dirs are matching.

 

For example, we have a remote jupyter server with preconfigured starting dir as ‘/’. 

 

When I run notebook `/homes/alexander.korolyov/projects/test_remote_jupyter/sample.ipynb` using PyCharm and remote connection to jupyter server:

But when I run the same notebook in jupyter labs through web interface I got the correct working dir

 

Any Ideas how to configure it correctly?

 

Best regards,

Alex

 

0
4 comments

Which PyCharm version are you running? There is no different config that needs to be done. By default, I set the working directory on the remote jupyter server notebook and was able to successfully get the exact same one in PyCharm

Make sure that you're using the latest version and if the issue persists, share the IDE UI logs and a sample project where this is reproduced on https://uploads.jetbrains.com/

Then share it's uploadID

0

Hello Miguel!

 

Thank you for your response. I am running PyCharm 2024.1.3. The main issue is that I cannot change the default folder on remote jupyter server,  it is set to ‘/’ in our case. We are using same jupyter server for multiple projects. I thought that PyCharm works similar to JupyterLabs, which changes the working dir each time, depending on the running notebook path.

0

I'm also seeing the same issue. In my situation, I have a configured remote Jupyter server that I'm connecting to via PyCharm. `os.getcwd()` from this notebook (Tensorflow_introduction.ipynb) should return `'W3A1 - Tensorflow Introduction'`; however, it looks like the root directory is being set as the current working directory. The only workaround I know is to change the working directory with `os.chdir(…)` but I wish the behavior was consistent with how it should be, with the immediate directory being the current working directory of the notebook.

0

Hello!

Could you please provide more information about your setup:

  • The version of PyCharm you're using.
  • A screenshot of the interpreter settings under File | Settings | Project: [workspace] | Python Interpreter, including the full path to the Python binary.
  • The type of server being used: managed or configured.
  • If it is a configured server:
    • Is the server running on the local machine or a remote one?
    • Is the notebook located inside the folder where the server is running? If not, where is it located?

 

 

0

Please sign in to leave a comment.