Can I install MATLAB in Bash on Ubuntu on Windows?

342 views (last 30 days)
The Windows 10 Anniversary update (Windows 10 build 1607) has an option to install a Bash shell based on a minimal Ubuntu 14.04 environment. Can I install MATLAB in this environment?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 5 Dec 2018
Bash on Ubuntu on Windows is a minimal installation of Ubuntu and therefore lacks many of the libraries that MATLAB requires to install and run that would be present in a normal Ubuntu Linux installation. This configuration is not qualified for MATLAB.
  8 Comments
Caterina Brighi
Caterina Brighi on 15 Sep 2020
Hi, I am having troubles with the installation of Matlab R2020a on my Ubuntu 18.04 WSL2. I am trying to use the silent installation instructions, by populating the installer_inut.txt file with the output folder, activation key, etc... the command run, but no folder gets created in my output directory. Any advice on how to fix this?
Thanks

Sign in to comment.

More Answers (11)

Winston Yu
Winston Yu on 17 Aug 2018
Edited: Walter Roberson on 17 Aug 2018
There are several things need to be fixed for default ubuntu on Windows 10
1. update basic library (for R2018a, MATLAB use glibc 3.4.22)
sudo apt-get install libstdc++6
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
2. install display library like mesa library (assume you are using opengl)
apt-get install mesa-utils
3. install jdk
apt-get install default-jdk
4. install execstack
apt-get install execstack
5. As George Yammine suggest, clean ELF of blas and lapack library, at matlabroot/bin/glnxa64, run command:
execstack -c libmwblas.so
execstack -c libmwlapack.so
execstack -s MATLAB
  4 Comments
Mahmod Karndash
Mahmod Karndash on 5 Jun 2022
at step 5 < As George Yammine suggest, clean ELF of blas and lapack library, at matlabroot/bin/glnxa64, run command:
execstack -c libmwblas.so>
I have this error
root@DESKTOP-SMROJT0:/root/softwares/R2018a/bin/glnxa64# execstack -c libmwblas.so
execstack: cannot open "libmwblas.so": No such file or directory
please help

Sign in to comment.


Winston Yu
Winston Yu on 22 May 2022
Mahmod :
Same as /mnt/d, /mnt/c is not a good place to install any WSL2 based software, it's NTFS also. you have to install the software not on /mnt and not use anything at /mnt during the installation.
I feel that your WSL2 installation is corrupted, the error message like:
mkdir: cannot create directory ‘/home/daren/.cache’: Permission denied
indicate that something wrong with your WSL2 installation
Winston
  2 Comments
Mahmod Karndash
Mahmod Karndash on 24 May 2022
I have wsl2 and I check the version of WSL each is set to by entering the command: wsl -l -v in PowerShell and I have
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Users\Daren> wsl -l -v
NAME STATE VERSION
* Ubuntu-16.04 Running 2
PS C:\Users\Daren>
but when i run the following commands in ubuntu terminal
export DISPLAY=:0
export LIBGL_ALWAYS_INDIRECT=1
startlxde ( main command to run the desktop)
i have error
mkdir: cannot create directory ‘/home/daren/.cache’: Permission denied
-bash: /home/daren/.cache/wslu/integration: Permission denied
daren@DESKTOP-SMROJT0:~$ sudo -s
[sudo] password for daren:
root@DESKTOP-SMROJT0:~# export DISPLAY=:0
root@DESKTOP-SMROJT0:~# export LIBGL_ALWAYS_INDIRECT=1
root@DESKTOP-SMROJT0:~# startlxde
Agent pid 555
** Message: main.vala:99: Session is LXDE
** Message: main.vala:100: DE is LXDE
(lxsession:553): Gtk-WARNING **: cannot open display: :0
root@DESKTOP-SMROJT0:~#
and I can not see the lxde desktop
please help me to install wsl2 and desktop (GUI) in WSL and how to install matlab r2018a in wsl As mentioned in the priorTuturial https://www.mathworks.com/matlabcentral/answers/uploaded_files/1007325/PSI%20using%20SNAP_STAMPS%20tutorial%201%20_Installation%20and%20preperation%20(2).pdf
My processing of the data in my thesis is contingent on that and I don't have much time
Please forgive my ignorance in these topics, and thank you very much for your support and help

Sign in to comment.


Enrico Schulz
Enrico Schulz on 18 Sep 2017
Which library is exactly missing? It is very easy to add every needed library. There's lot of software that is actually runing, including graphical nautilus, synaptic, FSL etc. with xlaunch.
matlab -nodesktop -nodisplay -nojvm -nosplash Without the need for any graphical output I am running into the following error message: MATLAB: detail/MvmLocalBoundMethods.cpp:114: static void mvm::detail::MvmLocalBoundMethods::initMethods(bool): Assertion `Failed to open local mvm library: libmwblas.so: cannot enable executable stack as shared object requires: Invalid argument' failed. Aborted (core dumped)
Best wishes!
  2 Comments
Philip Borghesani
Philip Borghesani on 3 Nov 2017
That error appears to be related to this missing feature: cannot enable executable stack as shared object requires. No missing library is causing the issue.

Sign in to comment.


Mufti Mahmud
Mufti Mahmud on 2 Oct 2017
Dear MathWorks Support Team,
as the installation goes on well without any problem, would it be possible to let us know the required libraries to run which we may try to install manually and use it from the Bash!
That would be great!
Many thanks!

alexandre obert
alexandre obert on 27 Oct 2017
The same error occurred when trying to implement Runtime through linux native programs - I've got ths error with freesurfer. I do not find any valuable solution by now...
  2 Comments

Sign in to comment.


Philip Borghesani
Philip Borghesani on 3 Nov 2017
I am curious Why would anyone want to do this? I can think of a few reasons, that I don't think are very good, but can think of no showstopper reason. I am not going to list my ideas here to avoid tainting the list.
What problem do you expect to solve or feature do you expect to gain by running Linux MATLAB on Windows instead of Windows MATLAB? Please post responses as comments to this answer.
  11 Comments
Mahmod Karndash
Mahmod Karndash on 25 Apr 2022
Please help , how do you install Matlab 2018a for Linux on Ubuntu WSL.I am using ubuntu16.04 wsl and I tried to install matlab r2018a but I can not, please help
When running the Installer on Linux, I see the below in terminal:
Preparing installation files …
Installing …
Finished.
the installer does not launch and MATLAB is not installed.
root@DESKTOP-SMROJT0:/mnt/d/R2018a# ls
activate.ini install licenses ui
archives installer_input.txt patents.txt version.txt
bin install_guide.pdf readme.txt
etc java sys
help license_agreement.txt trademarks.txt
root@DESKTOP-SMROJT0:/mnt/d/R2018a# sudo ./install
Preparing installation files …
Installing …
Finished
root@DESKTOP-SMROJT0:/mnt/d/R2018a#
I tried using the suggested solution from mathworks but it didn’t work:
oot@DESKTOP-SMROJT0:/mnt/d/R2018a# ls
activate.ini install licenses ui
archives install_guide.pdf patents.txt version.txt
bin installer_input.txt readme.txt
etc java sys
help license_agreement.txt trademarks.txt
root@DESKTOP-SMROJT0:/mnt/d/R2018a# sudo chmod -R 777 matlab_R2018a_glnxa64
chmod: cannot access ‘matlab_R2018a_glnxa64’: No such file or directory
root@DESKTOP-SMROJT0:/mnt/d/R2018a#
please help وMy work and results are stalled because of that
thank you in advance

Sign in to comment.


Francois
Francois on 9 Mar 2018
Is there any hope for having this working at some point?
The one thing I tried for getting rid of these errors is the following:
execstack -s glnxa64/libmwblas.so
execstack -s glnxa64/libmwlapack.so
But then the execution simply stops after displaying the message "MATLAB is selecting SOFTWARE OPENGL rendering", without any error.
This would be helpful for setting up some specific research software environments, that require combinations of many programs (MATLAB, SPM, FreeSurfer, ...) in Windows environments.

Sabyasachi Ghosh
Sabyasachi Ghosh on 22 Oct 2021
Is this still not possible, even with WSLg? I get the following error:
```
./install
terminate called after throwing an instance of 'std::runtime_error'
what(): Failed to launch web window with error: Unable to launch the MATLABWindow application. The exit code was: 127
Aborted
```
  1 Comment
cui
cui on 27 Nov 2021
Is your platform windows 10 or 11, WSLg is not supported on windows 10, and windows 11 is still immature?

Sign in to comment.


Mahmod Karndash
Mahmod Karndash on 20 May 2022
Please help , how do you install Matlab 2018a for Linux on Ubuntu WSL.I am using ubuntu16.04 wsl and I tried to install matlab r2018a but I can not, please help
When running the Installer on Linux, I see the below in terminal:
Preparing installation files …
Installing …
Finished.
the installer does not launch and MATLAB is not installed.
root@DESKTOP-SMROJT0:/mnt/d/R2018a# ls
activate.ini install licenses ui
archives installer_input.txt patents.txt version.txt
bin install_guide.pdf readme.txt
etc java sys
help license_agreement.txt trademarks.txt
root@DESKTOP-SMROJT0:/mnt/d/R2018a# sudo ./install
Preparing installation files …
Installing …
Finished
root@DESKTOP-SMROJT0:/mnt/d/R2018a#
I tried using the suggested solution from mathworks but it didn’t work:
root@DESKTOP-SMROJT0:/mnt/d/R2018a# ls
activate.ini install licenses ui
archives install_guide.pdf patents.txt version.txt
bin installer_input.txt readme.txt
etc java sys
help license_agreement.txt trademarks.txt
root@DESKTOP-SMROJT0:/mnt/d/R2018a# sudo chmod -R 777 matlab_R2018a_glnxa64
chmod: cannot access ‘matlab_R2018a_glnxa64’: No such file or directory
root@DESKTOP-SMROJT0:/mnt/d/R2018a#
please help وMy work and results are stalled because of that
thank you in advance

Winston Yu
Winston Yu on 21 May 2022
Mathworks now have mpm package to installing Linux binary: matlab-dockerfile/MPM.md at main · mathworks-ref-arch/matlab-dockerfile · GitHub
So, on WSL2, run these steps
sudo apt-get install -y unzip
wget https://www.mathworks.com/mpm/glnxa64/mpm
chmod +x mpm
./mpm install --release=R2018a --destination=/usr/local/MATLAB/R2018a MATLAB
Then MATLAB will be installed /usr/local/MATLAB/R2018a
Mahmod, you can't use /mnt/d to do any installation operation and also can't install MATLAB at /mnt/d, /mnt is Windows NTFS filesystem, can't be used as true Linux file system, you need to install the software somewhere else.
  2 Comments
Mahmod Karndash
Mahmod Karndash on 5 Jun 2022
please help .I have lxde desktop in ubuntu 18.04 on wsl2 and I want to install matlab R2018a in ubuntu 18.04 but I have always errors....I tried as you advised me but there is an error
root@DESKTOP-SMROJT0:/root/softwares/R2018a# ls
activate.ini install licenses ui
archives install_guide.pdf patents.txt version.txt
bin installer_input.txt readme.txt
etc java sys
help license_agreement.txt trademarks.txt
root@DESKTOP-SMROJT0:/root/softwares/R2018a# sudo apt-get install -y unzip
Reading package lists... Done
Building dependency tree
Reading state information... Done
unzip is already the newest version (6.0-21ubuntu1.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@DESKTOP-SMROJT0:/root/softwares/R2018a# wget https://www.mathworks.com/mpm/glnxa64/mpm
--2022-06-05 22:53:38-- https://www.mathworks.com/mpm/glnxa64/mpm
Resolving www.mathworks.com (www.mathworks.com)... 104.122.196.55, 2001:500:200::b, 2001:500:a8::e, ...
Connecting to www.mathworks.com (www.mathworks.com)|104.122.196.55|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2022-06-05 22:53:39 ERROR 404: Not Found.
please please help

Sign in to comment.


Mahmod Karndash
Mahmod Karndash on 22 May 2022
Edited: Walter Roberson on 22 May 2022
mkdir: cannot create directory ‘/home/daren/.cache’: Permission denied
-bash: /home/daren/.cache/wslu/integration: Permission denied
-bash: /home/daren/.cache/wslu/integration: Permission denied
daren@DESKTOP-SMROJT0:/mnt/c/WINDOWS/system32$ sudo apt-get install -y
[sudo] password for daren:
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
daren@DESKTOP-SMROJT0:/mnt/c/WINDOWS/system32$ wget https://www.mathworks.com/mpm/glnxa64/mpm
--2022-05-22 11:19:00-- https://www.mathworks.com/mpm/glnxa64/mpm
Resolving www.mathworks.com (www.mathworks.com)... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘www.mathworks.com’
daren@DESKTOP-SMROJT0:/mnt/c/WINDOWS/system32$ wget https://www.mathworks.com/mpm/glnxa64/mpm
--2022-05-22 12:01:53-- https://www.mathworks.com/mpm/glnxa64/mpm
Resolving www.mathworks.com (www.mathworks.com)... 104.122.196.55
Connecting to www.mathworks.com (www.mathworks.com)|104.122.196.55|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2022-05-22 12:01:54 ERROR 404: Not Found.
daren@DESKTOP-SMROJT0:/mnt/c/WINDOWS/system32$
please help ,,,,thank you in advance
  3 Comments

Sign in to comment.

Tags

No tags entered yet.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!