Bug 13143 - The python-pmw is designed for Python3 and fails to run on Python2 (pymol failure).
Summary: The python-pmw is designed for Python3 and fails to run on Python2 (pymol fai...
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 4
Hardware: x86_64 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: QA Team
QA Contact:
URL:
Whiteboard: has_procedure advisory mga4-64-ok mga...
Keywords: validated_update
Depends on:
Blocks:
 
Reported: 2014-04-04 10:26 CEST by Edward d'Auvergne
Modified: 2014-04-15 20:16 CEST (History)
4 users (show)

See Also:
Source RPM: python-pmw
CVE:
Status comment:


Attachments

Description Edward d'Auvergne 2014-04-04 10:26:11 CEST
The python-pmw package is a toolkit for building compound Tkinter widgetsâ.  For the following demo, you need to have the following installed:

python-pmw
tkinter
tkinter3

In Python2, the Tkinter package is imported as 'Tkinter' whereas in Python3 it is imported as 'tkinter':

$ /usr/bin/python2.7
Python 2.7.6 (default, Mar 18 2014, 22:18:46) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
>>> import tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named tkinter
>>> 
$ /usr/bin/python3.3
Python 3.3.2 (default, Mar 21 2014, 23:44:23) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'Tkinter'
>>> import tkinter
>>>

Therefore to use python-pmw with Python2, it needs to import Tkinter (or at least have portability code to map 'Tkinter' to 'tkinter'), but if you run the commands

$ grep -r "import Tkinter" /usr/lib/python2.7/site-packages/Pmw/
$ grep -r "import tkinter" /usr/lib/python2.7/site-packages/Pmw/

it will be clear that python-pmw is set up for Python3 and will not run on Python2.  This causes the external program PyMOL to fail (http://sourceforge.net/projects/pymol/).  It will probably cause many other Python programs using tk to also fail.
Comment 1 Edward d'Auvergne 2014-04-04 10:56:52 CEST
According to the Pmw sourceforge website http://sourceforge.net/projects/pmw/:

"Python megawidgets is Python 3 compatible through the Pmw 2 download. Pmw 1 is destined for Python 2. Both are now accessible through the new pypi compatible package (credits for which go to Andy Robinson and the team at ReportLab)."

And according to https://pypi.python.org/pypi/Pmw/2.0.0:

"The package contains both Pmw 2.0.0 - the Python 3 version - and Pmw 1.3.3 - the Python 2 version - and installs the correct version automatically."

Therefore it looks like two python-pmw packages need to be distributed in Mageia.  The current package python-pmw-2.0.0-0.3.mga4.noarch is for Python3 (but is installed into the Python2.7 directories), and the Pmw 1.3.3 version needs to be packaged for Python2.  This is probably why python-pmw is broken in Mageia 4.
Comment 2 Edward d'Auvergne 2014-04-04 11:12:22 CEST
As a workaround, if it hasn't already been fixed in Mageia, run the following as root:

# urpme python-pmw    # Uninstall the broken python-pmw package.
# urpmi python-pip    # Install PIP for Python2.
# urpmi python3-pip    # Install PIP for Python3.
# pip install pmw    # Install the PyPI Pmw package for Python2.
# python3-pip install pmw    # Install the PyPI Pmw package for Python3.

Everything should now be functional.  Pwm-1.3.3 is installed in /usr/lib/python2.7/site-packages/Pmw/Pmw_1_3_3, and Pwm-2.0.0 in /usr/lib/python3.3/site-packages/Pmw/Pmw_2_0_0.
claire robinson 2014-04-04 23:25:52 CEST

Assignee: bugsquad => makowski.mageia

Comment 3 Philippe Makowski 2014-04-05 18:07:31 CEST
Suggested advisory:
========================

Updated python-pmw packages fix mga#13143
Python2 and Python3 versions are correctly handled.

Updated packages in core/updates_testing:
========================

python-pmw-2.0.0-0.3.1.mga4.noarch
python3-pmw-2.0.0-0.3.1.mga4.noarch 

From :
python-pmw-2.0.0-0.3.1.mga4.src

Assignee: makowski.mageia => qa-bugs

Comment 4 Philippe Makowski 2014-04-08 15:07:01 CEST
for information, here a link for tests : 
http://pmw.sourceforge.net/doc/howtouse.html

CC: (none) => makowski.mageia

Philippe Makowski 2014-04-12 15:12:57 CEST

Source RPM: (none) => python-pmw
Whiteboard: (none) => has_procedure

Comment 5 Philippe Makowski 2014-04-12 15:28:25 CEST
Under Mageia4 x86_64 :

Before update :

$ LC_ALL="C" sudo urpmi python-pmw
To satisfy dependencies, the following packages are going to be installed:
  Package                        Version      Release       Arch    
(medium "Core Release (local1)")
  blt                            2.5          4.mga4        x86_64  
  python-pmw                     2.0.0        0.3.mga4      noarch  
7.2MB of additional disk space will be used.
1.9MB of packages will be retrieved.
Proceed with the installation of the 2 packages? (Y/n) Y


    http://192.168.0.2/mageia/4/x86_64/media/core/release/blt-2.5-4.mga4.x86_64.rpm
    http://192.168.0.2/mageia/4/x86_64/media/core/release/python-pmw-2.0.0-0.3.mga4.noarch.rpm                          
installing python-pmw-2.0.0-0.3.mga4.noarch.rpm blt-2.5-4.mga4.x86_64.rpm from /var/cache/urpmi/rpms                    
Preparing...                     ######################################################################################
      1/2: blt                   ######################################################################################
      2/2: python-pmw            ######################################################################################
$ LC_ALL="C" python               
Python 2.7.6 (default, Mar 18 2014, 22:18:46) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Pmw
>>> root = Pmw.initialise()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/Pmw/Pmw_2_0_0/lib/PmwLoader.py", line 131, in __getattr__
    self._initialise()
  File "/usr/lib/python2.7/site-packages/Pmw/Pmw_2_0_0/lib/PmwLoader.py", line 89, in _initialise
    raise ImportError(msg)
ImportError: No module named tkinter
>>> exit()

After update :

$ LC_ALL="C" sudo urpmi python-pmw python3-pmw
To satisfy dependencies, the following packages are going to be installed:
  Package                        Version      Release       Arch    
(medium "Core Updates (local3)")
  tkinter3                       3.3.2        13.2.mga4     x86_64  
(medium "Core Updates Testing (local5)")
  python-pmw                     2.0.0        0.3.1.mga4    noarch  
  python3-pmw                    2.0.0        0.3.1.mga4    noarch  
5.1MB of additional disk space will be used.
1.5MB of packages will be retrieved.
Proceed with the installation of the 3 packages? (Y/n) 


    http://192.168.0.2/mageia/4/x86_64/media/core/updates/tkinter3-3.3.2-13.2.mga4.x86_64.rpm
    http://192.168.0.2/mageia/4/x86_64/media/core/updates_testing/python-pmw-2.0.0-0.3.1.mga4.noarch.rpm                
    http://192.168.0.2/mageia/4/x86_64/media/core/updates_testing/python3-pmw-2.0.0-0.3.1.mga4.noarch.rpm               
installing python3-pmw-2.0.0-0.3.1.mga4.noarch.rpm tkinter3-3.3.2-13.2.mga4.x86_64.rpm python-pmw-2.0.0-0.3.1.mga4.noarch.rpm from /var/cache/urpmi/rpms
Preparing...                     ######################################################################################
      1/3: tkinter3              ######################################################################################
      2/3: python3-pmw           ######################################################################################
      3/3: python-pmw            ######################################################################################
      1/1: removing python-pmw-2.0.0-0.3.mga4.noarch
                                 ######################################################################################
$ LC_ALL="C" python
Python 2.7.6 (default, Mar 18 2014, 22:18:46) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Pmw
>>> root = Pmw.initialise()
>>> counter1 = Pmw.Counter()
>>> counter1.pack(padx = 10, pady = 10)
>>> exit()
$ LC_ALL="C" python3
Python 3.3.2 (default, Mar 21 2014, 23:44:23) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import Pmw
>>> root = Pmw.initialise()
>>> counter1 = Pmw.Counter()
>>> counter1.pack(padx = 10, pady = 10)
>>> exit()
$

Whiteboard: has_procedure => has_procedure mga4-64-ok

Comment 6 Arnaud Vacquier 2014-04-13 15:54:58 CEST
Hi,

Under Mageia4 i586 after update testing, i do as Philippe in comment 5
The packages in udpate testing fix the bug. (both fo python / python 3)

CC: (none) => inster.css

Arnaud Vacquier 2014-04-13 15:55:23 CEST

Whiteboard: has_procedure mga4-64-ok => has_procedure mga4-64-ok mga4-32-ok

Comment 7 claire robinson 2014-04-14 16:27:19 CEST
Advisory uploaded.

Before validating Philippe, is there a reason for the strange release numbering of this one?

python-pmw-2.0.0-0.3.1.mga4

I notice it's mkrel 0.3 and subrel 1. Is this expected/correct?

Thanks

Whiteboard: has_procedure mga4-64-ok mga4-32-ok => has_procedure advisory mga4-64-ok mga4-32-ok

Comment 8 Philippe Makowski 2014-04-14 16:56:43 CEST
yes, it was because it was released in mageia4 with an upstream rc release I guess.
Comment 9 claire robinson 2014-04-14 17:02:45 CEST
OK thanks.

Validating.

Could sysadmin please push to 4 updates

Thanks

Keywords: (none) => validated_update
CC: (none) => sysadmin-bugs

Comment 10 Damien Lallement 2014-04-15 20:16:06 CEST
http://advisories.mageia.org/MGAA-2014-0102.html

Status: NEW => RESOLVED
CC: (none) => mageia
Resolution: (none) => FIXED


Note You need to log in before you can comment on or make changes to this bug.