matlabengine 25.2.2__tar.gz → 26.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {matlabengine-25.2.2 → matlabengine-26.1.1}/PKG-INFO +10 -9
- {matlabengine-25.2.2 → matlabengine-26.1.1}/README.md +7 -7
- {matlabengine-25.2.2 → matlabengine-26.1.1}/setup.py +9 -7
- matlabengine-26.1.1/src/matlab/__init__.py +232 -0
- {matlabengine-25.2.2 → matlabengine-26.1.1}/src/matlab/engine/__init__.py +6 -6
- {matlabengine-25.2.2 → matlabengine-26.1.1}/src/matlab/engine/matlabengine.py +9 -5
- {matlabengine-25.2.2 → matlabengine-26.1.1}/src/matlabengine.egg-info/PKG-INFO +10 -9
- matlabengine-25.2.2/src/matlab/__init__.py +0 -49
- {matlabengine-25.2.2 → matlabengine-26.1.1}/LICENSE.txt +0 -0
- {matlabengine-25.2.2 → matlabengine-26.1.1}/pyproject.toml +0 -0
- {matlabengine-25.2.2 → matlabengine-26.1.1}/setup.cfg +0 -0
- {matlabengine-25.2.2 → matlabengine-26.1.1}/src/matlab/engine/basefuture.py +0 -0
- {matlabengine-25.2.2 → matlabengine-26.1.1}/src/matlab/engine/engineerror.py +0 -0
- {matlabengine-25.2.2 → matlabengine-26.1.1}/src/matlab/engine/enginehelper.py +0 -0
- {matlabengine-25.2.2 → matlabengine-26.1.1}/src/matlab/engine/enginesession.py +0 -0
- {matlabengine-25.2.2 → matlabengine-26.1.1}/src/matlab/engine/fevalfuture.py +0 -0
- {matlabengine-25.2.2 → matlabengine-26.1.1}/src/matlab/engine/futureresult.py +0 -0
- {matlabengine-25.2.2 → matlabengine-26.1.1}/src/matlab/engine/matlabfuture.py +0 -0
- {matlabengine-25.2.2 → matlabengine-26.1.1}/src/matlabengine.egg-info/SOURCES.txt +0 -0
- {matlabengine-25.2.2 → matlabengine-26.1.1}/src/matlabengine.egg-info/dependency_links.txt +0 -0
- {matlabengine-25.2.2 → matlabengine-26.1.1}/src/matlabengine.egg-info/not-zip-safe +0 -0
- {matlabengine-25.2.2 → matlabengine-26.1.1}/src/matlabengine.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: matlabengine
|
|
3
|
-
Version:
|
|
3
|
+
Version: 26.1.1
|
|
4
4
|
Summary: A module to call MATLAB from Python
|
|
5
5
|
Home-page: https://github.com/mathworks/matlab-engine-for-python/
|
|
6
6
|
Author: MathWorks
|
|
@@ -16,7 +16,8 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
-
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Requires-Python: >=3.9, <3.14
|
|
20
21
|
Description-Content-Type: text/markdown
|
|
21
22
|
License-File: LICENSE.txt
|
|
22
23
|
|
|
@@ -28,11 +29,11 @@ The MATLAB® Engine API for Python® provides a package to integrate MATLA
|
|
|
28
29
|
## Requirements
|
|
29
30
|
### Required MathWorks Products
|
|
30
31
|
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
|
|
31
|
-
* MATLAB release
|
|
32
|
+
* MATLAB release R2026a
|
|
32
33
|
|
|
33
34
|
### Required 3rd Party Products
|
|
34
35
|
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
|
|
35
|
-
* Python 3.9, 3.10, 3.11, or 3.
|
|
36
|
+
* Python 3.9, 3.10, 3.11, 3.12, or 3.13
|
|
36
37
|
* Supported Python versions by MATLAB release can be found [here](https://www.mathworks.com/support/requirements/python-compatibility.html).
|
|
37
38
|
|
|
38
39
|
---
|
|
@@ -43,7 +44,7 @@ The MATLAB® Engine API for Python® provides a package to integrate MATLA
|
|
|
43
44
|
MATLAB Engine API for Python can be installed directly from the Python Package Index.
|
|
44
45
|
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
|
|
45
46
|
```bash
|
|
46
|
-
$ python -m pip install matlabengine==
|
|
47
|
+
$ python -m pip install matlabengine==26.1.1
|
|
47
48
|
```
|
|
48
49
|
|
|
49
50
|
|
|
@@ -51,7 +52,7 @@ $ python -m pip install matlabengine==25.2.2
|
|
|
51
52
|
### Linux®
|
|
52
53
|
Prior to installation, check the default install location of MATLAB by calling ```matlabroot``` in a MATLAB Command Window. By default, Linux installs MATLAB at:<br>
|
|
53
54
|
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
|
|
54
|
-
```/usr/local/MATLAB/
|
|
55
|
+
```/usr/local/MATLAB/R2026a```
|
|
55
56
|
|
|
56
57
|
When MATLAB is not installed in the default location, the bin/*architecture* directory within the MATLAB root directory must be added to the environment variable LD_LIBRARY_PATH. The path can be added to the environment variable within the shell startup configuration file (for example, .bashrc for bash shell or .tcshrc for tcsh).
|
|
57
58
|
|
|
@@ -68,14 +69,14 @@ setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:<matlabroot>/bin/glnxa64
|
|
|
68
69
|
MATLAB Engine API for Python can be installed directly from the Python Package Index.
|
|
69
70
|
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
|
|
70
71
|
```bash
|
|
71
|
-
$ python -m pip install matlabengine==
|
|
72
|
+
$ python -m pip install matlabengine==26.1.1
|
|
72
73
|
```
|
|
73
74
|
|
|
74
75
|
### macOS
|
|
75
76
|
Prior to installation, check the default install location of MATLAB by calling ```matlabroot``` in a MATLAB Command Window. By default, macOS installs MATLAB at:<br>
|
|
76
77
|
|
|
77
78
|
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
|
|
78
|
-
```/Applications/
|
|
79
|
+
```/Applications/MATLAB_R2026a.app```
|
|
79
80
|
|
|
80
81
|
When MATLAB is not installed in the default location, the bin/*architecture* directory within the MATLAB root directory must be added to the environment variable DYLD_LIBRARY_PATH. The path can be added to the environment variable within the shell startup configuration file (for example, .bashrc for bash shell or .tcshrc for tcsh).
|
|
81
82
|
|
|
@@ -92,7 +93,7 @@ setenv DYLD_LIBRARY_PATH ${DYLD_LIBRARY_PATH}:<matlabroot>/bin/maci64
|
|
|
92
93
|
MATLAB Engine API for Python can be installed directly from the Python Package Index.
|
|
93
94
|
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
|
|
94
95
|
```bash
|
|
95
|
-
$ python -m pip install matlabengine==
|
|
96
|
+
$ python -m pip install matlabengine==26.1.1
|
|
96
97
|
```
|
|
97
98
|
|
|
98
99
|
---
|
|
@@ -6,11 +6,11 @@ The MATLAB® Engine API for Python® provides a package to integrate MATLA
|
|
|
6
6
|
## Requirements
|
|
7
7
|
### Required MathWorks Products
|
|
8
8
|
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
|
|
9
|
-
* MATLAB release
|
|
9
|
+
* MATLAB release R2026a
|
|
10
10
|
|
|
11
11
|
### Required 3rd Party Products
|
|
12
12
|
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
|
|
13
|
-
* Python 3.9, 3.10, 3.11, or 3.
|
|
13
|
+
* Python 3.9, 3.10, 3.11, 3.12, or 3.13
|
|
14
14
|
* Supported Python versions by MATLAB release can be found [here](https://www.mathworks.com/support/requirements/python-compatibility.html).
|
|
15
15
|
|
|
16
16
|
---
|
|
@@ -21,7 +21,7 @@ The MATLAB® Engine API for Python® provides a package to integrate MATLA
|
|
|
21
21
|
MATLAB Engine API for Python can be installed directly from the Python Package Index.
|
|
22
22
|
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
|
|
23
23
|
```bash
|
|
24
|
-
$ python -m pip install matlabengine==
|
|
24
|
+
$ python -m pip install matlabengine==26.1.1
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
|
|
@@ -29,7 +29,7 @@ $ python -m pip install matlabengine==25.2.2
|
|
|
29
29
|
### Linux®
|
|
30
30
|
Prior to installation, check the default install location of MATLAB by calling ```matlabroot``` in a MATLAB Command Window. By default, Linux installs MATLAB at:<br>
|
|
31
31
|
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
|
|
32
|
-
```/usr/local/MATLAB/
|
|
32
|
+
```/usr/local/MATLAB/R2026a```
|
|
33
33
|
|
|
34
34
|
When MATLAB is not installed in the default location, the bin/*architecture* directory within the MATLAB root directory must be added to the environment variable LD_LIBRARY_PATH. The path can be added to the environment variable within the shell startup configuration file (for example, .bashrc for bash shell or .tcshrc for tcsh).
|
|
35
35
|
|
|
@@ -46,14 +46,14 @@ setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:<matlabroot>/bin/glnxa64
|
|
|
46
46
|
MATLAB Engine API for Python can be installed directly from the Python Package Index.
|
|
47
47
|
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
|
|
48
48
|
```bash
|
|
49
|
-
$ python -m pip install matlabengine==
|
|
49
|
+
$ python -m pip install matlabengine==26.1.1
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
### macOS
|
|
53
53
|
Prior to installation, check the default install location of MATLAB by calling ```matlabroot``` in a MATLAB Command Window. By default, macOS installs MATLAB at:<br>
|
|
54
54
|
|
|
55
55
|
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
|
|
56
|
-
```/Applications/
|
|
56
|
+
```/Applications/MATLAB_R2026a.app```
|
|
57
57
|
|
|
58
58
|
When MATLAB is not installed in the default location, the bin/*architecture* directory within the MATLAB root directory must be added to the environment variable DYLD_LIBRARY_PATH. The path can be added to the environment variable within the shell startup configuration file (for example, .bashrc for bash shell or .tcshrc for tcsh).
|
|
59
59
|
|
|
@@ -70,7 +70,7 @@ setenv DYLD_LIBRARY_PATH ${DYLD_LIBRARY_PATH}:<matlabroot>/bin/maci64
|
|
|
70
70
|
MATLAB Engine API for Python can be installed directly from the Python Package Index.
|
|
71
71
|
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
|
|
72
72
|
```bash
|
|
73
|
-
$ python -m pip install matlabengine==
|
|
73
|
+
$ python -m pip install matlabengine==26.1.1
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
---
|
|
@@ -21,13 +21,13 @@ class _MatlabFinder(build_py):
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
# MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
|
|
24
|
-
MATLAB_REL = '
|
|
24
|
+
MATLAB_REL = 'R2026a'
|
|
25
25
|
|
|
26
26
|
# MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
|
|
27
|
-
MATLAB_VER = '
|
|
27
|
+
MATLAB_VER = '26.1.1'
|
|
28
28
|
|
|
29
29
|
# MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
|
|
30
|
-
SUPPORTED_PYTHON_VERSIONS = set(['3.9', '3.10', '3.11', '3.12'])
|
|
30
|
+
SUPPORTED_PYTHON_VERSIONS = set(['3.9', '3.10', '3.11', '3.12', '3.13'])
|
|
31
31
|
|
|
32
32
|
# MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
|
|
33
33
|
VER_TO_REL = {
|
|
@@ -41,7 +41,8 @@ class _MatlabFinder(build_py):
|
|
|
41
41
|
"24.1": "R2024a",
|
|
42
42
|
"24.2": "R2024b",
|
|
43
43
|
"25.1": "R2025a",
|
|
44
|
-
"25.2": "R2025b"
|
|
44
|
+
"25.2": "R2025b",
|
|
45
|
+
"26.1": "R2026a"
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
DEFAULT_INSTALLS = {
|
|
@@ -419,7 +420,7 @@ if __name__ == '__main__':
|
|
|
419
420
|
setup(
|
|
420
421
|
name="matlabengine",
|
|
421
422
|
# MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
|
|
422
|
-
version="
|
|
423
|
+
version="26.1.1",
|
|
423
424
|
description='A module to call MATLAB from Python',
|
|
424
425
|
author='MathWorks',
|
|
425
426
|
license="LICENSE.txt, located in this repository",
|
|
@@ -447,8 +448,9 @@ if __name__ == '__main__':
|
|
|
447
448
|
"Programming Language :: Python :: 3.9",
|
|
448
449
|
"Programming Language :: Python :: 3.10",
|
|
449
450
|
"Programming Language :: Python :: 3.11",
|
|
450
|
-
"Programming Language :: Python :: 3.12"
|
|
451
|
+
"Programming Language :: Python :: 3.12",
|
|
452
|
+
"Programming Language :: Python :: 3.13"
|
|
451
453
|
],
|
|
452
454
|
# MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
|
|
453
|
-
python_requires=">=3.9, <3.
|
|
455
|
+
python_requires=">=3.9, <3.14"
|
|
454
456
|
)
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
# Copyright 2021-2025 MathWorks, Inc.
|
|
2
|
+
"""
|
|
3
|
+
Array interface between Python and MATLAB
|
|
4
|
+
|
|
5
|
+
This package defines classes and exceptions that create and manage
|
|
6
|
+
multidimensional arrays in Python that are passed between Python and MATLAB.
|
|
7
|
+
|
|
8
|
+
Modules
|
|
9
|
+
-------
|
|
10
|
+
* mcpyarray - type-specific multidimensional array classes for working
|
|
11
|
+
with MATLAB, implemented in C++
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import os
|
|
15
|
+
import platform
|
|
16
|
+
import sys
|
|
17
|
+
import warnings
|
|
18
|
+
from pkgutil import extend_path
|
|
19
|
+
__path__ = extend_path(__path__, '__name__')
|
|
20
|
+
|
|
21
|
+
_package_folder = os.path.dirname(os.path.realpath(__file__))
|
|
22
|
+
sys.path.append(_package_folder)
|
|
23
|
+
|
|
24
|
+
# This code allows us to put the proper extern/bin/<arch> directory on the Python path
|
|
25
|
+
# to avoid a situation in which some shared libraries are loaded from a MATLAB while
|
|
26
|
+
# others are loaded from a runtime. The first directory on the path that contains
|
|
27
|
+
# the string "bin/<arch>" (with the proper directory separator)
|
|
28
|
+
# will be checked. If it is "extern/bin/<arch>", it will be used as the
|
|
29
|
+
# extern/bin/<arch> directory. Otherwise, we'll go up two directories and down
|
|
30
|
+
# to extern/bin/<arch>.
|
|
31
|
+
class _MiniPathInitializer(object):
|
|
32
|
+
PLATFORM_DICT = {'Windows': 'PATH', 'Linux': 'LD_LIBRARY_PATH', 'Darwin': 'DYLD_LIBRARY_PATH'}
|
|
33
|
+
|
|
34
|
+
def __init__(self):
|
|
35
|
+
self.arch = ''
|
|
36
|
+
self.extern_bin_dir = ''
|
|
37
|
+
self.path_var = ''
|
|
38
|
+
self.system = ''
|
|
39
|
+
|
|
40
|
+
def get_platform_info(self):
|
|
41
|
+
"""Ask Python for the platform and architecture."""
|
|
42
|
+
# This will return 'Windows', 'Linux', or 'Darwin' (for Mac).
|
|
43
|
+
self.system = platform.system()
|
|
44
|
+
if not self.system in _MiniPathInitializer.PLATFORM_DICT:
|
|
45
|
+
raise RuntimeError('{0} is not a supported platform.'.format(self.system))
|
|
46
|
+
else:
|
|
47
|
+
# path_var is the OS-dependent name of the path variable ('PATH', 'LD_LIBRARY_PATH', "DYLD_LIBRARY_PATH')
|
|
48
|
+
self.path_var = _MiniPathInitializer.PLATFORM_DICT[self.system]
|
|
49
|
+
|
|
50
|
+
if self.system == 'Windows':
|
|
51
|
+
self.arch = 'win64'
|
|
52
|
+
elif self.system == 'Linux':
|
|
53
|
+
self.arch = 'glnxa64'
|
|
54
|
+
elif self.system == 'Darwin':
|
|
55
|
+
# determine ARM or Intel Mac machine
|
|
56
|
+
if platform.mac_ver()[-1] == 'arm64':
|
|
57
|
+
self.arch = 'maca64'
|
|
58
|
+
else:
|
|
59
|
+
self.arch = 'maci64'
|
|
60
|
+
else:
|
|
61
|
+
raise RuntimeError('Operating system {0} is not supported.'.format(self.system))
|
|
62
|
+
|
|
63
|
+
def get_extern_bin_from_path_element_ending_with_runtime_arch(self, dir_found):
|
|
64
|
+
extern_bin_dir = ''
|
|
65
|
+
path_components = dir_found.split(os.sep)
|
|
66
|
+
|
|
67
|
+
if path_components[-1]:
|
|
68
|
+
last_path_component = path_components[-1]
|
|
69
|
+
possible_extern = -3
|
|
70
|
+
else:
|
|
71
|
+
# The directory name ended with a slash, so the last item in the list was an empty string. Go back one more.
|
|
72
|
+
last_path_component = path_components[-2]
|
|
73
|
+
possible_extern = -4
|
|
74
|
+
|
|
75
|
+
if last_path_component != self.arch:
|
|
76
|
+
output_str = ''.join(('To call deployed MATLAB code on a {0} machine, you must run a {0} version of Python, ',
|
|
77
|
+
'and your {1} variable must contain an element pointing to "<MR>{2}runtime{2}{0}", ',
|
|
78
|
+
'where "<MR>" indicates a MATLAB or MATLAB Runtime root. ',
|
|
79
|
+
'Instead, the value found was as follows: {3}'))
|
|
80
|
+
raise RuntimeError(output_str.format(self.arch, self.path_var, os.sep, dir_found))
|
|
81
|
+
|
|
82
|
+
if (len(path_components) + possible_extern) >= 0 and path_components[possible_extern] == 'extern':
|
|
83
|
+
extern_bin_dir = dir_found
|
|
84
|
+
else:
|
|
85
|
+
mroot = os.path.dirname(os.path.dirname(os.path.normpath(dir_found)))
|
|
86
|
+
extern_bin_dir = os.path.join(mroot, 'extern', 'bin', self.arch)
|
|
87
|
+
|
|
88
|
+
return extern_bin_dir
|
|
89
|
+
|
|
90
|
+
def get_extern_bin_from_py_sys_path(self):
|
|
91
|
+
#Retrieve Python sys.path as a single string, and search for the substring "extern/bin/<arch>" (with
|
|
92
|
+
#the proper directory separator). If it's already present, assume it's the one we want.
|
|
93
|
+
substr_to_find = os.path.join('extern', 'bin', self.arch)
|
|
94
|
+
for item in sys.path:
|
|
95
|
+
if item.find(substr_to_find) != -1:
|
|
96
|
+
return item
|
|
97
|
+
return ''
|
|
98
|
+
|
|
99
|
+
def put_extern_bin_on_py_sys_path(self):
|
|
100
|
+
"""
|
|
101
|
+
Look through the system path for the first directory ending with "runtime/<arch>" or
|
|
102
|
+
"bin/<arch>" (with/without trailing slash). Use this to construct a new path ending
|
|
103
|
+
with "extern/bin/<arch>".
|
|
104
|
+
"""
|
|
105
|
+
|
|
106
|
+
path_elements = []
|
|
107
|
+
path_elements_orig = ''
|
|
108
|
+
if self.path_var in os.environ:
|
|
109
|
+
path_elements_orig = os.environ[self.path_var]
|
|
110
|
+
# On Windows, some elements of the path may use forward slashes while others use backslashes.
|
|
111
|
+
# Make them all backslashes.
|
|
112
|
+
if self.system == 'Windows':
|
|
113
|
+
path_elements_orig = path_elements_orig.replace('/', '\\')
|
|
114
|
+
path_elements = path_elements_orig.split(os.pathsep)
|
|
115
|
+
if not path_elements:
|
|
116
|
+
if self.system == 'Darwin':
|
|
117
|
+
raise RuntimeError('On the Mac, you must run mwpython rather than python ' +
|
|
118
|
+
'to start a session or script that imports your package. ' +
|
|
119
|
+
'For more details, execute "mwpython -help" or see the package documentation.')
|
|
120
|
+
else:
|
|
121
|
+
raise RuntimeError('On {0}, you must set the environment variable "{1}" to a non-empty string. {2}'.format(
|
|
122
|
+
self.system, self.path_var,
|
|
123
|
+
'For more details, see the package documentation.'))
|
|
124
|
+
|
|
125
|
+
dir_to_search = os.path.join('runtime', self.arch)
|
|
126
|
+
trailing_substrings_to_find = [dir_to_search, dir_to_search + os.sep]
|
|
127
|
+
|
|
128
|
+
extern_bin_dir = ''
|
|
129
|
+
for elem in path_elements:
|
|
130
|
+
for trailing_substring in trailing_substrings_to_find:
|
|
131
|
+
if elem.endswith(trailing_substring):
|
|
132
|
+
extern_bin_dir = self.get_extern_bin_from_path_element_ending_with_runtime_arch(elem)
|
|
133
|
+
if extern_bin_dir:
|
|
134
|
+
break
|
|
135
|
+
|
|
136
|
+
if not extern_bin_dir:
|
|
137
|
+
format_str = 'Could not find an appropriate directory in {0} from which to read binaries. Details::\n{1}'
|
|
138
|
+
raise RuntimeError(format_str.format(self.path_var, path_elements_orig))
|
|
139
|
+
|
|
140
|
+
if not os.path.isdir(extern_bin_dir):
|
|
141
|
+
raise RuntimeError('Could not find the directory {0}'.format(extern_bin_dir))
|
|
142
|
+
self.extern_bin_dir = extern_bin_dir
|
|
143
|
+
sys.path.insert(0, self.extern_bin_dir)
|
|
144
|
+
|
|
145
|
+
def get_python_version():
|
|
146
|
+
# UPDATE_IF_PYTHON_VERSION_ADDED_OR_REMOVED : search for this string in codebase
|
|
147
|
+
# when support for a Python version must be added or removed
|
|
148
|
+
_supported_versions = ['3_9', '3_10', '3_11', '3_12', '3_13']
|
|
149
|
+
_ver = sys.version_info
|
|
150
|
+
_version = '{0}_{1}'.format(_ver[0], _ver[1])
|
|
151
|
+
newer_than_supported = _ver[1] > 12
|
|
152
|
+
|
|
153
|
+
_PYTHONVERSION = None
|
|
154
|
+
|
|
155
|
+
if _version in _supported_versions:
|
|
156
|
+
_PYTHONVERSION = _version
|
|
157
|
+
elif newer_than_supported:
|
|
158
|
+
warnings.warn('Python versions 3.9, 3.10, 3.11, 3.12, and 3.13 are supported, but your version of Python is %s' % _version)
|
|
159
|
+
_PYTHONVERSION = _version
|
|
160
|
+
else:
|
|
161
|
+
raise EnvironmentError("Python %s is not supported." % _version)
|
|
162
|
+
|
|
163
|
+
return _PYTHONVERSION
|
|
164
|
+
|
|
165
|
+
def get_arch_filename():
|
|
166
|
+
_module_folder = os.path.dirname(os.path.realpath(__file__))
|
|
167
|
+
_arch_filename = os.path.join(_module_folder, 'engine', '_arch.txt')
|
|
168
|
+
return _arch_filename
|
|
169
|
+
|
|
170
|
+
def add_dll_dir_on_win(arch, dir_to_add):
|
|
171
|
+
if arch == 'win64':
|
|
172
|
+
if not dir_to_add:
|
|
173
|
+
raise RuntimeError('Cannot add empty DLL directory')
|
|
174
|
+
os.add_dll_directory(dir_to_add)
|
|
175
|
+
|
|
176
|
+
def get_dirs_from_arch_file_without_import():
|
|
177
|
+
_PYTHONVERSION = get_python_version()
|
|
178
|
+
_arch_filename = get_arch_filename()
|
|
179
|
+
firstExceptionMessage = ''
|
|
180
|
+
if not os.path.isfile(_arch_filename):
|
|
181
|
+
return False
|
|
182
|
+
|
|
183
|
+
try:
|
|
184
|
+
_arch_file = open(_arch_filename,'r')
|
|
185
|
+
_lines = _arch_file.readlines()
|
|
186
|
+
[_arch, _bin_dir,_engine_dir, _extern_bin_dir] = [x.rstrip() for x in _lines if x.rstrip() != ""]
|
|
187
|
+
_arch_file.close()
|
|
188
|
+
sys.path.insert(0,_engine_dir)
|
|
189
|
+
sys.path.insert(0,_extern_bin_dir)
|
|
190
|
+
add_dll_dir_on_win(_arch, _bin_dir)
|
|
191
|
+
except Exception as exc:
|
|
192
|
+
firstExceptionMessage = 'Please contact MathWorks Technical Support for assistance:\nDetails: {}'.format(
|
|
193
|
+
exc)
|
|
194
|
+
|
|
195
|
+
if firstExceptionMessage:
|
|
196
|
+
return False
|
|
197
|
+
else:
|
|
198
|
+
return True
|
|
199
|
+
|
|
200
|
+
def subdir_exists(folder_name, subfolder_name):
|
|
201
|
+
return os.path.exists(os.path.join(folder_name, subfolder_name))
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
_mpi = _MiniPathInitializer()
|
|
205
|
+
_mpi.get_platform_info()
|
|
206
|
+
extern_bin_dir = ''
|
|
207
|
+
if subdir_exists(_package_folder, 'engine'):
|
|
208
|
+
success = get_dirs_from_arch_file_without_import()
|
|
209
|
+
if not success:
|
|
210
|
+
if 'MWE_INSTALL' in os.environ:
|
|
211
|
+
mroot_from_env_var = os.environ['MWE_INSTALL']
|
|
212
|
+
extern_bin_dir = os.path.join(mroot_from_env_var, 'extern', 'bin', _mpi.arch)
|
|
213
|
+
if not os.path.exists(extern_bin_dir):
|
|
214
|
+
raise RuntimeError('directory {} does not exist'.format(extern_bin_dir))
|
|
215
|
+
sys.path.insert(0, extern_bin_dir)
|
|
216
|
+
bin_dir = extern_bin_dir.replace('extern' + os.sep + 'bin', 'bin')
|
|
217
|
+
add_dll_dir_on_win(_mpi.arch, bin_dir)
|
|
218
|
+
else:
|
|
219
|
+
raise RuntimeError('unable to read {}'.format(get_arch_filename()))
|
|
220
|
+
else:
|
|
221
|
+
extern_bin_dir = _mpi.get_extern_bin_from_py_sys_path()
|
|
222
|
+
if not extern_bin_dir:
|
|
223
|
+
_mpi.put_extern_bin_on_py_sys_path()
|
|
224
|
+
extern_bin_dir = _mpi.extern_bin_dir
|
|
225
|
+
|
|
226
|
+
bin_dir = extern_bin_dir.replace('extern' + os.sep + 'bin', 'bin')
|
|
227
|
+
add_dll_dir_on_win(_mpi.arch, bin_dir)
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
from matlabmultidimarrayforpython import double, single, uint8, int8, uint16, \
|
|
231
|
+
int16, uint32, int32, uint64, int64, logical, ShapeError, SizeError
|
|
232
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#Copyright 2014-
|
|
1
|
+
#Copyright 2014-2025 MathWorks, Inc.
|
|
2
2
|
|
|
3
3
|
"""
|
|
4
4
|
The MATLAB Engine enables you to call any MATLAB statement either synchronously
|
|
@@ -30,10 +30,10 @@ import warnings
|
|
|
30
30
|
# UPDATE_IF_PYTHON_VERSION_ADDED_OR_REMOVED : search for this string in codebase
|
|
31
31
|
# when support for a Python version must be added or removed
|
|
32
32
|
|
|
33
|
-
_supported_versions = ['3_9', '3_10', '3_11', '3_12']
|
|
33
|
+
_supported_versions = ['3_9', '3_10', '3_11', '3_12', '3_13']
|
|
34
34
|
_ver = sys.version_info
|
|
35
35
|
_version = '{0}_{1}'.format(_ver[0], _ver[1])
|
|
36
|
-
_newer_than_supported = _ver[1] >
|
|
36
|
+
_newer_than_supported = _ver[1] > 13
|
|
37
37
|
|
|
38
38
|
_PYTHONVERSION = None
|
|
39
39
|
|
|
@@ -41,12 +41,12 @@ if _version in _supported_versions:
|
|
|
41
41
|
_PYTHONVERSION = _version
|
|
42
42
|
elif _newer_than_supported:
|
|
43
43
|
warnings.warn('MATLAB Engine for Python supports Python version'
|
|
44
|
-
' 3.9, 3.10, 3.11, and 3.
|
|
44
|
+
' 3.9, 3.10, 3.11, 3.12, and 3.13, but your version of Python '
|
|
45
45
|
'is %s' % _version)
|
|
46
|
-
_PYTHONVERSION = _version
|
|
46
|
+
_PYTHONVERSION = _version
|
|
47
47
|
else:
|
|
48
48
|
raise EnvironmentError('MATLAB Engine for Python supports Python version'
|
|
49
|
-
' 3.9, 3.10, 3.11, and 3.
|
|
49
|
+
' 3.9, 3.10, 3.11, 3.12, and 3.13, but your version of Python '
|
|
50
50
|
'is %s' % _version)
|
|
51
51
|
|
|
52
52
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#Copyright 2014-
|
|
1
|
+
#Copyright 2014-2025 MathWorks, Inc.
|
|
2
2
|
|
|
3
3
|
"""
|
|
4
4
|
MatlabEngine: The class name of MATLAB Engine. You can call MATLAB software as
|
|
@@ -126,11 +126,15 @@ class MatlabWorkSpace(object):
|
|
|
126
126
|
|
|
127
127
|
_method=MatlabFunc(self._engine(), "assignin")
|
|
128
128
|
return _method("base", attr, value, nargout=0)
|
|
129
|
-
|
|
129
|
+
|
|
130
|
+
def __str__(self):
|
|
131
|
+
return self.__repr__()
|
|
132
|
+
|
|
130
133
|
def __repr__(self):
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
# 'evalc' evaluates a MATLAB expression, redirecting stdout to a variable.
|
|
135
|
+
# Here, we use it to redirect the stdout of 'whos' to a string.
|
|
136
|
+
_evalcMethodHandle = MatlabFunc(self._engine(), "evalc")
|
|
137
|
+
return _evalcMethodHandle('whos')
|
|
134
138
|
|
|
135
139
|
def __setattr__(self, kw, value):
|
|
136
140
|
raise AttributeError(pythonengine.getMessage('AttrCannotBeAddedToMWS'))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: matlabengine
|
|
3
|
-
Version:
|
|
3
|
+
Version: 26.1.1
|
|
4
4
|
Summary: A module to call MATLAB from Python
|
|
5
5
|
Home-page: https://github.com/mathworks/matlab-engine-for-python/
|
|
6
6
|
Author: MathWorks
|
|
@@ -16,7 +16,8 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
-
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Requires-Python: >=3.9, <3.14
|
|
20
21
|
Description-Content-Type: text/markdown
|
|
21
22
|
License-File: LICENSE.txt
|
|
22
23
|
|
|
@@ -28,11 +29,11 @@ The MATLAB® Engine API for Python® provides a package to integrate MATLA
|
|
|
28
29
|
## Requirements
|
|
29
30
|
### Required MathWorks Products
|
|
30
31
|
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
|
|
31
|
-
* MATLAB release
|
|
32
|
+
* MATLAB release R2026a
|
|
32
33
|
|
|
33
34
|
### Required 3rd Party Products
|
|
34
35
|
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
|
|
35
|
-
* Python 3.9, 3.10, 3.11, or 3.
|
|
36
|
+
* Python 3.9, 3.10, 3.11, 3.12, or 3.13
|
|
36
37
|
* Supported Python versions by MATLAB release can be found [here](https://www.mathworks.com/support/requirements/python-compatibility.html).
|
|
37
38
|
|
|
38
39
|
---
|
|
@@ -43,7 +44,7 @@ The MATLAB® Engine API for Python® provides a package to integrate MATLA
|
|
|
43
44
|
MATLAB Engine API for Python can be installed directly from the Python Package Index.
|
|
44
45
|
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
|
|
45
46
|
```bash
|
|
46
|
-
$ python -m pip install matlabengine==
|
|
47
|
+
$ python -m pip install matlabengine==26.1.1
|
|
47
48
|
```
|
|
48
49
|
|
|
49
50
|
|
|
@@ -51,7 +52,7 @@ $ python -m pip install matlabengine==25.2.2
|
|
|
51
52
|
### Linux®
|
|
52
53
|
Prior to installation, check the default install location of MATLAB by calling ```matlabroot``` in a MATLAB Command Window. By default, Linux installs MATLAB at:<br>
|
|
53
54
|
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
|
|
54
|
-
```/usr/local/MATLAB/
|
|
55
|
+
```/usr/local/MATLAB/R2026a```
|
|
55
56
|
|
|
56
57
|
When MATLAB is not installed in the default location, the bin/*architecture* directory within the MATLAB root directory must be added to the environment variable LD_LIBRARY_PATH. The path can be added to the environment variable within the shell startup configuration file (for example, .bashrc for bash shell or .tcshrc for tcsh).
|
|
57
58
|
|
|
@@ -68,14 +69,14 @@ setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:<matlabroot>/bin/glnxa64
|
|
|
68
69
|
MATLAB Engine API for Python can be installed directly from the Python Package Index.
|
|
69
70
|
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
|
|
70
71
|
```bash
|
|
71
|
-
$ python -m pip install matlabengine==
|
|
72
|
+
$ python -m pip install matlabengine==26.1.1
|
|
72
73
|
```
|
|
73
74
|
|
|
74
75
|
### macOS
|
|
75
76
|
Prior to installation, check the default install location of MATLAB by calling ```matlabroot``` in a MATLAB Command Window. By default, macOS installs MATLAB at:<br>
|
|
76
77
|
|
|
77
78
|
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
|
|
78
|
-
```/Applications/
|
|
79
|
+
```/Applications/MATLAB_R2026a.app```
|
|
79
80
|
|
|
80
81
|
When MATLAB is not installed in the default location, the bin/*architecture* directory within the MATLAB root directory must be added to the environment variable DYLD_LIBRARY_PATH. The path can be added to the environment variable within the shell startup configuration file (for example, .bashrc for bash shell or .tcshrc for tcsh).
|
|
81
82
|
|
|
@@ -92,7 +93,7 @@ setenv DYLD_LIBRARY_PATH ${DYLD_LIBRARY_PATH}:<matlabroot>/bin/maci64
|
|
|
92
93
|
MATLAB Engine API for Python can be installed directly from the Python Package Index.
|
|
93
94
|
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
|
|
94
95
|
```bash
|
|
95
|
-
$ python -m pip install matlabengine==
|
|
96
|
+
$ python -m pip install matlabengine==26.1.1
|
|
96
97
|
```
|
|
97
98
|
|
|
98
99
|
---
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# Copyright 2024 MathWorks, Inc.
|
|
2
|
-
|
|
3
|
-
import os
|
|
4
|
-
import platform
|
|
5
|
-
import sys
|
|
6
|
-
import pkgutil
|
|
7
|
-
|
|
8
|
-
__path__ = pkgutil.extend_path(__path__, __name__)
|
|
9
|
-
package_folder = os.path.dirname(os.path.realpath(__file__))
|
|
10
|
-
sys.path.append(package_folder)
|
|
11
|
-
|
|
12
|
-
def add_dirs_to_path(bin_dir, engine_dir, extern_dir):
|
|
13
|
-
"""
|
|
14
|
-
Adds MATLAB engine and extern/bin directories to sys.path.
|
|
15
|
-
"""
|
|
16
|
-
path = 'PATH'
|
|
17
|
-
|
|
18
|
-
if not os.path.isdir(engine_dir):
|
|
19
|
-
raise RuntimeError("Could not find directory: {0}".format(engine_dir))
|
|
20
|
-
|
|
21
|
-
if not os.path.isdir(extern_dir):
|
|
22
|
-
raise RuntimeError("Could not find directory: {0}".format(extern_dir))
|
|
23
|
-
|
|
24
|
-
if platform.system() == 'Windows':
|
|
25
|
-
if not os.path.isdir(bin_dir):
|
|
26
|
-
raise RuntimeError("Could not find directory: {0}".format(bin_dir))
|
|
27
|
-
if path in os.environ:
|
|
28
|
-
paths = os.environ[path]
|
|
29
|
-
os.environ[path] = bin_dir + os.pathsep + paths
|
|
30
|
-
else:
|
|
31
|
-
os.environ[path] = bin_dir
|
|
32
|
-
if sys.version_info.major >= 3 and sys.version_info.minor >= 8:
|
|
33
|
-
os.add_dll_directory(bin_dir)
|
|
34
|
-
|
|
35
|
-
sys.path.insert(0, engine_dir)
|
|
36
|
-
sys.path.insert(0, extern_dir)
|
|
37
|
-
|
|
38
|
-
arch_file = os.path.join(package_folder, 'engine', '_arch.txt')
|
|
39
|
-
if not os.path.isfile(arch_file):
|
|
40
|
-
raise RuntimeError("The MATLAB Engine for Python install is corrupted. Please try to re-install.")
|
|
41
|
-
|
|
42
|
-
with open(arch_file, 'r') as root:
|
|
43
|
-
[arch, bin_folder, engine_folder, extern_bin] = [line.strip() for line in root.readlines()]
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
add_dirs_to_path(bin_folder, engine_folder, extern_bin)
|
|
47
|
-
|
|
48
|
-
from matlabmultidimarrayforpython import double, single, uint8, int8, uint16, \
|
|
49
|
-
int16, uint32, int32, uint64, int64, logical, ShapeError, SizeError
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|