# Windows 11 WSL2 floating View Widgets bug

**URL:** <https://discourse.slicer.org/t/windows-11-wsl2-floating-view-widgets-bug/29608>\
**Category:** Development\
**Tags:** bug, wsl\
**Created:** [May 23, 2023, 2:17pm UTC](https://discourse.slicer.org/t/windows-11-wsl2-floating-view-widgets-bug/29608 "2023-05-23T14:17:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thibault\_Pelletier](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/thibault_pelletier/32/4767_2.png) [@Thibault\_Pelletier](https://discourse.slicer.org/u/Thibault_Pelletier)\
**Post date:** [May 23, 2023, 2:17pm UTC](https://discourse.slicer.org/t/windows-11-wsl2-floating-view-widgets-bug/29608/1 "2023-05-23T14:17:01Z")

</div>

Hi everyone,

I recently wanted to test an extension build on Linux and used Windows 11 WSL2 for this with a Slicer build from scratch on the main branch.

Everything builds smoothly (which is really great) and GUI support accross WSL 2 worked out of the box (I may have set-up something at some point but I’m not entirely sure).

While testing in this environment, I noticed the following behavior for the Slice views floating menus :

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/4/c4641609b0d5a07525b489bdfb07c8a5eef97f42.png)

The position of the floating menus is not correctly anchored and it’s impossible to click on the different options.

I have seen this behavior only for the view menus (2D and 3D widget) and not for the “standard” QMenu options.

This problem is not really blocking or anything and it’s not the expected way to run 3D Slicer but I wanted to know if others have seen / fixed this behavior.

Best,  
Thibault

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [May 23, 2023, 7:27pm UTC](https://discourse.slicer.org/t/windows-11-wsl2-floating-view-widgets-bug/29608/2 "2023-05-23T19:27:12Z")

</div>

I’ve tried this and it seems that popups generally appear at the correct location. I’ve found that only the Welcome window, slice view controller (and maybe the volume rendering preset selector) is not at the right place.

There are a lot of mappings between local widget and global coordinates when positioning the [slice view controller popup base class](https://github.com/commontk/CTK/blob/master/Libs/Widgets/ctkBasePopupWidget.cpp), probably some of those calls don’t work correctly in WSLg. It would be nice if you could debug what goes wrong. You can access all widgets and their methods in Python, so you could investigate this without configuring a C++ debugger.

---

<div class="post-metadata">

**Author:** ![Thibault\_Pelletier](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/thibault_pelletier/32/4767_2.png) [@Thibault\_Pelletier](https://discourse.slicer.org/u/Thibault_Pelletier)\
**Post date:** [May 24, 2023, 5:20am UTC](https://discourse.slicer.org/t/windows-11-wsl2-floating-view-widgets-bug/29608/3 "2023-05-24T05:20:41Z")

</div>

Hi Andras,

Thanks for the feedback and the link.  
I will have a look and see if I can find where the problem comes from!

Best,  
Thibault

---

<div class="post-metadata">

**Author:** ![Amos\_Gutman](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/amos_gutman/32/77152_2.png) [@Amos\_Gutman](https://discourse.slicer.org/u/Amos_Gutman)\
**Post date:** [July 1, 2024, 8:24am UTC](https://discourse.slicer.org/t/windows-11-wsl2-floating-view-widgets-bug/29608/4 "2024-07-01T08:24:51Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/e/ae25b1645e20e4d040494f9cdb09f70e05e95ff8.png)  
happens with intelij as well

the popup window should appear on where the square and it is not ancored to the right place

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 26, 2024, 4:21am UTC](https://discourse.slicer.org/t/windows-11-wsl2-floating-view-widgets-bug/29608/5 "2024-07-26T04:21:25Z")

</div>

Thanks for the information. It indicates that the root cause of thr issue is that WSL2 works incorrectly, or at least differently than a linux desktop. The problem will likely to be fixed in WSL2, but probably some workaround could be inplemented in Slicer as well.

However, it is hard to justify spending time with investigating this, when Slicer runs natively on Windows, including all AI tools, with GPU acceleration, etc. What is the motivation for running Slicer on Windows via WSL2?

---

<div class="post-metadata">

**Author:** ![Thibault\_Pelletier](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/thibault_pelletier/32/4767_2.png) [@Thibault\_Pelletier](https://discourse.slicer.org/u/Thibault_Pelletier)\
**Post date:** [July 26, 2024, 5:43am UTC](https://discourse.slicer.org/t/windows-11-wsl2-floating-view-widgets-bug/29608/6 "2024-07-26T05:43:20Z")

</div>

Thank you @Amos_Gutman for the information and @lassoan for the analysis!

On my end, the main reason for using 3D Slicer in WSL2 was for two things :

- Testing / evaluating extensions which may not be available on Windows. That was the case for one of the modules from the AMASS extension for mesh segmentation which relied on pytorch 3D which was not available on Windows then (not sure if it has changed since).
- Dev purposes to make sure extensions developed on Windows also work as expected on Linux (for this I could also use a dual boot / VM)

So the only use case which would be relevant would be the first one but I don’t think this would justify the time investment.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 26, 2024, 6:08am UTC](https://discourse.slicer.org/t/windows-11-wsl2-floating-view-widgets-bug/29608/7 "2024-07-26T06:08:30Z")

</div>

Thanks for the information. Quick testing on Linux is a good use case, as it is simpler than setting up dual-boot or GPU-accelerated virtual machine on Windows. For quick testing, the popups appearing at incorrect location/not working is probably tolerable as there are workarounds (the same features are available in docking widgets, which work well).

Fornl future reference, related issue in the issue tracker:

> <https://github.com/Slicer/Slicer/issues/7864>
>
> Some users would like to run Slicer in WSL2, but there are a couple of issues th…at would be nice to fix.
> 
> \# How to run Slicer on WSL2
> 
> \## Setup
> 
> \- Start PowerShell as Administrator
> 
> Run command:
> 
> \`\`\`
> wsl --install
> \`\`\`
> 
> Start wsl:
> 
> \`\`\`
> wsl
> \`\`\`
> 
> \- Create user, password.
> \- Get information on what linux distribution is installed:
> 
> \`\`\`
> cat /etc/os-release
> \`\`\`
> 
> \- Get prerequisites from here: https://slicer.readthedocs.io/en/latest/user\_guide/getting\_started.html#linux
> 
> For example, for ubuntu 22.04:
> 
> \`\`\`
> sudo apt-get install libglu1-mesa libpulse-mainloop-glib0 libnss3 libasound2 qt5dxcb-plugin libsm6
> \`\`\`
> 
> \- Install Slicer: get the download link from https://download.slicer.org, then download and unpack:
> 
> \`\`\`
> cd /tmp
> wget https://download.slicer.org/bitstream/669c9155e53aec320c786090 -O Slicer.tar.gz
> tar -xvzf Slicer.tar.gz
> \`\`\`
> 
> \## Start Slicer
> 
> \- Start wsl:
> 
> \`\`\`
> wsl
> \`\`\`
> 
> \- Start Slicer:
> 
> \`\`\`
> /tmp/Slicer-5.7.0-2024-07-20-linux-amd64/Slicer
> \`\`\`
> 
> \# Experienced issues
> 
> \## Extensions manager crashes
> 
> Workaround: install extensions using the Python console
> 
> \`\`\`
> extensionNames = \["SlicerIGT", "SegmentEditorExtraEffects"\]
> em = slicer.app.extensionsManagerModel()
> em.interactive = False # prevent display of popups
> restart = False # we will restart manually after all extensions were installed
> update = True
> for extensionName in extensionNames:
> if not em.installExtensionFromServer(extensionName, restart):
> raise ValueError(f"Failed to install {extensionName} extension")
> print(f"Installed {extensionName}")
> slicer.util.restart()
> \`\`\`
> 
> \## Cannot use view controllers (that appear when push-pin button is clicked)
> 
> View contollers appear slightly shifted and buttons do not react.
> 
> Workaround: use \`View Controllers\` module to adjust view settings
> 
> \## Popup windows appear out of place
> 
> Confirmation popups etc. appear far away from the application window.
> 
> Workaround: none. The popup windows are still functional.
> 
> \## Rendering is slow
> 
> \## Switching to Volume Rendering module crashes the application
