arokem / python-matlab-bridge

A simple Python => MATLAB(R) interface and a matlab_magic for ipython
BSD 2-Clause "Simplified" License
332 stars 97 forks source link

Fail to start on RHEL (using the Canopy python distribution) #221

Open yuvval opened 8 years ago

yuvval commented 8 years ago

Hi,

I've installed pymatbridge, while using the Canopy python distribution. I followed the instructions on how to install pip packages on canopy (from here: https://support.enthought.com/hc/en-us/articles/204469690-Installing-packages-into-Canopy-User-Python-from-the-OS-command-line).

Then, running the following on the ipython notebook, fails to start:

from pymatbridge import Matlab
mlab = Matlab() # I also tried writing the explicit path/matlab 

mlab.start()

and results with:

Starting MATLAB on ZMQ socket ipc:///tmp/pymatbridge-65d47756-5dfc-4664-a666-233d18c23393
Send 'exit' command to kill the server
............................................................MATLAB session timed out after 60 seconds

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-2-da824633164b> in <module>()
----> 1 mlab.start()
      2 

~/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pymatbridge/pymatbridge.pyc in start(self)
    223             return self
    224         else:
--> 225             raise ValueError("%s failed to start" % self._program_name())
    226 
    227     def _response(self, **kwargs):

ValueError: MATLAB failed to start

EDIT: Looking on the terminal console. Looks like ipython generates the following errors:

Invalid MEX-file
'~/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pymatbridge/matlab/messenger.mexa64':
/lib64/libc.so.6: version `GLIBC_2.17' not found (required by
~/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pymatbridge/matlab/messenger.mexa64)

Thanks a lot for your assistance!

arokem commented 8 years ago

Do you have pyzmq installed (can you "import zmq"?)?

yuvval commented 8 years ago

Yes, import zmq is successful.

Thanks for the quick reply.

On Mon, Sep 21, 2015 at 3:20 PM, Ariel Rokem notifications@github.com wrote:

Do you have pyzmq installed (can you "import zmq"?)?

— Reply to this email directly or view it on GitHub https://github.com/arokem/python-matlab-bridge/issues/221#issuecomment-141955089 .

arokem commented 8 years ago

What do you get when you type the following?

zmq.zmq_version()
yuvval commented 8 years ago
'4.0.5'
arokem commented 8 years ago

I don't know. You might need to build the messenger that passes information back and forth for your platform. Given that you are on linux, that shouldn't be too hard, though: download the source code from github, and run python make.py {matlab, octave} (whichever you are using), in the pymatbridge/messenger directory. Then you can install the whole thing by running python setup.py install in the top-level directory.

yuvval commented 8 years ago

Thanks.

I've got errors while running make.py. Any Idea?

Building messenger.mexa64...
/private/uni/packages/matlab/R2014b/bin/mex -O -L. -I. -lzmq ./src/messenger.c
~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:5:17: error: zmq.h: No such file or directory
~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c: In function ‘initialize’:
~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:18: warning: assignment makes pointer from integer without a cast
~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:19: error: ‘ZMQ_REP’ undeclared (first use in this function)
~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:19: error: (Each undeclared identifier is reported only once
~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:19: error: for each function it appears in.)
~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c: In function ‘mexFunction’:
~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:102: error: ‘zmq_pollitem_t’ undeclared (first use in this function)
~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:102: error: expected ‘;’ before ‘polls’
~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:107: error: ‘polls’ undeclared (first use in this function)

Traceback (most recent call last):
  File "make.py", line 285, in <module>
    build_matlab(static=args.static)
  File "make.py", line 270, in build_matlab
    do_build(make_cmd, 'messenger.%s' % extension)
  File "make.py", line 178, in do_build
    subprocess.check_output(shlex.split(make_cmd), shell=use_shell)
  File "~/Canopy/appdata/canopy-1.5.5.3123.rh5-x86_64/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['    /private/uni/packages/matlab/R2014b/bin/mex', '-O', '-L.', '-I.', '-lzmq', './src/messenger.c']' returned non-zero exit status 255
arokem commented 8 years ago

Oh boy! It looks like your compiler is not finding the zmq header anywhere. Could you try to yum install zeromq-devel and run that again?

On Mon, Sep 21, 2015 at 8:26 AM, yuvval notifications@github.com wrote:

Thanks.

I've got errors while running make.py. Any Idea?

Building messenger.mexa64... /private/uni/packages/matlab/R2014b/bin/mex -O -L. -I. -lzmq ./src/messenger.c ~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:5:17: error: zmq.h: No such file or directory ~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c: In function ‘initialize’: ~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:18: warning: assignment makes pointer from integer without a cast ~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:19: error: ‘ZMQ_REP’ undeclared (first use in this function) ~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:19: error: (Each undeclared identifier is reported only once ~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:19: error: for each function it appears in.) ~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c: In function ‘mexFunction’: ~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:102: error: ‘zmq_pollitem_t’ undeclared (first use in this function) ~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:102: error: expected ‘;’ before ‘polls’ ~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:107: error: ‘polls’ undeclared (first use in this function)

Traceback (most recent call last): File "make.py", line 285, in build_matlab(static=args.static) File "make.py", line 270, in build_matlab do_build(make_cmd, 'messenger.%s' % extension) File "make.py", line 178, in do_build subprocess.check_output(shlex.split(make_cmd), shell=use_shell) File "~/Canopy/appdata/canopy-1.5.5.3123.rh5-x86_64/lib/python2.7/subprocess.py", line 573, in check_output raise CalledProcessError(retcode, cmd, output=output) subprocess.CalledProcessError: Command '[' /private/uni/packages/matlab/R2014b/bin/mex', '-O', '-L.', '-I.', '-lzmq', './src/messenger.c']' returned non-zero exit status 255

— Reply to this email directly or view it on GitHub https://github.com/arokem/python-matlab-bridge/issues/221#issuecomment-142014933 .

yuvval commented 8 years ago

I can't because I don't have root permissions :/

On Mon, Sep 21, 2015 at 6:33 PM, Ariel Rokem notifications@github.com wrote:

Oh boy! It looks like your compiler is not finding the zmq header anywhere. Could you try to yum install zeromq-devel and run that again?

On Mon, Sep 21, 2015 at 8:26 AM, yuvval notifications@github.com wrote:

Thanks.

I've got errors while running make.py. Any Idea?

Building messenger.mexa64... /private/uni/packages/matlab/R2014b/bin/mex -O -L. -I. -lzmq ./src/messenger.c

~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:5:17: error: zmq.h: No such file or directory

~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c: In function ‘initialize’:

~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:18: warning: assignment makes pointer from integer without a cast

~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:19: error: ‘ZMQ_REP’ undeclared (first use in this function)

~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:19: error: (Each undeclared identifier is reported only once

~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:19: error: for each function it appears in.)

~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c: In function ‘mexFunction’:

~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:102: error: ‘zmq_pollitem_t’ undeclared (first use in this function)

~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:102: error: expected ‘;’ before ‘polls’

~/Downloads/arokem-python-matlab-bridge-641d5e7/pymatbridge/messenger/./src/messenger.c:107: error: ‘polls’ undeclared (first use in this function)

Traceback (most recent call last): File "make.py", line 285, in build_matlab(static=args.static) File "make.py", line 270, in build_matlab do_build(make_cmd, 'messenger.%s' % extension) File "make.py", line 178, in do_build subprocess.check_output(shlex.split(make_cmd), shell=use_shell) File "~/Canopy/appdata/canopy-1.5.5.3123.rh5-x86_64/lib/python2.7/subprocess.py", line 573, in check_output raise CalledProcessError(retcode, cmd, output=output) subprocess.CalledProcessError: Command '[' /private/uni/packages/matlab/R2014b/bin/mex', '-O', '-L.', '-I.', '-lzmq', './src/messenger.c']' returned non-zero exit status 255

— Reply to this email directly or view it on GitHub < https://github.com/arokem/python-matlab-bridge/issues/221#issuecomment-142014933

.

— Reply to this email directly or view it on GitHub https://github.com/arokem/python-matlab-bridge/issues/221#issuecomment-142016574 .

arokem commented 8 years ago

I am not sure what do... I would build this myself, if I had a RHEL machine...

yuvval commented 8 years ago

Alright, I guess I'll have to use matlab from its GUI. Thank you for the assistance and quick replies :)

mkgilbert commented 8 years ago

I'm having this same issue. @arokem, when you say to "download the source code from github", to which source code are you referring? I'm assuming I am to put the source code of something into pymatbridge/messenger/src (as I'm seeing an error about the src folder not being found). Thanks for any help! Edit: Sorry I had downloaded the tar.gz file and not the source from github. My bad!

mkgilbert commented 8 years ago

My problem was resolved after downloading the python-matlab-bridge source code, running python make.py matlab from the pymatbridge/messenger directory, and then installing with python setup.py install. Thank you for the instructions!

tgarc commented 8 years ago

This worked for me as well on redhat6.5. Thank you!. A note for others, make sure to install the zeromq3-devel packages (zeromq-devel is an older unsupported version).

raylim commented 8 years ago

Didn't work for me. I installed using anaconda and received the error:

Invalid MEX-file
'/ifs/e63data/reis-filho/usr/anaconda/envs/jupyter/lib/python3.5/site-packages/pymatbridge/matlab/messenger.mexa64':
/lib64/libc.so.6: version `GLIBC_2.17' not found (required by
/ifs/e63data/reis-filho/usr/anaconda/envs/jupyter/lib/python3.5/site-packages/pymatbridge/matlab/messenger.mexa64)

Installed manually and it's the same error:

Invalid MEX-file
'/ifs/e63data/reis-filho/usr/anaconda/envs/jupyter/lib/python3.5/site-packages/pymatbridge-0.6.dev0-py3.5.egg/pymatbridge/matlab/messenger.mexa64':
/lib64/libc.so.6: version `GLIBC_2.17' not found (required by
/ifs/e63data/reis-filho/usr/anaconda/envs/jupyter/lib/python3.5/site-packages/pymatbridge-0.6.dev0-py3.5.egg/pymatbridge/matlab/messenger.mexa64)
arokem commented 8 years ago

Hi @raylim : I assume you are also on RHEL? Do you have the zeromq3-devel installed as mentioned above?

raylim commented 8 years ago

Actually, I realized the problem was that I hadn't properly configured pymatbridge using the local.cfg file. But now I'm getting this error:

Invalid MEX-file
'/ifs/e63data/reis-filho/usr/anaconda/envs/jupyter/lib/python3.5/site-packages/pymatbridge-0.6.dev0-py3.5.egg/pymatbridge/matlab/messenger.mexa64':
/opt/common/CentOS_6-dev/matlab/R2014b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6:
version `GLIBCXX_3.4.20' not found (required by /home/limr/usr/lib/libzmq.so.4)

This is odd because:

$ strings ~/usr/anaconda/lib/libstdc++.so.6.0.21 | grep GLIBC
GLIBCXX_DEBUG_MESSAGE_LENGTH
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBC_2.3
GLIBC_2.2.5
GLIBC_2.3.2

I'm on CentOS 6.8

arokem commented 8 years ago

Did you recompile the messenger, or are you using the compiled binary that is provided in this repo?

raylim commented 8 years ago

I think I successfully recompiled the messenger (ran clean, build and install).

raylim commented 8 years ago

Okay, I see. It's the matlab stdc++ library (in matlab/R2014b/sys/os/glnxa64) that is missing GLIBCXX_3.4.20

arokem commented 8 years ago

Yup. Was just about to point out that your error message above points to the libc under Matlab. Maybe something about your path setting?

raylim commented 8 years ago

Yes, not sure why it's picking up that libstdc++.