[kepler-users] Kepler 2.3 and MATLAB

Hogan, D. (GE Energy) D.Hogan at ge.com
Mon Apr 23 13:14:57 PDT 2012


Wade,

I ran into the same issue.  I don't have Matlab in my path normally.

If I use the following, I get an exception about running %1:

build-area$ env PATH="$PATH:/c/apps/matlab/v2011a/Local/bin/win32" ant
run

If I use this instead, it "works" and I run into the same /regserver
message that you did:

build-area$ env PATH="/c/apps/matlab/v2011a/Local/bin/win32:$PATH" ant
run

I was testing this with
ptolemy-kepler-2.3/src/ptolemy/matlab/demo/MatlabExpression/

I ran MSVS depends.exe on common-2.3/lib/ptolemy/matlab/ptmatlab.dll
with both
PATH variables and the difference turned out to be libexpat.dll and
zlib1.dll.
When I had the Matlab path after the other PATH entries, it was picking
up my
graphviz/bin directory versions of libexpat.dll and zlib1.dll.  It
listed libexpat.dll
as [E] which means "Import/Export Mismatch or Load Failure".

If you have Visual Studio depends.exe, this may help you in cygwin:

matlab$ pwd
/d/trunk/kepler/common-2.3/lib/ptolemy/matlab
matlab$ env PATH="$PATH:/c/apps/matlab/v2011a/Local/bin/win32" \
    depends.exe /c /f:1 /ot:after.txt ptmatlab.dll
matlab$ env PATH="/c/apps/matlab/v2011a/Local/bin/win32:$PATH" \
    depends.exe /c /f:1 /ot:before.txt ptmatlab.dll
matlab$ diff -ud before.txt after.txt

If I rename graphviz/bin/libexpat.dll, then either PATH variable works.

If it works for Kepler and you modified the global PATH, it may be
broken for the
other application(s) where the conflict is.  You may want to setup a
*.bat file to
setup the PATH for Kepler.  I use an ant.bat file for Kepler to set
JAVA_HOME,
ANT_HOME, R_HOME and PATH so I don't have to do it globally.

-----Original Message-----
From: kepler-users-bounces at kepler-project.org
[mailto:kepler-users-bounces at kepler-project.org] On Behalf Of Wade
Sheldon
Sent: Monday, April 23, 2012 12:54 PM
To: kepler-users at kepler-project.org
Subject: Re: [kepler-users] Kepler 2.3 and MATLAB

Well I'll be darned - I got it working. I decided to Google that last
error message and found a page that described the same issue with a JNI
application caused by loading of the wrong dll from elsewhere in the
path
(http://stackoverflow.com/questions/159846/unsatisfiedlinkerror-the-spec
ified-procedure-could-not-be-found). I moved the matlab paths to right
after the windows paths, and the workflow started to run then alerted me
that I had to run matlab /regserver to set up the COM registry entries
to load a matlab engine. After I did that, it ran fine. I didn't track
down the individual dll conflict, though, so hopefully I haven't hosed
another application but that's a problem for another day.

I'll see if I can run it under R2011b now, but at least I have it up
under R2009a for testing.

Sorry for the drama, but this is definitely something to add to the
troubleshooting steps. Here's my revised path FYI:

PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\MATLAB\R
2009a\bin;C:\MATLAB\R2009a\bin\win32;C:\Python25;C:\Program
Files\WinZip;C:\Program Files\Bitvise Tunnelier;C:\Program
Files\Microsoft SQL
Server\80\Tools\Binn;C:\ArcGIS\arcexe9x\bin;C:\Program
Files\cURL;C:\Program Files\TortoiseSVN\bin;C:\Program
Files\R\R-2.15.0\bin;C:\Program Files\Common Files\Roxio
Shared\DLLShared\;C:\Program Files\Common Files\Roxio
Shared\9.0\DLLShared

-Wade


On 4/23/2012 12:08 PM, Wade Sheldon wrote:
> Hi folks,
>
> Thanks for all the advice last week, but I'm throwing in to towel
unless someone has a radically new idea. I installed Matlab 2009a and
that also failed to run the demo, but with a different error message:
"Caused by: java.lang.UnsatisfiedLinkError: C:\Program
Files\Kepler-2.3\common-2.3.0\lib\ptolemy\matlab\ptmatlab.dll: The
specified procedure could not be found ...". I also tried R2007b
(mentioned in help files) and had the same result as 2009a. So R2010a
and R2011b error with "...The
> operating system cannot run %1" and R2007b and R2009a error with the
above procedure call error, in case that's of any diagnostic value. I
also installed Kepler on a different workstation run WinXP and had the
same issues.
>
> To eliminate potential Java version issues, I wiped Kepler 2.3 and all
the settings files, uninstalled an old version of the JDK I had on the
box (1.6_18), installed a matching JDK to the Java libraries previously
installed (1.6.0_31-b05) and reinstalled Kepler. Same result. I also
added C:\Program Files\Kepler-2.3\common-2.3.0\lib\ptolemy\matlab to the
path (based on Ptolemy Matlab troubleshooting guidelines) but that
didn't help either.
>
> I then tried to follow the build instructions from the url Dan sent,
spending most of the weekend setting up the software and source code and
ironing out cygwin and mingw configurations and dependencies (the
instructions on the reference page are out of date, and the mingw shell
scripts described are not online and no mention is made of what
libraries are needed for cygwin, so I had to guess and reinstall several
times to get what was needed). After climbing down ever darker rabbit
holes I managed to get a working build system set up, but then hit
syntax errors with the .config files (apparently due to line terminator
issues) and never could successfully build a dll.
>
> I concluded that this process is really untenable for someone not
already set up to do Java development and use the entire Kepler build
system, so at this point I rolled back my system and dumped the gig of
software I spent all weekend messing with. So it was an informative, but
ultimately futile, exercise.
>
> Thanks anyway. For my work it will be more productive to generate
delimited files from Kepler and pick them up in Matlab, but I wanted to
kick the tires and see if I could roll our Matlab code into native
workflows. I'm about to rebuild that system using Win7/64 dual booting
with Ubuntu, so I may try again if I feel adventurous.
>
> -Wade
>
>
> On 4/21/2012 4:48 PM, Daniel Crawl wrote:
>>
>> I can run the MatlabExpression workflow with Kepler 2.3 on
>> WinXP SP3 (32bit) using Matlab 2009A and Java 1.6.0_31-b05.
>>
>> Your PATH looks ok (assuming you installed Matlab in C:\ and
>> not the default C:\Program Files). It's possible that ptmatlab.dll
>> is not compatible with newer versions of Matlab. You can find
>> instructions on building ptmatlab.dll here:
>>
>>
https://kepler-project.org/developers/teams/build/matlab-lib-build-instr
uctions-in-kepler-for-matlab-actor/
>>
>>   --dan
>>
>> On 4/21/12 4:17 AM, Wade Sheldon wrote:
>>> Hi Derek,
>>>
>>> Here you go:
>>>
>>>
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Python25
;C:\Program
>>> Files\WinZip;C:\Program Files\Bitvise Tunnelier;C:\Program
>>> Files\Microsoft SQL
>>>
Server\80\Tools\Binn;C:\ArcGIS\arcexe9x\bin;C:\MATLAB\R2011b\bin;C:\MATL
AB\R2011b\bin\win32;C:\Program
>>> Files\cURL;C:\Program Files\TortoiseSVN\bin;C:\Program
>>> Files\R\R-2.15.0\bin;C:\Program Files\Common Files\Roxio
>>> Shared\DLLShared\;C:\Program Files\Common Files\Roxio
Shared\9.0\DLLShared
>>>
>>>
>>> I have several versions of MATLAB on this box for code testing, but
I
>>> made sure only one is present in the path each time I tested
(currently
>>> 2011b). I also confirmed that the target "libmex.dll" is present in
>>> \bin\win32.
>>>
>>> I don't have cygwin installed to test Christopher's idea about
building
>>> a new .dll, but I may play with that option over the weekend if I
get
>>> ambitious. Based on Matt's comment that may ultimately prove
necessary
>>> if the problem doesn't come down to path handling.
>>>
>>> Thanks for your input.
>>>
>>> -Wade
>>>
>>>
>>> On 4/20/2012 11:30 PM, Derik Barseghian wrote:
>>>> Sorry this hasn't been easy, and no help from me yet -- I'm trying
to
>>>> get Matlab and a license for my 32bit XP box so that I can try to
>>>> replicate, hopefully on Monday. It seems to me it should work on
your
>>>> XP box. The last commit message for ptmatlab.dll says it's 32bit:
>>>> --------------
>>>> r24053 | crawl | 2010-04-29 13:30:49 -0700 (Thu, 29 Apr 2010) | 2
lines
>>>>
>>>> updating matlab jni library for 32 bit windows
>>>> based on ptmatlab.cc r57728.
>>>> --------------
>>>>
>>>> Interesting to hear about the error on 64bit AMD, sounds like we
have
>>>> an (additional) problem there.
>>>>
>>>> Can you send your PATH?
>>>> Derik
>>>>
>>>> On Apr 20, 2012, at 8:14 PM, Wade Sheldon wrote:
>>>>
>>>>> No joy under Win7/64 either with a clean install of Kepler 2.3 and
>>>>> the proper Matlab paths (albeit R2010a 64bit). However this time I
>>>>> get an error related to running 32bit libraries on the system:
>>>>> C:\Program Files
>>>>> (x86)\Kepler-2.3\common-2.3.0\lib\ptolemy\matlab\ptmatlab.dll:
Can't
>>>>> load IA 32-bit .dll on a AMD 64-bit platform
>>>>>
>>>>> (This is an Intel Core i7, not AMD cpu, BTW).
>>>>>
>>>>> Sigh. Harder than I'd hoped. Python and R work fine as on WinXP/32
-
>>>>> the problem is just related to the MatlabExpression actor, which
is
>>>>> what I'm particularly interested in using.
>>>>>
>>>>> -Wade
>>>>>
>>>>>
>>>>> On 4/20/2012 10:41 PM, Wade Sheldon wrote:
>>>>>> Also, I updated Java to the latest version (1.6.0_31-b05),
>>>>>> uninstalled Kepler, and reinstalled from a full admin account.
Same
>>>>>> results. From what I can find on the web, that "The operating
system
>>>>>> cannot run %1" is a generic error that implies a path issue.
>>>>>> Anything I can check regarding the Kepler classpath or libraries
>>>>>> come to mind?
>>>>>>
>>>>>> Thanks again for your help.
>>>>>>
>>>>>> -Wade
>>>>>>
>>>>>> On 4/20/2012 10:02 PM, Wade Sheldon wrote:
>>>>>>> Thanks, Christopher. I had already perused the mailing list
>>>>>>> archives via Google and just saw references to the same issue
>>>>>>> without solutions. I confirmed that the JVM bit width is 32
(Java
>>>>>>> version 1.6.0_20).
>>>>>>>
>>>>>>> I set up a simpler workflow with just a SDF director,
>>>>>>> MatalbExpression actor and text display actor, and configured
the
>>>>>>> expression: "rand(100,1);", but I got the same error. Here's the
>>>>>>> trace from the first time it was invoked, which yielded a little
>>>>>>> more info as you indicated, specifically "C:\Program
>>>>>>> Files\Kepler-2.3\common-2.3.0\lib\ptolemy\matlab\ptmatlab.dll:
The
>>>>>>> operating system cannot run %1". Hope that points to a specific
issue.
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>> -Wade
>>>>>>>
>>>>>>> complete stack dump:
>>>>>>> ptolemy.kernel.util.IllegalActionException: There was a problem
>>>>>>> invoking the Ptolemy II Matlab interface.
>>>>>>> The interface has been tested under Linux, Mac OS X, and
Windows.
>>>>>>> The interface requires that Matlab be installed on the local
>>>>>>> machine and that the ptmatlab shared library available.
>>>>>>> * Under Linux, you must have the LD_LIBRARY_PATH environment
>>>>>>> variable set to include the directories that contain libmx.so
and
>>>>>>> libptmatlab.so.
>>>>>>> * Under Mac OS X, you must have the DYLD_LIBRARY_PATH
environment
>>>>>>> variable set to include the directories that contain libmx.dylib
>>>>>>> and libptmatlab.jnilib.
>>>>>>> * Under Windows, you must have your PATH set to include the
Matlab
>>>>>>> bin/win32 or equivalent directory so that libmex.dll is found
and
>>>>>>> the directory that contains libptmatlab.dll. In addition, if you
>>>>>>> are running under Windows from the Cygwin bash prompt, then you
>>>>>>> must start Vergil with the -jni argument: $PTII/bin/vergil -jni.
>>>>>>> For details, see $PTII/jni/package.html.
>>>>>>> Refer to $PTII/ptolemy/matlab/makefile for more information.
>>>>>>> in .Unnamed1.MatlabExpression
>>>>>>> Because:
>>>>>>> C:\Program
>>>>>>> Files\Kepler-2.3\common-2.3.0\lib\ptolemy\matlab\ptmatlab.dll:
The
>>>>>>> operating system cannot run %1
>>>>>>> at ptolemy.matlab.Expression.preinitialize(Expression.java:263)
>>>>>>> at ptolemy.actor.Director.preinitialize(Director.java:1056)
>>>>>>> at ptolemy.actor.Director.preinitialize(Director.java:1035)
>>>>>>> at
>>>>>>>
ptolemy.domains.sdf.kernel.SDFDirector.preinitialize(SDFDirector.java:65
5)
>>>>>>>
>>>>>>> at
>>>>>>>
ptolemy.actor.CompositeActor.preinitialize(CompositeActor.java:1735)
>>>>>>> at
>>>>>>>
ptolemy.actor.Manager.preinitializeAndResolveTypes(Manager.java:930)
>>>>>>> at ptolemy.actor.Manager.initialize(Manager.java:636)
>>>>>>> at ptolemy.actor.Manager.execute(Manager.java:340)
>>>>>>> at ptolemy.actor.Manager.run(Manager.java:1111)
>>>>>>> at ptolemy.actor.Manager$PtolemyRunThread.run(Manager.java:1641)
>>>>>>> Caused by: java.lang.UnsatisfiedLinkError: C:\Program
>>>>>>> Files\Kepler-2.3\common-2.3.0\lib\ptolemy\matlab\ptmatlab.dll:
The
>>>>>>> operating system cannot run %1
>>>>>>> at java.lang.ClassLoader$NativeLibrary.load(Native Method)
>>>>>>> at java.lang.ClassLoader.loadLibrary0(Unknown Source)
>>>>>>> at java.lang.ClassLoader.loadLibrary(Unknown Source)
>>>>>>> at java.lang.Runtime.load0(Unknown Source)
>>>>>>> at java.lang.System.load(Unknown Source)
>>>>>>> at
>>>>>>>
ptolemy.data.expr.UtilityFunctions._loadLibrary(UtilityFunctions.java:20
68)
>>>>>>>
>>>>>>> at
>>>>>>>
ptolemy.data.expr.UtilityFunctions.loadLibrary(UtilityFunctions.java:927
)
>>>>>>>
>>>>>>> at ptolemy.matlab.Engine.<clinit>(Engine.java:176)
>>>>>>> at ptolemy.matlab.Expression.preinitialize(Expression.java:260)
>>>>>>> ... 9 more
>>>>>>> Caused by: java.lang.UnsatisfiedLinkError: C:\Program
>>>>>>> Files\Kepler-2.3\common-2.3.0\lib\ptolemy\matlab\ptmatlab.dll:
The
>>>>>>> operating system cannot run %1
>>>>>>> at java.lang.ClassLoader$NativeLibrary.load(Native Method)
>>>>>>> at java.lang.ClassLoader.loadLibrary0(Unknown Source)
>>>>>>> at java.lang.ClassLoader.loadLibrary(Unknown Source)
>>>>>>> at java.lang.Runtime.load0(Unknown Source)
>>>>>>> at java.lang.System.load(Unknown Source)
>>>>>>> at
>>>>>>>
ptolemy.data.expr.UtilityFunctions._loadLibrary(UtilityFunctions.java:20
68)
>>>>>>>
>>>>>>> at
>>>>>>>
ptolemy.data.expr.UtilityFunctions.loadLibrary(UtilityFunctions.java:927
)
>>>>>>>
>>>>>>> at ptolemy.matlab.Engine.<clinit>(Engine.java:176)
>>>>>>> at ptolemy.matlab.Expression.preinitialize(Expression.java:260)
>>>>>>> at ptolemy.actor.Director.preinitialize(Director.java:1056)
>>>>>>> at ptolemy.actor.Director.preinitialize(Director.java:1035)
>>>>>>> at
>>>>>>>
ptolemy.domains.sdf.kernel.SDFDirector.preinitialize(SDFDirector.java:65
5)
>>>>>>>
>>>>>>> at
>>>>>>>
ptolemy.actor.CompositeActor.preinitialize(CompositeActor.java:1735)
>>>>>>> at
>>>>>>>
ptolemy.actor.Manager.preinitializeAndResolveTypes(Manager.java:930)
>>>>>>> at ptolemy.actor.Manager.initialize(Manager.java:636)
>>>>>>> at ptolemy.actor.Manager.execute(Manager.java:340)
>>>>>>> at ptolemy.actor.Manager.run(Manager.java:1111)
>>>>>>> at ptolemy.actor.Manager$PtolemyRunThread.run(Manager.java:1641)
>>>>>>>
>>>>>>>
>>>>>>> On 4/20/2012 6:38 PM, Christopher Brooks wrote:
>>>>>>>> Hi Wade,
>>>>>>>> I don't think I have a WinXP installation at hand, but I was
able
>>>>>>>> to run the MatlabExpression demo under Windows Server 2003 with
a
>>>>>>>> 32-bit JVM from a clean install of Kepler-2.3. Windows Server
2003
>>>>>>>> is fairly similar to XP.
>>>>>>>>
>>>>>>>> To determine the bit width of your JVM, start up Kepler, go to
>>>>>>>> Tools -> check settings and look at the value of
>>>>>>>> sun.arch.data.model = 32
>>>>>>>>
>>>>>>>> When I start a dos shell (Start->Run->cmd), I can start matlab
>>>>>>>> from the command line, which works for you.
>>>>> -- 
>>>>>
________________________________________________________________________
______
>>>>>
>>>>>
>>>>> Wade M. Sheldon
>>>>> GCE-LTER Information Manager/SIMO Database Administrator
>>>>> School of Marine Programs
>>>>> University of Georgia
>>>>> Athens, GA 30602-3636
>>>>> Email: sheldon at uga.edu
>>>>> WWW:
>>>>>
http://gce-lter.marsci.uga.edu/public/app/personnel_bios.asp?id=wsheldon
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Kepler-users mailing list
>>>>> Kepler-users at kepler-project.org
>>>>> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users
>>>>
>>>
>>
>>
>

-- 
____________________________________

  Wade M. Sheldon
  GCE-LTER Information Manager/SIMO Database Administrator
  School of Marine Programs
  University of Georgia
  Athens, GA 30602-3636
  Email: sheldon at uga.edu
  WWW:
http://gce-lter.marsci.uga.edu/public/app/personnel_bios.asp?id=wsheldon


_______________________________________________
Kepler-users mailing list
Kepler-users at kepler-project.org
http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users


More information about the Kepler-users mailing list