Error in IDL-Python Bridge [message #91862] |
Sun, 06 September 2015 17:02  |
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   |
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   |
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   |
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   |
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   |
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   |
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 #91967 is a reply to message #91896] |
Wed, 23 September 2015 13:44  |
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.
|
|
|