jaderberg / python-matlab-bridge

A simple interface to allow Python to call MATLAB functions.
95 stars 34 forks source link

How to run this on Windows? #1

Open xiaoyuejin opened 12 years ago

xiaoyuejin commented 12 years ago

It seems this package doesn't run on windows?

xiaoyuejin commented 12 years ago

Wow this is prompt reply!

From what I see, only slight changes are necessary for the bridge to work on windows. Here are the error messages:

from pymatbridge import Matlab mlab=Matlab(matlab='/Applications/MATLAB_R2011b.app/bin/matlab') mlab.start() Starting MATLAB Traceback (most recent call last): File "", line 1, in File "C:\Python27\lib\site-packages\pymatbridgeinit.py", line 37, in start self.server_process.start() File "C:\Python27\lib\multiprocessing\process.py", line 130, in start self._popen = Popen(self) File "C:\Python27\lib\multiprocessing\forking.py", line 271, in init dump(process_obj, to_child, HIGHEST_PROTOCOL) File "C:\Python27\lib\multiprocessing\forking.py", line 193, in dump ForkingPickler(file, protocol).dump(obj) File "C:\Python27\lib\pickle.py", line 224, in dump self.save(obj) File "C:\Python27\lib\pickle.py", line 331, in save self.save_reduce(obj=obj, *rv) File "C:\Python27\lib\pickle.py", line 419, in save_reduce save(state) File "C:\Python27\lib\pickle.py", line 286, in save f(self, obj) # Call unbound method with explicit self File "C:\Python27\lib\pickle.py", line 649, in save_dict self._batch_setitems(obj.iteritems()) File "C:\Python27\lib\pickle.py", line 681, in _batch_setitems save(v) File "C:\Python27\lib\pickle.py", line 286, in save f(self, obj) # Call unbound method with explicit self File "C:\Python27\lib\pickle.py", line 748, in save_global (obj, module, name)) pickle.PicklingError: Can't pickle <function _run_matlab_server at 0x046564F0>: it's not found as pymatbridge._run_matlab_server

This is quite obvious, because in windows the file structure is different, and Matlab does not locate in '/Applications/MATLAB_R2011b.app/bin/matlab'.

The good thing is, I can manually start the web server using the .m file in the package. Then using mlab.running I get a True return. So, basically both Python and Matlab are working (independent of platform), while the only problem is a new bridge code for windows.

Actually I like this idea of using Matlab as a webserver. I am using a package of the same spirit. Good luck!

ghost commented 10 years ago

Has development on this stopped? Is there a better solution now for running MATLAB once and making multiple calls from python? I too need a windows solution.