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

Cannot establish a connection to the visualizer in Julia v1.11 w Pluto nb #258

Closed
RobbesU opened this issue Nov 8, 2024 · 9 comments
Closed

Comments

@RobbesU
Copy link

RobbesU commented Nov 8, 2024

This seems very similar / same as #234, but now in Julia 1.11 and Pluto notebook.
Environment is Windows 11, browser either FireFox or Edge.
Meshcat server appears to start, browser opens a new tab automatically and tries to connect, but then fails to connect.

Using MeshCat
begin
	visualizer = Visualizer()
	open(visualizer)
	setvisible!(visualizer, true)
	wait(visualizer)
end
MeshCat server started. You can open the visualizer by visiting the following URL in your browser:
http://127.0.0.1:8700

Error msg in browser: Firefox can’t establish a connection to the server at 127.0.0.1:8700.
I've double checked the firewall and despite no block notifications I have set up exemptions anyhow, no difference.

@RobbesU
Copy link
Author

RobbesU commented Nov 8, 2024

Ah.. Further to above: Pkg.status() reports

Status `C:\Users\_____\AppData\Local\Temp\jl_Svmmsh\Project.toml`
⌅ [283c5d60] MeshCat v0.14.2
  [44cfe95a] Pkg v1.11.0
Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated`

with Pkg.status(outdated=true) giving

Status `C:\Users\robur\AppData\Local\Temp\jl_Svmmsh\Project.toml`
⌅ [283c5d60] MeshCat v0.14.2 (<v0.16.2) [compat]

So it looks despite being a fresh installl this has still picked up the (old) v0.14.2, whilst #234 was fixed in v0.15 onward.

@RobbesU
Copy link
Author

RobbesU commented Nov 8, 2024

Right... forced a Pkg update to MeshCat v1.0.0 and now working,

@RobbesU RobbesU closed this as completed Nov 8, 2024
@ferrolho
Copy link
Collaborator

ferrolho commented Nov 8, 2024

Hi @RobbesU, I don't have a Windows machine available right now to test this. Can you try updating MeshCat to v1.0.0? Never mind, glad you have solved it! :D

@RobbesU
Copy link
Author

RobbesU commented Nov 8, 2024

FWIW (might help others in future), before I could force MeshCat to 1.0.0 I had to first manually remove Blink, Mux and WebSockets
note: I'm still fairly new to Julia so apologies if this isn't the proper way to do this in Pluto.

# must include the outdated packages that held back MeshCat before can remove
using Pkg, Blink, Mux, WebSockets
# remove them
Pkg.rm(["Blink","Mux","WebSockets"])
# now update MeshCat
Pkg.add(name="MeshCat",version="1.0.0")

@ferrolho
Copy link
Collaborator

ferrolho commented Nov 8, 2024

Maybe what might also be happening is that you are installing all these packages into your default Julia environment instead of to a specific project.

@RobbesU RobbesU reopened this Nov 8, 2024
@RobbesU
Copy link
Author

RobbesU commented Nov 8, 2024

@ferrolho true and i'll have to move to project, but ... It also turns out that it is MeshCatMechanisms v0.9.0 keeps forcing MeshCat back to v0.16.0 from v1.0.0.
So whilst I can run the MeshCat only MWE, it doesn't work for anything more useful as that requires MeshCatMechanism.
Any thoughts?

(@v1.11) pkg> status
Status `C:\Users\robur\.julia\environments\v1.11\Project.toml`
  [283c5d60] MeshCat v1.0.0
  [4722fa14] PkgAuthentication v2.0.3
  [c3e4b0f8] Pluto v0.20.3

(@v1.11) pkg> add MeshCatMechanisms
   Resolving package versions...
    Updating `C:\Users\robur\.julia\environments\v1.11\Project.toml`
⌅ [283c5d60] ↓ MeshCat v1.0.0 ⇒ v0.16.2                                 #<<<<<<<<<<<<<<<<<<<<<<<<
  [6ad125db] + MeshCatMechanisms v0.9.0
    Updating `C:\Users\robur\.julia\environments\v1.11\Manifest.toml`

@RobbesU
Copy link
Author

RobbesU commented Nov 8, 2024

I'm fairly new to Julia & Pluto, so I might not be doing this correct, but as I understand it from Pluto docs below installs the packages specifically in project environment by using a Pluto Pkg cell

begin
    import Pkg
    # activate a temporary environment
    Pkg.activate(mktempdir())
    Pkg.add([
        Pkg.PackageSpec(name="MeshCatMechanisms", version="0.9.0"),
        Pkg.PackageSpec(name="MeshCat", version="1.0.0"),
    ])
	Pkg.add("MeshCatMechanisms")
    using MeshCatMechanisms, MeshCat
end

Results in error

Unsatisfiable requirements detected for package MeshCatMechanisms [6ad125db]:

 MeshCatMechanisms [6ad125db] log:

 ├─possible versions are: 0.0.1 - 0.9.0 or uninstalled

 ├─restricted to versions 0.9.0 by an explicit requirement, leaving only versions: 0.9.0

 └─restricted by compatibility requirements with MeshCat [283c5d60] to versions: uninstalled — no versions left

   └─MeshCat [283c5d60] log:

     ├─possible versions are: 0.1.0 - 1.0.0 or uninstalled

     └─restricted to versions 1.0.0 by an explicit requirement, leaving only versions: 1.0.0

Instead, first installing MeshCat v1.0.0, then MeshCatMechanisms results in downgrade of MeshCat to v0.16.2

begin
    import Pkg
    # activate a temporary environment
    Pkg.activate(mktempdir())
    Pkg.add([
# COMMENT OUT    #Pkg.PackageSpec(name="MeshCatMechanisms", version="0.9.0"),    
        Pkg.PackageSpec(name="MeshCat", version="1.0.0"),
    ])
	Pkg.add("MeshCatMechanisms")
    using MeshCatMechanisms, MeshCat
end

Results in

 Activating new project at `C:\Users\robur\AppData\Local\Temp\jl_Pk2ExH`
   Resolving package versions...
    Updating `C:\Users\robur\AppData\Local\Temp\jl_Pk2ExH\Project.toml`
  [283c5d60] + MeshCat v1.0.0
    Updating `C:\Users\robur\AppData\Local\Temp\jl_Pk2ExH\Manifest.toml`
  [d1d4a3ce] + BitFlags v0.1.9
  [944b1d66] + CodecZlib v0.7.6
    .......
  [3f19e933] + p7zip_jll v17.4.0+2
        Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`
   Resolving package versions...
    Updating `C:\Users\robur\AppData\Local\Temp\jl_Pk2ExH\Project.toml`
⌅ [283c5d60] ↓ MeshCat v1.0.0 ⇒ v0.16.2
  [6ad125db] + MeshCatMechanisms v0.9.0
    Updating `C:\Users\robur\AppData\Local\Temp\jl_Pk2ExH\Manifest.toml`
⌅ [79e6a3ab] + Adapt v3.7.2
   ......

@ferrolho
Copy link
Collaborator

ferrolho commented Nov 8, 2024

It also turns out that it is MeshCatMechanisms v0.9.0 keeps forcing MeshCat back to v0.16.0 from v1.0.0.

That's right. It's because v0.9.0 of MeshCatMechanisms.jl is not compatible with the latest version of MeshCat.jl v1.0. I have an open PR for MeshCatMechanisms.jl v0.9.1 (here) which will fix this compatibility issue.

In the meantime, you can work around this problem by installing v0.9.1 of my fork of MeshCatMechanisms.jl on the Julia REPL with

] add https://github.com/ferrolho/MeshCatMechanisms.jl.git#hf/upstream-changes

or via a Pluto/Jupyter notebook cell with

Pkg.add(url="https://github.com/ferrolho/MeshCatMechanisms.jl", rev="hf/upstream-changes")

@RobbesU
Copy link
Author

RobbesU commented Nov 9, 2024

Thanks!

@RobbesU RobbesU closed this as completed Nov 9, 2024
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