Package Details: java-matlab 1:R2025a.25.1.0.2943329-6

Git Clone URL: https://aur.archlinux.org/matlab.git (read-only, click to copy)
Package Base: matlab
Description: A high-level language for numerical computation and visualization (Java components)
Upstream URL: https://www.mathworks.com/products/matlab.html
Keywords: computation matlab numerical visualization
Licenses: custom:MATLAB EULA
Provides: java-matlab-version
Submitter: ido
Maintainer: vitaliikuzhdin
Last Packager: vitaliikuzhdin
Votes: 41
Popularity: 0.77
First Submitted: 2015-08-15 09:33 (UTC)
Last Updated: 2025-06-25 09:52 (UTC)

Dependencies (5)

Required by (1)

Sources (1)

Pinned Comments

Latest Comments

« First ‹ Previous 1 .. 7 8 9 10 11 12 13 14 15 16 17 .. 26 Next › Last »

Andy2 commented on 2021-01-22 20:27 (UTC)

Hi,

I ran into the same Python issue and I "backported" the Python 3.8 faking for Python 3.9. Matlab installed and I was able to start a Matlab engine from an iPython shell, so I would suspect it works.

I even installed the Update 3 as root after Matlab told me I could do that from the little bell icon menu and it still works.

Patch:

diff --git a/PKGBUILD b/PKGBUILD
index b6a40eb..87f79b8 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -150,22 +150,53 @@ build() {
   #   cause the installation to be non-interactive
   "${srcdir}/${pkgname}/install" -inputFile "${srcdir}/${pkgname}/installer_input.txt"

+  # Create spoofing for Python API
+  # https://aur.archlinux.org/packages/matlab-engine-for-python/
+  cd "${srcdir}/build/extern/engines/python"
+  # Getting appropriate python version for spoofing
+  _matminor="$(find "${srcdir}/build/extern/engines/python" \
+    -name 'matlabengineforpython3*.so' |
+    sort |
+    sed 's|.*matlabengineforpython3_\([0-9]\)\.so|\1|g' |
+    tail -1)"
+  echo 'import sys' > "${srcdir}/sitecustomize.py"
+  echo "sys.version_info = (3, ${_matminor}, 0)" >> "${srcdir}/sitecustomize.py"
+
   # Build the python API
   cd "${srcdir}/build/extern/engines/python"
-  python setup.py build
+  PYTHONPATH="${srcdir}" python setup.py build
 }

 package() {
   # Package the python API
   cd "${srcdir}/build/extern/engines/python"
-  python setup.py install --root="${pkgdir}" --optimize 1 --skip-build
-  # Fix erronous referances in the _arch.txt files
+  PYTHONPATH="${srcdir}" python setup.py install --root="${pkgdir}" --optimize 1 --skip-build
+
+  # Spoofing trick to fool matlab into believing python 3.9 is supported
+  _matminor="$(find "${srcdir}/build/extern/engines/python" \
+    -name 'matlabengineforpython3*.so' |
+    sort |
+    sed 's|.*matlabengineforpython3_\([0-9]\)\.so|\1|g' |
+    tail -1)"
+  _prefix="$(python -c 'import sys; print(sys.prefix)')"
+  _pytminor="$(python -c 'import sys; print(sys.version_info.minor)')"
+
+  # Correct file names
+  if [[ "${_pytminor}" != "${_matminor}" ]]; then
+    mv "${pkgdir}/${_prefix}/lib/python3".{"${_matminor}","${_pytminor}"}
+    _egginfo="$(ls "${pkgdir}/${_prefix}/lib/python3.${_pytminor}/site-packages/"*"-py3.${_matminor}.egg-info")"
+    mv "${_egginfo}" "${_egginfo%py3."${_matminor}".egg-info}py3.${_pytminor}.egg-info"
+    sed -i "s|sys.version_info|(3, $_matminor, 0)|" \
+      "${pkgdir}/${_prefix}/lib/python3.${_pytminor}/site-packages/matlab/engine/__init__.py"
+  fi
+
+  # Fix erronous references in the _arch.txt files
   _prefix="$(python -c 'import sys; print(sys.prefix)')"
   errstr="${srcdir}/build/extern/engines/python/"
   trustr="${instdir}/extern/engines/python/"
   for _dir in \
     "${srcdir}/build/extern/engines/python/build/lib/matlab/engine" \
-    "${pkgdir}/${_prefix}/lib/python3.8/site-packages/matlab/engine" \
+    "${pkgdir}/${_prefix}/lib/python3.${_pytminor}/site-packages/matlab/engine" \
     ; do
     sed -i "s|${errstr}|${trustr}|" "${_dir}/_arch.txt"
   done

silverbluep commented on 2021-01-06 03:10 (UTC)

@hawath; when I last updated the package; gcc8 was not in AUR and I do not have any intention to package that. It seems gcc8 was submitted to AUR a month after I installed the package. I'll also change the gcc version when I fix the python issue.

silverbluep commented on 2021-01-06 03:07 (UTC)

@tornado99; that's where external software is installed. https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

silverbluep commented on 2021-01-06 03:05 (UTC)

@magnetron2.4ghz you need to switch the spoof for python 3.7 to python 3.8; it's not gonna be seamless copy paste. However; the line you are reporting should work; as I installed using the previous version before. I do remember making a few typos that made the package not build but I recall not committing them but perhaps I did?

@sukanka; this is a system-wide installation pkgbuild thus I see no reason to integrate with anaconda or neither do I use anaconda myself. So for that, you are on your own.

If you people rather not deal with this; you can remove the matlab-engine-for-python from depends array manually; and remove any build instructions for python integration. The reason why i included this in the package is to play nice with jupyter-matlab_kernel-git; integration needs to happen on the matlab pkgbuild; not a seperate one otherwise the pkgbuild tries to run matlab which is unneccessary overhead. (Year 2021 and matlab still does not respect a quick version check on their launcher matlab script.)

Again I apologize for the delay in updating the package; but I'm not going to push any changes until I can confirm that everything works; and I need access to my PC before that. I'm not going to my workplace until end of January due to COVID so only going to be able to test then.

magnetron2.4ghz commented on 2021-01-04 23:53 (UTC)

I tried swapping the Build() function from the makepkg version bbaserdem mentioned (2020a), which seems to have fixed that error but now I'm getting a different, generic build() error:

==> ERROR: A failure occurred in build(). Aborting...

It seems the error occurs on this line (I figured this out using a couple echo statements)

"${srcdir}/${pkgname}/install" -inputFile "${srcdir}/${pkgname}/installer_input.txt"

For today I will use MATLAB online, but I will be back to do more troubleshooting tonight!

sukanka, which installation script do you refer to? the one listed in your comment? would that have the same effect as swapping the whole build function as I have done?

P.S. Thank you bbaserdem and sukanka for the quick replies!

sukanka commented on 2021-01-04 12:48 (UTC) (edited on 2021-01-04 12:51 (UTC) by sukanka)

I change gcc9 to gcc and it just works! As for the python3.9, I guess we can add "3.9" to the list. But I use anaconda, and I make it use python provided by anaconda. And I have to use the legacy installation script, or it will fail.

sed -i 's|install_unix"|install_unix_legacy"|g'  "${srcdir}/${pkgname}/install"
# add this to build(){}

silverbluep commented on 2021-01-04 02:09 (UTC)

I have a fix for the python 3.9 (i fixed this issue within the pkgbuild before) however I won't be able to test it and roll it ouh; as I did not have access to my PC until the end of January.

If you feel confident; you can dig out the fix in the PKGBUILD commit history; i believe either 2019b or 2020a versions were using an outdated version of python and I had the fix for either one of the versions. If not; I ask for patience until I get back home to make sure the spoofing works before i publish.

magnetron2.4ghz commented on 2021-01-03 22:50 (UTC)

The installer for matla-engine-for-python doesnt currently support python 3.9, as this error in build() illustrates

Traceback (most recent call last): File "/home/<username>/MATLAB/matlab/src/build/extern/engines/python/setup.py", line 15, in <module> raise EnvironmentError('MATLAB Engine for Python supports Python version' OSError: MATLAB Engine for Python supports Python version 2.7, 3.6, 3.7, and 3.8, but your version of Python is 3.9

I tried installing python38 from AUR but no dice. Same Error.

daniel_shub commented on 2020-12-18 02:09 (UTC)

@tornado99 it gets installed in /opt/tmw because that is where the FHS says it should go: /opt is reserved for the installation of add-on application software packages. (https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s13.html). Now you might be thinking, but TMW defaults to /usr/local and that is where all the online tutorials say it goes. And that is right, and consistent with the FHS: The /usr/local hierarchy is for use by the system administrator when installing software locally. (https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s09.html). The difference is that this package essentially removes the system administrator from the process and in general, a package manager should never install anything in /usr/local.

tornado99 commented on 2020-12-17 19:23 (UTC) (edited on 2020-12-17 19:42 (UTC) by tornado99)

Any clues where this is installed? Followed the Readme and installation finished without errors. However /usr/local/MATLAB is empty apart from an older version I installed manually.

Edit: found it at /opt/tmw. Why this location?