0

Same question as this. But the answer not working for me.

In jupyterlab, I want to open a file from below location

/home/user1/.conda/envs/default/lib/python3.9/site-packages/mypackage/file1.py

!which jupyter shows this location

/home/user1/.conda/envs/default/bin/jupyter

and os.getcwd() gives below location

/home/user1/myprojects

So I tried to use the relative path like this

/../lib/python3.9/site-packages/mypackage/file1.py
../lib/python3.9/site-packages/mypackage/file1.py
~/../lib/python3.9/site-packages/mypackage/file1.py
~/../../lib/python3.9/site-packages/mypackage/file1.py
.conda/envs/default/lib/python3.9/site-packages/mypackage/file1.py
../.conda/envs/default/lib/python3.9/site-packages/mypackage/file1.py
/../.conda/envs/default/lib/python3.9/site-packages/mypackage/file1.py

etc.. but none seems working. How to open the file?

sjd
  • 1,329
  • 4
  • 28
  • 48
  • You can’t open a hidden folder in the jupyter file browser. If you want to work with that file in jupyter I would copy it to a local directory and uninstall it to make sure you don’t get conflicts with the version you’re editing. You can install a module from source while editing the source code with `pip install -e my/local/module` – Michael Delgado Apr 20 '22 at 14:26
  • but why is it hidden. I am able to browse to the file from terminal – sjd Apr 20 '22 at 14:41
  • Any folder starting with a period (e.g. `.conda` is a hidden system file in posix systems. You can browse them with terminal but usually not graphical file browsers. Also, you can’t use the file browser in jypyter to open files outside the working directory. – Michael Delgado Apr 20 '22 at 14:44
  • Also your “same question as this” link in your question is broken. Can you point to a real question rather than a file on your home directory? – Michael Delgado Apr 20 '22 at 14:46
  • oh ok. got it. I have fixed the duplicate link. thanks. `https://github.com/jupyterlab/jupyterlab/issues/2532` another discussion. – sjd Apr 20 '22 at 14:58
  • That’s a code block ;) reposting so the cross reference gets picked up https://github.com/jupyterlab/jupyterlab/issues/2532 – Michael Delgado Apr 20 '22 at 15:05

1 Answers1

0

Atleast in my case I was able to open the file using one of the same path listed in the question itself. I missed it because of an error popping up along with the file

.conda/envs/default/lib/python3.9/site-packages/mypackage/file1.py

sjd
  • 1,329
  • 4
  • 28
  • 48