Open ihgumilar opened 8 months ago
Hi @ihgumilar , have you installed the Python package? I mean, pip install jupytext<1.16
?
Also
jupyterlab-jupytext@1.3.9
), it's already in the pip packagecontents_manager_class
)Hi @mwouts thanks for the reply. Yes, I installed the package in docker with jupytext 1.15.2
For the last two points, when I excluded them. It still shows the same problem. In fact, I tried to add both of them a bit later after encountering such issue.
Any help ?
I have the same problem, I cannot open jl
files as Julia Jupytext Notebooks (even if I used jupytext to convert them in a jl
file from a ipynb
file). It does not work in Jupyter Notebook or Labs. Pairing a ipynb
to a percent format and saving the ipynb
also does not generate the percent format file. I am using jupytext-1.16.2.
Hi @henriquebecker91 , the problem that you describe is consistent with no having the Jupytext contents manager.
In most cases it's not necessary to install manually the npm extension (the one called jupyterlab-jupytext
) since it's provided by the pip package. Installing it manually provides the Jupytext menu and leads you to think that Jupytext is installed, but it's only the menu and hence you don't get the pairing functionality.
You don't need to tweak the configuration file neither.
But you do need to install Jupytext's pip or conda package before launching the Jupyter server.
One way to check that Jupytext's contents manager is installed is to check the icon for .py
or .md
documents. If you get a notebook icon then the contents manager is active, otherwise it's not.
It might help too to see the logs of the Jupyter server too.
I have jupyter
installed by means of the package IJulia
of the Julia language. It provides jupyter
by means of the Conda.jl
package which creates a conda repository just for Julia separate from the rest of the system. I have installed jupytext
using this conda
installation. I will try to get the Jupyter server logs.
The full output if I run Jupyter directly.
pandoc: error while loading shared libraries: libHSfast-logger-3.1.2-FNZAUVo6d0d4dB71mp2JZD-ghc9.2.8.so: cannot open shared object file: No such file or directory
[I 2024-06-27 19:44:12.225 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2024-06-27 19:44:12.228 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I 2024-06-27 19:44:12.231 ServerApp] jupyterlab | extension was successfully linked.
[I 2024-06-27 19:44:12.231 ServerApp] jupyterlab_jupytext | extension was successfully linked.
[I 2024-06-27 19:44:12.231 ServerApp] jupytext | extension was successfully linked.
[I 2024-06-27 19:44:12.234 ServerApp] notebook | extension was successfully linked.
[I 2024-06-27 19:44:12.386 ServerApp] notebook_shim | extension was successfully linked.
[I 2024-06-27 19:44:12.398 ServerApp] notebook_shim | extension was successfully loaded.
[I 2024-06-27 19:44:12.399 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2024-06-27 19:44:12.400 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2024-06-27 19:44:12.401 LabApp] JupyterLab extension loaded from /home/henrique/.julia/conda/3/x86_64/lib/python3.10/site-packages/jupyterlab
[I 2024-06-27 19:44:12.401 LabApp] JupyterLab application directory is /home/henrique/.julia/conda/3/x86_64/share/jupyter/lab
[I 2024-06-27 19:44:12.401 LabApp] Extension Manager is 'pypi'.
[I 2024-06-27 19:44:12.412 ServerApp] jupyterlab | extension was successfully loaded.
[W 2024-06-27 19:44:12.412 ServerApp] [Jupytext Server Extension] Async contents managers like AsyncLargeFileManager are not supported at the moment (https://github.com/mwouts/jupytext/issues/1020). We will derive a contents manager from LargeFileManager instead.
[I 2024-06-27 19:44:12.412 ServerApp] [Jupytext Server Extension] Deriving a JupytextContentsManager from LargeFileManager
[W 2024-06-27 19:44:12.412 ServerApp] jupyterlab_jupytext | extension failed loading with message: NameError("name 'build_jupytext_contents_manager_class' is not defined")
Traceback (most recent call last):
File "/home/henrique/.julia/conda/3/x86_64/lib/python3.10/site-packages/jupyter_server/extension/manager.py", line 360, in load_extension
extension.load_all_points(self.serverapp)
File "/home/henrique/.julia/conda/3/x86_64/lib/python3.10/site-packages/jupyter_server/extension/manager.py", line 232, in load_all_points
return [self.load_point(point_name, serverapp) for point_name in self.extension_points]
File "/home/henrique/.julia/conda/3/x86_64/lib/python3.10/site-packages/jupyter_server/extension/manager.py", line 232, in <listcomp>
return [self.load_point(point_name, serverapp) for point_name in self.extension_points]
File "/home/henrique/.julia/conda/3/x86_64/lib/python3.10/site-packages/jupyter_server/extension/manager.py", line 223, in load_point
return point.load(serverapp)
File "/home/henrique/.julia/conda/3/x86_64/lib/python3.10/site-packages/jupyter_server/extension/manager.py", line 151, in load
return loader(serverapp)
File "/home/henrique/.julia/conda/3/x86_64/lib/python3.10/site-packages/jupyterlab_jupytext/__init__.py", line 44, in load_jupyter_server_extension
app.contents_manager_class = build_jupytext_contents_manager_class(base_class)
NameError: name 'build_jupytext_contents_manager_class' is not defined. Did you mean: 'build_jupytext_contents_manager'?
[I 2024-06-27 19:44:12.413 ServerApp] [Jupytext Server Extension] Deriving a JupytextContentsManager from AsyncLargeFileManager
[W 2024-06-27 19:44:12.413 ServerApp] jupytext | extension failed loading with message: NameError("name 'build_jupytext_contents_manager_class' is not defined")
Traceback (most recent call last):
File "/home/henrique/.julia/conda/3/x86_64/lib/python3.10/site-packages/jupyter_server/extension/manager.py", line 360, in load_extension
extension.load_all_points(self.serverapp)
File "/home/henrique/.julia/conda/3/x86_64/lib/python3.10/site-packages/jupyter_server/extension/manager.py", line 232, in load_all_points
return [self.load_point(point_name, serverapp) for point_name in self.extension_points]
File "/home/henrique/.julia/conda/3/x86_64/lib/python3.10/site-packages/jupyter_server/extension/manager.py", line 232, in <listcomp>
return [self.load_point(point_name, serverapp) for point_name in self.extension_points]
File "/home/henrique/.julia/conda/3/x86_64/lib/python3.10/site-packages/jupyter_server/extension/manager.py", line 223, in load_point
return point.load(serverapp)
File "/home/henrique/.julia/conda/3/x86_64/lib/python3.10/site-packages/jupyter_server/extension/manager.py", line 151, in load
return loader(serverapp)
File "/home/henrique/.local/lib/python3.10/site-packages/jupytext/__init__.py", line 40, in load_jupyter_server_extension
app.contents_manager_class = build_jupytext_contents_manager_class(
NameError: name 'build_jupytext_contents_manager_class' is not defined. Did you mean: 'build_jupytext_contents_manager'?
[I 2024-06-27 19:44:12.416 ServerApp] notebook | extension was successfully loaded.
[I 2024-06-27 19:44:12.416 ServerApp] Serving notebooks from local directory: /home/henrique/backup_Academia_2024-03-18/colaboracoes/AllReposCollabBeckerLucenaResende2023/BeckerLucenaResende2023/notebooks/old_notebook
[I 2024-06-27 19:44:12.416 ServerApp] Jupyter Server 2.14.1 is running at:
[I 2024-06-27 19:44:12.416 ServerApp] http://localhost:8888/lab?token=7c47ae24564ab0a2daee003e08a66286af931ee01d747b01
[I 2024-06-27 19:44:12.416 ServerApp] http://127.0.0.1:8888/lab?token=7c47ae24564ab0a2daee003e08a66286af931ee01d747b01
[I 2024-06-27 19:44:12.417 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2024-06-27 19:44:12.447 ServerApp]
To access the server, open this file in a browser:
file:///home/henrique/.local/share/jupyter/runtime/jpserver-58566-open.html
Or copy and paste one of these URLs:
http://localhost:8888/lab?token=7c47ae24564ab0a2daee003e08a66286af931ee01d747b01
http://127.0.0.1:8888/lab?token=7c47ae24564ab0a2daee003e08a66286af931ee01d747b01
[I 2024-06-27 19:44:12.801 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, python-lsp-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server
^C[I 2024-06-27 19:44:14.694 ServerApp] interrupted
[I 2024-06-27 19:44:14.694 ServerApp] Serving notebooks from local directory: /home/henrique/backup_Academia_2024-03-18/colaboracoes/AllReposCollabBeckerLucenaResende2023/BeckerLucenaResende2023/notebooks/old_notebook
0 active kernels
Jupyter Server 2.14.1 is running at:
http://localhost:8888/lab?token=7c47ae24564ab0a2daee003e08a66286af931ee01d747b01
http://127.0.0.1:8888/lab?token=7c47ae24564ab0a2daee003e08a66286af931ee01d747b01
Shut down this Jupyter server (y/[n])? [I 2024-06-27 19:44:15.389 LabApp] Build is up to date
y
[C 2024-06-27 19:44:15.725 ServerApp] Shutdown confirmed
[I 2024-06-27 19:44:15.726 ServerApp] Shutting down 7 extensions
I did a very thorough post of my problem in https://discourse.julialang.org/t/jupyter-and-jupytext-through-ijulia-jl-jupytext-does-not-really-work/116330
Hi @henriquebecker91 , thank you for the logs, that's very helpful. I see that there is a typo in the try/except of the import - I'll fix that, but the import should not fail in the first place.
Could you provide some instructions on how to install IJulia locally? And then share the details of how you are installing Jupytext? Thanks!
Sure! Thank your for looking into that.
I downloaded the last stable version of Julia (1.10.4) from here: https://julialang.org/downloads/
After installing (i.e., unzipping and putting the path to julia-1.10.4/bin/
folder in my PATH
environment variable), you can create a folder for the Julia project (just we do not install things globally) and inside this folder execute:
julia --project=. -e 'using Pkg: Pkg; Pkg.add("IJulia");'
This should give you a prompt asking if you want to install Jupyter by means a conda installation internal to Julia and only used by Julia, I said yes to that.
Then I installed jupytext
using the Julia package that wraps the inner conda installation:
julia --project=. -e 'using Conda: Conda; Conda.add("jupytext");'
We can run Jupyter Lab by means of julia --project=. -e 'using IJulia: IJulia; IJulia.jupyterlab(; dir = pwd())'
(this will use the current folder as root for jupyter). However, this does not give a debug output for Jupyter (only print a bunch of env variables set when calling jupyter-lab). I have run /home/henrique/.julia/conda/3/x86_64/bin/jupyter-lab
to get the error messages.
Hi @henriquebecker91 , thanks for the detailed instructions! I did it a quick try, and I realize that it did not went exactly as the above.
julia --project=. -e 'using Pkg: Pkg; Pkg.add("IJulia");'
That worked
This should give you a prompt asking if you want to install Jupyter by means a conda installation internal to Julia and only used by Julia, I said yes to that.
That did not happen on my end
julia --project=. -e 'using Conda: Conda; Conda.add("jupytext");'
I got that error:
ERROR: ArgumentError: Package Conda not found in current path.
- Run `import Pkg; Pkg.add("Conda")` to install the Conda package.
So I installed conda as instructed, and then installed Jupytext
conda activate /home/marc/.julia/conda/3/x86_64
That worked, but Jupyter Lab was not installed, so I ran julia --project=. -e 'using Conda: Conda; Conda.add("jupyterlab");'
After that I was able to launch jupyter lab
and I could create a paired Julia notebook.
julia --project=. -e 'using IJulia: IJulia; IJulia.jupyterlab(; dir = pwd())'
That also seemed to work on my end
So I guess the difference between my environment and yours is how Jupyter was installed. Possibly there are additional packages on your end. Maybe we can compare our conda list
?
conda list
I executed a diff, and our lists are exactly equal except by the header (because of the home folder name).
So I installed conda as instructed, and then installed Jupytext
conda activate /home/marc/.julia/conda/3/x86_64
I repeated the steps without the above and have the same problem. The step above should not be necessary, as julia manages conda
to use the right environment. In my case, I cannot even do it, because I do not have a conda
installation outside Julia (I do not have the Arch Linux conda package installed, as there is no official package for conda). I will try to install the unofficial package for miniconda (that seems up to date) and try to install jupyter and jupytext using an external miniconda to activate the conda installation internal to julia.
I posted my step-by-step to be able to make jupytext
work with jupyter
in Arch Linux with Julia/IJulia here: https://discourse.julialang.org/t/jupyter-and-jupytext-through-ijulia-jl-jupytext-does-not-really-work/116330/4?u=henrique_becker
It seems like trying to use the jupyter
installation provided by julia
/IJulia
by means of their internal miniconda
installation is a trap.
Hi Team,
I have installed already jupytext, but when I try to open *.py file with jupyter notebook, it throws me an error ( I am using jupyterlab 4 :
I have installed it in sagemaker studio and also put this code in life cycle configuration as suggested by this forum, but I changed it slightly
Note, even though, I remove the configuration file, it still gives me the above error.
I would really appreciate for your help. Thanks a lot for your help :)