Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to find Base.active_repl_backend.ast_transforms in jupyter notebooks #9

Open
lgoettgens opened this issue Oct 18, 2024 · 5 comments

Comments

@lgoettgens
Copy link

lgoettgens commented Oct 18, 2024

With the exact startup file as the example in the README.md, I get the following output every time I execute the first cell (after kernel restart) in a jupyter notebook.

�[33m�[1m┌ �[22m�[39m�[33m�[1mWarning: �[22m�[39mFailed to find Base.active_repl_backend.ast_transforms
�[33m�[1m└ �[22m�[39m�[90m@ BasicAutoloads ~/.julia/packages/BasicAutoloads/WpUQa/src/BasicAutoloads.jl:108�[39m

or without formatting:

┌ Warning: Failed to find Base.active_repl_backend.ast_transforms
└ @ BasicAutoloads ~/.julia/packages/BasicAutoloads/WpUQa/src/BasicAutoloads.jl:108

This happens both on a julia 1.10.5 and a julia 1.11.1 kernel.

To skip loading of BasicAutoloads for jupyter notebooks, I changed the first line of my startup file to

if Base.isinteractive() && !isdefined(Main, :IJulia)

but this does not change anything about the above issue.

Do you have an idea how to make BasicAutoloads either work with jupyter notebooks or skip loading it at all?

@LilithHafner
Copy link
Owner

LilithHafner commented Oct 19, 2024

I have been unable to launch a jupyter notebook successfully and cannot reproduce this with Pluto.

I'll continue investigating.

@LilithHafner
Copy link
Owner

I've now successfully launched a jupyter notebook with the startup file from the README here. I still can't reproduce this warning. Would you provide more detailed reproduction instructions? e.g. how are IJulia/jupyter installed? How are you launching the notebook?

@lgoettgens
Copy link
Author

I tried to do everything again as a few days ago, but write them down step by step, and suddenly the error vanished. Then I went back to work and have it again.

Steps to reproduce:

  • Install julia 1.10.5 via juliaup on linux.
  • Put the startup.jl from the README in you .julia/config/ folder.
  • Install IJulia using Pkg.add("IJulia") to the global environment. This for me installed v1.25.0.
  • Build a jupyter kernel using Pkg.build("IJulia")
  • Start a jupyter server using using IJulia; notebook().
  • Via the jupyter web GUI, reate a new notebook in some random folder (that does not contain a Project.toml nor a Manifest.toml).
  • Write sleep(3) in the first code cell and execute it. (In my case, I load some package that needs 10+ seconds to load, but this is a pure julia mwe. But for me it is using Oscar.)
  • Using the jupyter web GUI, press Kernel > Restart Kernel and Run All Cells...
  • The warning appears

@LilithHafner
Copy link
Owner

I followed those steps and successfully reproduced the warning. Thanks!

@LilithHafner
Copy link
Owner

IJulia sets is_interactive at

https://github.com/JuliaLang/IJulia.jl/blob/0db1fa2c6b3f04d43a18830c631a1e46851908b6/src/kernel.jl#L44

even through there is no REPL. Consequently the startup file thinks that there is a REPL and launches BasicAutoloads which fails to hook into the REPL because there is not REPL. BasicAutoloads prints a warning because register_autoloads was called and did not successfully register any autoloads. Switching isinteractive() to stdin isa Base.TTY in your startup.jl should remove this warning.

Another, much harder, fix would be to create a package extension for BasicAutoloads & IJulia.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants