comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Error in IDL-Python Bridge
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Error in IDL-Python Bridge [message #91862] Sun, 06 September 2015 17:02 Go to next message
chuxiangning is currently offline  chuxiangning
Messages: 17
Registered: September 2012
Junior Member
Dear ALL,
I just installed IDL 8.5 in CentOS and am testing IDL-Python bridge. When I run examples from the documentation, I got an error below:
Command:
plt = Python.Import('matplotlib.pyplot')
Error:
% PYTHON_IMPORT: Exception: No module named PySide.
% Execution halted at: $MAIN$

I don't have problems running "ran = Python.Import('numpy.random')".
I don't have problem running in ipython "import matplotlib.pyplot".

Does anyone have some clue? Thanks!
Re: Error in IDL-Python Bridge [message #91867 is a reply to message #91862] Mon, 07 September 2015 18:17 Go to previous messageGo to next message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Sunday, September 6, 2015 at 9:02:04 PM UTC-3, chu xiangning wrote:
> plt = Python.Import('matplotlib.pyplot')
> Error:
> % PYTHON_IMPORT: Exception: No module named PySide.
> % Execution halted at: $MAIN$
>
> I don't have problems running "ran = Python.Import('numpy.random')".
> I don't have problem running in ipython "import matplotlib.pyplot".
>

I have seen this exact problem when using a current Anaconda Python, both with Python 2.7 and 3.4. This seems to happen because PySide was dropped in recent versions of Anaconda:

"Version 2.0 reduces the size of the installers, adds installers for Python 3.4, updates over 40 packages, and moves from PySide to PyQt"
http://continuum.io/blog/anaconda-2-released

In the case of Anaconda Python 2.7, I can solve it with its installer:

conda install pyside

In the case of Anaconda's Python 3.4, PySide does not seem to be in their repository, so I installed it with pip:

pip install pyside

However, this still does not fix, for me, all the problems with using matplotlib from IDL. What I get next is

IDL> plt = Python.Import('matplotlib.pyplot')
% Loaded DLM: PYTHON27.
% PYTHON_IMPORT: Exception: /usr/local/exelis/idl85/bin/bin.linux.x86_64/idl: undefined symbol:
Py_DecRef.

I still did not have a chance to look further into this.
Re: Error in IDL-Python Bridge [message #91870 is a reply to message #91867] Tue, 08 September 2015 08:20 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Monday, September 7, 2015 at 7:17:13 PM UTC-6, Paulo Penteado wrote:
> On Sunday, September 6, 2015 at 9:02:04 PM UTC-3, chu xiangning wrote:
>> plt = Python.Import('matplotlib.pyplot')
>> Error:
>> % PYTHON_IMPORT: Exception: No module named PySide.
>> % Execution halted at: $MAIN$
>>
>> I don't have problems running "ran = Python.Import('numpy.random')".
>> I don't have problem running in ipython "import matplotlib.pyplot".
>>
>
> I have seen this exact problem when using a current Anaconda Python, both with Python 2.7 and 3.4. This seems to happen because PySide was dropped in recent versions of Anaconda:
>
> "Version 2.0 reduces the size of the installers, adds installers for Python 3.4, updates over 40 packages, and moves from PySide to PyQt"
> http://continuum.io/blog/anaconda-2-released
>
> In the case of Anaconda Python 2.7, I can solve it with its installer:
>
> conda install pyside
>
> In the case of Anaconda's Python 3.4, PySide does not seem to be in their repository, so I installed it with pip:
>
> pip install pyside
>
> However, this still does not fix, for me, all the problems with using matplotlib from IDL. What I get next is
>
> IDL> plt = Python.Import('matplotlib.pyplot')
> % Loaded DLM: PYTHON27.
> % PYTHON_IMPORT: Exception: /usr/local/exelis/idl85/bin/bin.linux.x86_64/idl: undefined symbol:
> Py_DecRef.
>
> I still did not have a chance to look further into this.

Hi Paulo,

That sounds like a path issue, either with $PATH or $LD_LIBRARY_PATH. That Py_DecRef is part of the C API for Python, and should be found within the python27.so.

Best of luck!

-Chris
Re: Error in IDL-Python Bridge [message #91875 is a reply to message #91870] Tue, 08 September 2015 10:26 Go to previous messageGo to next message
chuxiangning is currently offline  chuxiangning
Messages: 17
Registered: September 2012
Junior Member
Dear Paulo and Chris,
Thanks for your answers. I checked the folder bin.linux.x86_64, there's no file named python27.so. There are idl_python27.dll and idl_python27.dlm.
When I run the following command, I have no problem:
dlm_load,'python27'
When I run python.import, I got an error below:
plt = Python.Import('matplotlib.pyplot')
% PYTHON_IMPORT: Exception: /usr/local/exelis/idl85/bin/bin.linux.
x86_64/idl: undefined symbol: Py_DecRef.
% Execution halted at: $MAIN$

Just FYI, I've included my system path.

echo $PATH
/PowerEdge/xchu/anaconda/bin:/PowerEdge/xchu/anaconda:/usr/l ib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin :/usr/sbin:/sbin:/home/xnchu/bin
echo $PYTHONPATH: /usr/local/exelis/idl/bin/bin.linux.x86_64:/usr/local/exelis /idl/lib/bridges
echo $LD_LIBRARY_PATH
:/PowerEdge/xchu/anaconda/lib:/usr/local/exelis/idl/bin/bin. linux.x86_64




On Tuesday, September 8, 2015 at 8:20:57 AM UTC-7, Chris Torrence wrote:
> On Monday, September 7, 2015 at 7:17:13 PM UTC-6, Paulo Penteado wrote:
>> On Sunday, September 6, 2015 at 9:02:04 PM UTC-3, chu xiangning wrote:
>>> plt = Python.Import('matplotlib.pyplot')
>>> Error:
>>> % PYTHON_IMPORT: Exception: No module named PySide.
>>> % Execution halted at: $MAIN$
>>>
>>> I don't have problems running "ran = Python.Import('numpy.random')".
>>> I don't have problem running in ipython "import matplotlib.pyplot".
>>>
>>
>> I have seen this exact problem when using a current Anaconda Python, both with Python 2.7 and 3.4. This seems to happen because PySide was dropped in recent versions of Anaconda:
>>
>> "Version 2.0 reduces the size of the installers, adds installers for Python 3.4, updates over 40 packages, and moves from PySide to PyQt"
>> http://continuum.io/blog/anaconda-2-released
>>
>> In the case of Anaconda Python 2.7, I can solve it with its installer:
>>
>> conda install pyside
>>
>> In the case of Anaconda's Python 3.4, PySide does not seem to be in their repository, so I installed it with pip:
>>
>> pip install pyside
>>
>> However, this still does not fix, for me, all the problems with using matplotlib from IDL. What I get next is
>>
>> IDL> plt = Python.Import('matplotlib.pyplot')
>> % Loaded DLM: PYTHON27.
>> % PYTHON_IMPORT: Exception: /usr/local/exelis/idl85/bin/bin.linux.x86_64/idl: undefined symbol:
>> Py_DecRef.
>>
>> I still did not have a chance to look further into this.
>
> Hi Paulo,
>
> That sounds like a path issue, either with $PATH or $LD_LIBRARY_PATH. That Py_DecRef is part of the C API for Python, and should be found within the python27.so.
>
> Best of luck!
>
> -Chris
Re: Error in IDL-Python Bridge [message #91877 is a reply to message #91875] Tue, 08 September 2015 12:35 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Tuesday, September 8, 2015 at 11:26:13 AM UTC-6, chu xiangning wrote:
> Dear Paulo and Chris,
> Thanks for your answers. I checked the folder bin.linux.x86_64, there's no file named python27.so. There are idl_python27.dll and idl_python27.dlm.
> When I run the following command, I have no problem:
> dlm_load,'python27'
> When I run python.import, I got an error below:
> plt = Python.Import('matplotlib.pyplot')
> % PYTHON_IMPORT: Exception: /usr/local/exelis/idl85/bin/bin.linux.
> x86_64/idl: undefined symbol: Py_DecRef.
> % Execution halted at: $MAIN$
>

Hi,

That python shared library is part of Anaconda, not IDL. It is probably in anaconda/lib, and is actually named something like "libpython2.so". It looks like you already have that directory on your LD_LIBRARY_PATH.

What happens when you try that import command from within Python itself?

-Chris
Re: Error in IDL-Python Bridge [message #91888 is a reply to message #91870] Tue, 08 September 2015 17:20 Go to previous messageGo to next message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Tuesday, September 8, 2015 at 8:20:57 AM UTC-7, Chris Torrence wrote:
> That sounds like a path issue, either with $PATH or $LD_LIBRARY_PATH. That Py_DecRef is part of the C API for Python, and should be found within the python27.so.

Thanks, Chris. That tip pointed me to a fix for that problem.

I had previously checked that all necessary directories were in PATH, PYTHONPATH and LD_LIBRARY_PATH, and I had checked that the matplotlib import worked directly from Python. But given that I could use Python from IDL, and the problem happened only when importing matplotlib, I assumed it was some missing Python library.

Now, I do see that symbol is defined in Anaconda's libpython2.7.so, which is being found:

$ ldd idl_python27.so
linux-vdso.so.1 => (0x00007fffe59fe000)
libpython2.7.so.1.0 => /usr/local/anaconda/lib/libpython2.7.so.1.0 (0x00002adc17360000)
libc.so.6 => /lib64/libc.so.6 (0x00002adc177a3000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002adc17b63000)
libdl.so.2 => /lib64/libdl.so.2 (0x00002adc17d7f000)
libutil.so.1 => /lib64/libutil.so.1 (0x00002adc17f84000)
libm.so.6 => /lib64/libm.so.6 (0x00002adc18187000)
/lib64/ld-linux-x86-64.so.2 (0x000000314c000000)

It is weird that it does not get found when I try to import the library from IDL (even an ldd spawned from IDL did find the library), but a LD_PRELOAD before starting IDL (export LD_PRELOAD=/usr/local/anaconda/lib/libpython2.7.so.1.0) does fix that problem.

Now, the only problem is a segfault when trying to display a plot (doing a plt.show() in the example)...
Re: Error in IDL-Python Bridge [message #91896 is a reply to message #91888] Wed, 09 September 2015 08:05 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Tuesday, September 8, 2015 at 6:20:30 PM UTC-6, Paulo Penteado wrote:
> On Tuesday, September 8, 2015 at 8:20:57 AM UTC-7, Chris Torrence wrote:
>> That sounds like a path issue, either with $PATH or $LD_LIBRARY_PATH. That Py_DecRef is part of the C API for Python, and should be found within the python27.so.
>
> Thanks, Chris. That tip pointed me to a fix for that problem.
>
> I had previously checked that all necessary directories were in PATH, PYTHONPATH and LD_LIBRARY_PATH, and I had checked that the matplotlib import worked directly from Python. But given that I could use Python from IDL, and the problem happened only when importing matplotlib, I assumed it was some missing Python library.
>
> Now, I do see that symbol is defined in Anaconda's libpython2.7.so, which is being found:
>
> $ ldd idl_python27.so
> linux-vdso.so.1 => (0x00007fffe59fe000)
> libpython2.7.so.1.0 => /usr/local/anaconda/lib/libpython2.7.so.1.0 (0x00002adc17360000)
> libc.so.6 => /lib64/libc.so.6 (0x00002adc177a3000)
> libpthread.so.0 => /lib64/libpthread.so.0 (0x00002adc17b63000)
> libdl.so.2 => /lib64/libdl.so.2 (0x00002adc17d7f000)
> libutil.so.1 => /lib64/libutil.so.1 (0x00002adc17f84000)
> libm.so.6 => /lib64/libm.so.6 (0x00002adc18187000)
> /lib64/ld-linux-x86-64.so.2 (0x000000314c000000)
>
> It is weird that it does not get found when I try to import the library from IDL (even an ldd spawned from IDL did find the library), but a LD_PRELOAD before starting IDL (export LD_PRELOAD=/usr/local/anaconda/lib/libpython2.7.so.1.0) does fix that problem.
>
> Now, the only problem is a segfault when trying to display a plot (doing a plt.show() in the example)...

Hmmmm. A segfault doesn't sound good. I found some online articles about problems with matplotlib 1.3, and people had gone back to an earlier version (1.2?) which fixed it.

Does the problem only happen when using matplotlib from within IDL, or does it occur in Python as well?

What happens if you download anaconda 3.x and try that instead? Not that you necessarily want to convert to Python 3, but at least it would give you confidence that your environment variables were set up correctly...

-Chris
Re: Error in IDL-Python Bridge [message #91931 is a reply to message #91862] Wed, 16 September 2015 13:38 Go to previous messageGo to next message
biophys is currently offline  biophys
Messages: 68
Registered: July 2004
Member
hi guys,

With a lot of hope and curiosity I have just tried the python bridge and I see exactly the same errors under Xubuntu14.04LTS. Tried both anaconda with python 2.7 and 3.4. I can't believe the python bridge example code in the first page of help document failed with the recommended python distribution(anaconda). I wonder for those who did succeed which python distro and which OS were they using.

Bp



On Sunday, September 6, 2015 at 5:02:04 PM UTC-7, chu xiangning wrote:
> Dear ALL,
> I just installed IDL 8.5 in CentOS and am testing IDL-Python bridge. When I run examples from the documentation, I got an error below:
> Command:
> plt = Python.Import('matplotlib.pyplot')
> Error:
> % PYTHON_IMPORT: Exception: No module named PySide.
> % Execution halted at: $MAIN$
>
> I don't have problems running "ran = Python.Import('numpy.random')".
> I don't have problem running in ipython "import matplotlib.pyplot".
>
> Does anyone have some clue? Thanks!
Re: Error in IDL-Python Bridge [message #91932 is a reply to message #91931] Thu, 17 September 2015 01:04 Go to previous messageGo to next message
Kallisthène is currently offline  Kallisthène
Messages: 15
Registered: October 2012
Junior Member
Le mercredi 16 septembre 2015 22:38:59 UTC+2, bio...@gmail.com a écrit :
> hi guys,
>
> With a lot of hope and curiosity I have just tried the python bridge and I see exactly the same errors under Xubuntu14.04LTS. Tried both anaconda with python 2.7 and 3.4. I can't believe the python bridge example code in the first page of help document failed with the recommended python distribution(anaconda). I wonder for those who did succeed which python distro and which OS were they using.


Well it works on Windows 7 64 bits with WinPython 64 bits 3.4


>
> Bp
>
>
>
> On Sunday, September 6, 2015 at 5:02:04 PM UTC-7, chu xiangning wrote:
>> Dear ALL,
>> I just installed IDL 8.5 in CentOS and am testing IDL-Python bridge. When I run examples from the documentation, I got an error below:
>> Command:
>> plt = Python.Import('matplotlib.pyplot')
>> Error:
>> % PYTHON_IMPORT: Exception: No module named PySide.
>> % Execution halted at: $MAIN$
>>
>> I don't have problems running "ran = Python.Import('numpy.random')".
>> I don't have problem running in ipython "import matplotlib.pyplot".
>>
>> Does anyone have some clue? Thanks!
Re: Error in IDL-Python Bridge [message #91933 is a reply to message #91932] Thu, 17 September 2015 16:44 Go to previous messageGo to next message
biophys is currently offline  biophys
Messages: 68
Registered: July 2004
Member
Thanks for sharing. Let's hope there is a fix for this soon. :)

> Well it works on Windows 7 64 bits with WinPython 64 bits 3.4
>
>
>>
>> Bp
>>
>>
>>
>> On Sunday, September 6, 2015 at 5:02:04 PM UTC-7, chu xiangning wrote:
>>> Dear ALL,
>>> I just installed IDL 8.5 in CentOS and am testing IDL-Python bridge. When I run examples from the documentation, I got an error below:
>>> Command:
>>> plt = Python.Import('matplotlib.pyplot')
>>> Error:
>>> % PYTHON_IMPORT: Exception: No module named PySide.
>>> % Execution halted at: $MAIN$
>>>
>>> I don't have problems running "ran = Python.Import('numpy.random')".
>>> I don't have problem running in ipython "import matplotlib.pyplot".
>>>
>>> Does anyone have some clue? Thanks!
Re: Error in IDL-Python Bridge [message #91941 is a reply to message #91933] Mon, 21 September 2015 15:48 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
Hi Bp,

There is a known issue with the IDL Python bridge on Linux, having to do with a conflict between IDL's CBLAS library and Python's.

We are hoping to have a patch out shortly.

Thanks,
Chris
Re: Error in IDL-Python Bridge [message #91967 is a reply to message #91896] Wed, 23 September 2015 13:44 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Wednesday, September 9, 2015 at 8:05:47 AM UTC-7, Chris Torrence wrote:
> Hmmmm. A segfault doesn't sound good. I found some online articles about problems with matplotlib 1.3, and people had gone back to an earlier version (1.2?) which fixed it.
>
> Does the problem only happen when using matplotlib from within IDL, or does it occur in Python as well?
>
> What happens if you download anaconda 3.x and try that instead? Not that you necessarily want to convert to Python 3, but at least it would give you confidence that your environment variables were set up correctly...

Sorry for the late reply, I did not have much time to look further into this.

Yes, I also get a segfault with Anaconda's Python 3.4. And the same plot example works from Python directly, both Python 2.7 and 3.4.

Since my main interest in the bridge is using non-graphical Python code from IDL, and using IDL plotting from Python (I find IDL way better than matplotlib), this issue has not affected me much, so I have not yet spent much time trying to fix this. I will try looking into which libraries get loaded, and if it differs when I use Python directly or from IDL.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Another idiosyncracy?
Next Topic: launch a file

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:13:41 PDT 2025

Total time taken to generate the page: 0.00643 seconds