Error when connecting to Pluto on localhost

Hello all,

I recently started using Julia and Pluto notebook, everything went well until I had to restart my MacBook Pro, and since then I’ve been unable to connect to Pluto on local host. When I run call Pluto.run(), it attempts to open http://localhost:1234/ but fails to and Pluto gives me this:

WARNING: both IOExtras and Base export "closewrite"; uses of it in module WebSockets must be qualified
WARNING: both IOExtras and Base export "closewrite"; uses of it in module HTTP must be qualified
WARNING: both IOExtras and Base export "closewrite"; uses of it in module Servers must be qualified
┌ Error: error handling request
│   exception =
│    UndefVarError: closewrite not defined
│    Stacktrace:
│     [1] (::Pluto.var"#233#243"{Pluto.ServerSession, Base.RefValue{Function}, HTTP.Handlers.Router{Symbol("##312")}})(http::HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}})
│       @ Pluto ~/.julia/packages/Pluto/D9HrI/src/webserver/WebServer.jl:235
│     [2] handle
│       @ ~/.julia/packages/HTTP/RwjlP/src/Handlers.jl:270 [inlined]
│     [3] #4
│       @ ~/.julia/packages/HTTP/RwjlP/src/Handlers.jl:346 [inlined]
│     [4] macro expansion
│       @ ~/.julia/packages/HTTP/RwjlP/src/Servers.jl:399 [inlined]
│     [5] (::HTTP.Servers.var"#13#14"{HTTP.Handlers.var"#4#5"{HTTP.Handlers.StreamHandlerFunction{Pluto.var"#233#243"{Pluto.ServerSession, Base.RefValue{Function}, HTTP.Handlers.Router{Symbol("##312")}}}}, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}, HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}})()
│       @ HTTP.Servers ./task.jl:484
└ @ HTTP.Servers ~/.julia/packages/HTTP/RwjlP/src/Servers.jl:405

I’ve tried updating Pluto, updating Julia using Jill, deleting Julia and reinstalling, none of which have worked thus far. I’m at a loss as to what could be wrong, and searching for this problem hasn’t yielded anything relevant (the closest I got was a thread about http access from within Pluto).

Any help would be greatly appreciated!

Fixed the issue following this thread:

Are you by any chance stuck on an old version of Pluto? I am having the same error as you are, and it seems to be due to the fact that I can’t install or update Pluto past version 0.14.7. The current version is 0.19.8. I have added and removed it several times, but it will not install any newer versions.

For me, it was because I had Neptune installed and it was restricting HTTP to an old package. You can try following along this thread https://github.com/fonsp/Pluto.jl/issues/788 to see if it is also because of a package restriction. I haven’t used Pluto in a while, and don’t remember any of the commands to view versions or package restrictions, sorry. Best of luck.

As ever, do ] add Pluto@0.19 to force an update to a specific version, which will tell you what other package is holding you back.

Most of the time this happens for users who install all their packages in the default environment, which almost guarantees version conflicts down the line. It is recommended to only install “dev dependencies” (eg Pluto, revise, BenchmarkTools) in the default environment and work with project specific environments otherwise. Pluto of course does this by default with its built in package manager.

It wound up being the Mux package, which gave an error when I tried to remove it. I wound up deleting my ~/.julia to start over.

Glad if it worked out for you, but in general it’s not advisable to just delete .julia, as it also holds dev’ed packages so you might bin your own work. There’s generally a less nuclear option.