Closed AndrewHerzing closed 1 year ago
Xvfb is running correctly as far as I can tell and is on the system path:
>>> which Xvfb
/usr/bin/Xvfb
And here is the DEBUG level output:
[I 2023-09-14 15:33:08.740 ServerApp] Kernel started: bcd9f448-5a97-4a39-8aae-e63178f8207a
[I 2023-09-14 15:33:09.434 ServerApp] 302 GET /matlab (952f2b53385f4fa4b04c753a8dd3f1f6@127.0.0.1) 0.78ms
DEBUG:MATLABProxyApp:Successfully validated provided jupyter configuration DEBUG:MATLABProxyApp:Environment variable MWI_CUSTOM_HTTP_HEADERS is not set, hence no custom HTTP headers are applied. DEBUG:MATLABProxyApp:DDUX value for matlab-proxy "MATLAB_PROXY:JUPYTER:V1" DEBUG:MATLABProxyApp:Combined DDUX value to be used for MATLAB process: "MATLAB_PROXY:JUPYTER:V1"
DEBUG:MATLABProxyApp:Specified MATLAB root path:/usr/local/MATLAB/R2023a exists, continuing to verify its validity... INFO:MATLABProxyApp:Found MATLAB Executable: /usr/local/MATLAB/R2023a/bin/matlab with Root: /usr/local/MATLAB/R2023a
DEBUG:asyncio:Using selector: EpollSelector DEBUG:MATLABProxyApp:Using MWI_APP_PORT to launch the server
DEBUG:MATLABProxyApp:Starting MATLAB proxy app
DEBUG:MATLABProxyApp: with base_url: /matlab and app_port:49339.
DEBUG:MATLABProxyApp:Server info stored into: /home/aherzing/.matlab/MWI/ports/49339/mwi_server.info
INFO:MATLABProxyApp:
==================================================================================================================================================================
MATLAB can be accessed at:
http://127.0.0.1:49339/matlab
==================================================================================================================================================================
DEBUG:MATLABProxyApp:Found cached licensing information...
INFO:MATLABProxyApp:Using cached existing license to launch MATLAB
DEBUG:MATLABProxyApp:Xvfb has not started
INFO:MATLABProxyApp:Stopped (any running) MATLAB process.
DEBUG:MATLABProxyApp:Clearing logs!
DEBUG:MATLABProxyApp:Cleared any logs created by the MATLAB process.
DEBUG:MATLABProxyApp:Completed Shutdown!!!
DEBUG:MATLABProxyApp:Waiting for XVFB process to initialize and provide Display Number
[I 2023-09-14 15:33:19.738 ServerApp] 302 GET /matlab/ (952f2b53385f4fa4b04c753a8dd3f1f6@127.0.0.1) 10302.62ms
DEBUG:MATLABProxyApp:Xvfb has not started
[I 2023-09-14 15:33:19.752 ServerApp] Connecting to kernel bcd9f448-5a97-4a39-8aae-e63178f8207a.
[I 2023-09-14 15:33:19.757 ServerApp] Connecting to kernel bcd9f448-5a97-4a39-8aae-e63178f8207a.
[I 2023-09-14 15:33:19.763 ServerApp] Connecting to kernel bcd9f448-5a97-4a39-8aae-e63178f8207a.
ERROR:MATLABProxyApp:Unable to start the Xvfb process. Ensure Xvfb is installed and is available on the System Path. See https://github.com/mathworks/matlab-proxy#requirements for information on Xvfb
DEBUG:MATLABProxyApp:Registering handler for signal: 1
DEBUG:MATLABProxyApp:Registering handler for signal: 2
DEBUG:MATLABProxyApp:Registering handler for signal: 3
DEBUG:MATLABProxyApp:Registering handler for signal: 15
DEBUG:MATLABProxyApp: inside authenticate_request for request:<Request GET /matlab/get_env_config >
DEBUG:MATLABProxyApp: Token Authentication is NOT Enabled!!
DEBUG:MATLABProxyApp:Xvfb has not started
Thank you for trying out matlab-proxy and your patience, @AndrewHerzing
Can you kindly confirm that you are able to start Xvfb outside of matlab-proxy? The required command for the same would be akin to the below-mentioned command:
exec 6>display.log && Xvfb -displayfd 6 -screen 0 1600x1200x24 -dpi 100 -extension RANDR
From your bug description (thank you for sharing detailed information), it seems that you are using WSL2. For our integration to work with WSL2, we would require an update to the .wslconfig
file to set guiApplications=false
. .wslconfig
file is usually placed in the user's home directory and can be cd'ed using cd ~
. You may have to restart your system for the changes to take effect.
Looking forward to hearing about your findings!
I am also using Ubuntu 20.04.3 within WSL2, and I encountered the same error. How can I fix it? When I run the command: exec 6>display.log && Xvfb -displayfd 6 -screen 0 1600x1200x24 -dpi 100 -extension RANDR in the terminal, I receive numerous messages indicating: 'failed to create listener for unix'. The last line displays: Fatal server error: (EE) Failed to find a socket to listen on(EE)"
Thank you for your comment, @arang129! The error that you are seeing tells me that Xvfb is failing to start outside of matlab-proxy as well. Since matlab-proxy depends on Xvfb, Xvfb needs to be in a functional state in the system where matlab-proxy is deployed.
Here is what you can do to potentially fix this issue.
Navigate to your user's home directory on the Windows OS using cd ~
Update the .wslconfig file to include
guiApplications=false
If the file is not present under the home directory, please create it with the name .wslconfig
and include the below content:
# Settings apply across all Linux distros running on WSL 2
[wsl2]
# Boolean to turn on or off support for GUI applications (WSLg) in WSL. Only available for Windows 11.
guiApplications=false
wsl --shutdown
to stop all running distributions and wsl
to start the Ubuntu distribution. You can also mention the distribution while shutting down and starting up if you have more than one distribution installed/running.Hope this helps!
Thank you so much, @krisctl ! After following your instructions, I was able to open it successfully!
@AndrewHerzing Does the provided information also help resolve the issue you are facing?
No this did not help me. I get the following after creating the .wslconfig file as instructed:
env MWI_BASE_URL="/matlab" matlab-proxy-app
INFO:MATLABProxyApp:Found MATLAB Executable: /usr/local/MATLAB/R2023a/bin/matlab with Root: /usr/local/MATLAB/R2023a
INFO:MATLABProxyApp:
========================================================================================================================
MATLAB can be accessed at:
http://localhost:37971/matlab
========================================================================================================================
INFO:MATLABProxyApp:Using cached NLM licensing to launch MATLAB
INFO:MATLABProxyApp:Stopped (any running) MATLAB process.
ERROR:MATLABProxyApp:Unable to start the Xvfb process. Ensure Xvfb is installed and is available on the System Path. See https://github.com/mathworks/matlab-proxy#requirements for information on Xvfb
It looks as though there is an issue with Xvfb on WSL, at least for my installation.
Also, the comment in the .wslconfig line mentions that this option only works for Windows 11. I am running 10. Maybe this is the issue?
It looks like the problem was due to a Linux file permission issue. By running:
sudo chmod 1777 /tmp/.X11-unix
I am now able to start the Matlab proxy properly and it seems to be functioning well. It is unclear as to why the file permissions were set incorrectly to begin with or how I make the successful change persistent, but at least the origin of the problem is clear now.
Thank you for digging deeper and sharing, @AndrewHerzing !
The info in this issue will help many others....
Matlab Version: R2023a OS: Ubuntu 20.04.3 running on WSL2 matlab-proxy version: 0.77 (development version) jupyter-matlab-proxy version: 0.7.1 jupyter version: 4.0.5
I can start Matlab from the command line in GUI mode or terminal mode using -nodisplay without trouble. When I start jupyter lab and then try to open Matlab, I receive the following error:
If I try to simply open the Matlab kernel in Jupyter, I see
MATLAB
in the output. If I try to execute any commands, I see the following error:According to
htop
, a number of json related processes are launched when the Matlab kernel is started. The commands for these all look something like:This is using a clean conda environment with only jupyter and matlab-proxy installed.