python bridge setup - IDL8.6.1 Mac OS X Sierra [message #94685] |
Fri, 18 August 2017 07:57  |
wallabadah
Messages: 28 Registered: November 2005
|
Junior Member |
|
|
Hi All,
Tonight I though I'd take a look at the IDL-Python bridge - it looks pretty interesting and it could potentially unlock a lot of functionality from the python world for idl users.
I started by trying to get IDL 8.5 to talk to Python 2.7 (default Mac OS X installation), and failed. Then searched around and found some posts by Chris Torrence on this newsgroup and on stack overflow. Following advice from these threads I installed Anaconda, learned something about setting up different python environments (and installed python 3.4) and battled on, modifying .bashrc, setting environment variables, running otool, trying to follow the IDL help instructions... but ultimately failing to get it to work.
After a while I thought I'd try in IDL 8.6.1 - supposedly improved with respect to setting up the bridge, and compatible with python 3.6. Once more I followed the instructions in the IDL8.6 help, seemed to get close at times but it's still not working correctly. I can call IDL from python and execute the example code from IDL help as follows:
>>> from idlpy import *
>>> import numpy.random as ran
>>> arr = ran.rand(100)
>>> p = IDL.plot(arr, title='My Plot')
>>> p.color = 'red'
>>> p.save('myplot.pdf')
>>> p.close()
but what I would prefer is to be able to call python from IDL. Executing the code from IDL Help gives the following error:
IDL> ran = Python.Import('numpy.random')
% DLM_LOAD: Error loading sharable executable.
Symbol: IDL_Load, File = /usr/local/harris/idl86/bin/bin.darwin.x
86_64/idl_python36.so
dlopen(/usr/local/harris/idl86/bin/bin.darwin.x86_64/idl_pyt hon36
.so, 1): Library not loaded: @rpath/libpython3.6m.dylib
Referenced from: /usr/local/harris/idl86/bin/bin.darwin.x86_64/
idl_python36.so
Reason: image not found
% Execution halted at: $MAIN$
If anyone can help decipher this I'd appreciate it. At this stage I'm not all that impressed with the process of setting this up.
Also, I've noticed that if I'm connected to the internet IDL8.6+ takes a *long* time to start up. If I disconnect from the internet it starts up straight away. Looks like the new IDL is calling home to check those licenses...
thanks in advance,
Will.
|
|
|