how to communicate in python with an external process

Benjamin Kaplan benjamin.kaplan at case.edu
Mon Mar 7 19:06:25 EST 2011


On Mon, Mar 7, 2011 at 6:12 PM, Danny Shevitz <shevitz at lanl.gov> wrote:
>
>>
>> http://pypi.python.org/pypi/pymatlab/
>>
>> Cheers,
>> Chris
>
> I am on a mac. Does pymatlab support mac's? I tried the linux 64 bit egg
> (downloaded to my local machine) and got:
>
> macshevitz:~ dannyshevitz$ sudo easy_install pymatlab-0.1.3-py2.6-linux-x86_64.
> egg
> Password:
> Searching for pymatlab-0.1.3-py2.6-linux-x86-64.egg
> Reading http://pypi.python.org/simple/pymatlab-0.1.3-py2.6-linux-x86_64.egg/
> No local packages or download links found for pymatlab-0.1.3-py2.6-linux-
> x86-64.egg
> error: Could not find suitable distribution for
> Requirement.parse('pymatlab-0.1.3-py2.6-linux-x86-64.egg')
>
> I am in the same directory as the egg when I do this. I am certainly doing
> something stupid, but don't know what it is.
>
> thanks,
> Danny
>


According to the setup.py file, only Windows and Linux are supported.
On the other hand, I can't think of a reason why it wouldn't work on
Mac OS X. You'll just need to download the source tarball and compile
it yourself.  Here's a setup.py script that will at least build on Mac
OS X, although I haven't actually run it. There are 3 differences
between this setup.py script and the one included in the source
tarball.

1) using numpy.distutils instead of setuptools (because otherwise, it
won't build on any platform)
2) treating Darwin the same as Linux
3) I added a  library_dirs and includes_dirs arguments to the
Extension for Matlab stuff, because Matlab doesn't dump it's libraries
into any of the standard paths in Mac OS X. Note that I'm using the
64-bit Matlab 2010b. If your version is different, chance the file
path accordingly.


#!/usr/bin/python
# vim: set fileencoding=utf-8 :
from setuptools import setup,find_packages,Extension
import os.path
import platform
from numpy.distutils.core import setup,Extension
if platform.system() == 'Windows':
    libraries = ['libmx', 'libmat', 'libeng']
elif platform.system() == 'Linux' or platform.system() == 'Darwin':
    libraries = ['eng', 'm', 'mx']
else:
    raise 'Unsupported system %s' % platform.system()

setup(
        name='pymatlab',
        version='0.1.3',
        description = 'A python interface to MATLAB',
        long_description=open("README.txt").read() + "\n" +
            open(os.path.join("docs", "CHANGELOG.txt")).read(),
        packages = find_packages('src'),
        package_dir={'':'src'},
        classifiers=['Development Status :: 3 - Alpha',
                        'Intended Audience :: End Users/Desktop',
                        'Intended Audience :: Developers',
                        'Intended Audience :: Science/Research',
                        'License :: OSI Approved :: GNU General Public
License (GPL)',
                        'Operating System :: POSIX',
                        'Programming Language :: C',
                        'Programming Language :: Python',
                          ],
        ext_modules=[Extension('pymatlab.matlab',
                      ['src/pymatlab/matlab.c'],
                      libraries=libraries,
                      extra_compile_args=['-g'],

library_dirs=['/Applications/MATLAB_R2010b.app/bin/maci64'],

include_dirs=['/Applications/MATLAB_R2010b.app/extern/include'])],
        test_suite='tests.alltests.test_suite',
        url = 'http://pymatlab.sourceforge.net/',
        zip_safe=False,
        author='Joakim Moller',
        author_email='joakim.moller at chalmers.se',
        install_requires=['setuptools','numpy'],
        #tests_require=['setuptools'],
)



More information about the Python-list mailing list