Bug 10970 - pybootchartgui.py has not been migrated to python3
Summary: pybootchartgui.py has not been migrated to python3
Status: RESOLVED WONTFIX
Alias: None
Product: Meta-yocto
Classification: Build System, Metadata & Runtime
Component: configuration (show other bugs)
Version: 2.3
Hardware: x86 Multiple
: Medium normal
Target Milestone: 2.3 M3
Assignee: Leonardo Sandoval Gonzalez
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2017-01-25 20:39 UTC by Humberto Ibarra
Modified: 2017-01-30 20:16 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Humberto Ibarra 2017-01-25 20:39:23 UTC
Ran pyboothchartgui.py help expecting to get more info on the command, however I found myself with the following error:


[humberto@localhost build]$ ../scripts/pybootchartgui/pybootchartgui.py --help
Traceback (most recent call last):
  File "../scripts/pybootchartgui/pybootchartgui.py", line 20, in <module>
    from pybootchartgui.main import main
  File "/home/humberto/poky-meta-yocto/scripts/pybootchartgui/pybootchartgui/main.py", line 24, in <module>
    from . import batch
  File "/home/humberto/poky-meta-yocto/scripts/pybootchartgui/pybootchartgui/batch.py", line 16, in <module>
    import cairo
ImportError: No module named cairo


It seems like this is caused because pybootchartgui hasn't been migrated to python3 yet.
Comment 1 Leonardo Sandoval Gonzalez 2017-01-26 18:01:16 UTC
Humberto,

Do you have the cairo python module installed? I tried just the --help command and worked fine.
Comment 2 brian avery 2017-01-27 21:16:46 UTC
help also worked for me on ubuntu 14.04. I do have cairo installed as a python module.
Comment 3 Humberto Ibarra 2017-01-30 17:15:43 UTC
I have python3-cairo installed, what I don't have is the pycairo package for python2. Am I supposed to install python2 cairo package for this to work? I thought we were fully on python3 already.

[humberto@localhost build]$ sudo dnf install python3-cairo
Last metadata expiration check: 0:01:29 ago on Mon Jan 30 11:14:47 2017.
Package python3-cairo-1.10.0-15.fc24.x86_64 is already installed, skipping.
Dependencies resolved.
Nothing to do.
Complete!
[humberto@localhost build]$ sudo dnf install pycairo
Last metadata expiration check: 0:01:35 ago on Mon Jan 30 11:14:47 2017.
Dependencies resolved.
===================================================================================================================================================================================================================
 Package                                              Arch                                            Version                                                Repository                                       Size
===================================================================================================================================================================================================================
Installing:
 pycairo                                              x86_64                                          1.10.0-4.fc24                                          fedora                                          481 k
 python-xpyb                                          x86_64                                          1.3.1-6.fc24                                           fedora                                          138 k

Transaction Summary
===================================================================================================================================================================================================================
Install  2 Packages

Total download size: 619 k
Installed size: 2.2 M
Is this ok [y/N]: N
Operation aborted.
[humberto@localhost build]$ python3
Python 3.5.1 (default, Sep 19 2016, 10:16:17) 
[GCC 6.1.1 20160621 (Red Hat 6.1.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cairo
>>> quit()
[humberto@localhost build]$ python
Python 2.7.12 (default, Sep 29 2016, 13:30:34) 
[GCC 6.2.1 20160916 (Red Hat 6.2.1-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cairo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named cairo
>>> quit()
[humberto@localhost build]$ ../scripts/pybootchartgui/pybootchartgui.py -h
Traceback (most recent call last):
  File "../scripts/pybootchartgui/pybootchartgui.py", line 20, in <module>
    from pybootchartgui.main import main
  File "/home/humberto/poky-skd/scripts/pybootchartgui/pybootchartgui/main.py", line 24, in <module>
    from . import batch
  File "/home/humberto/poky-skd/scripts/pybootchartgui/pybootchartgui/batch.py", line 16, in <module>
    import cairo
ImportError: No module named cairo
[humberto@localhost build]$
Comment 4 Leonardo Sandoval Gonzalez 2017-01-30 17:32:46 UTC
(In reply to comment #3)
> I have python3-cairo installed, what I don't have is the pycairo package for
> python2. Am I supposed to install python2 cairo package for this to work? I
> thought we were fully on python3 already.
> 
> [humberto@localhost build]$ sudo dnf install python3-cairo
> Last metadata expiration check: 0:01:29 ago on Mon Jan 30 11:14:47 2017.
> Package python3-cairo-1.10.0-15.fc24.x86_64 is already installed, skipping.
> Dependencies resolved.
> Nothing to do.
> Complete!
> [humberto@localhost build]$ sudo dnf install pycairo
> Last metadata expiration check: 0:01:35 ago on Mon Jan 30 11:14:47 2017.
> Dependencies resolved.
> =============================================================================
> =============================================================================
> =========================================================
>  Package                                              Arch                  
> Version                                                Repository           
> Size
> =============================================================================
> =============================================================================
> =========================================================
> Installing:
>  pycairo                                              x86_64                
> 1.10.0-4.fc24                                          fedora               
> 481 k
>  python-xpyb                                          x86_64                
> 1.3.1-6.fc24                                           fedora               
> 138 k
> 
> Transaction Summary
> =============================================================================
> =============================================================================
> =========================================================
> Install  2 Packages
> 
> Total download size: 619 k
> Installed size: 2.2 M
> Is this ok [y/N]: N
> Operation aborted.
> [humberto@localhost build]$ python3
> Python 3.5.1 (default, Sep 19 2016, 10:16:17) 
> [GCC 6.1.1 20160621 (Red Hat 6.1.1-3)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import cairo
> >>> quit()
> [humberto@localhost build]$ python
> Python 2.7.12 (default, Sep 29 2016, 13:30:34) 
> [GCC 6.2.1 20160916 (Red Hat 6.2.1-2)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import cairo
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: No module named cairo
> >>> quit()
> [humberto@localhost build]$ ../scripts/pybootchartgui/pybootchartgui.py -h
> Traceback (most recent call last):
>   File "../scripts/pybootchartgui/pybootchartgui.py", line 20, in <module>
>     from pybootchartgui.main import main
>   File
> "/home/humberto/poky-skd/scripts/pybootchartgui/pybootchartgui/main.py",
> line 24, in <module>
>     from . import batch
>   File
> "/home/humberto/poky-skd/scripts/pybootchartgui/pybootchartgui/batch.py",
> line 16, in <module>
>     import cairo
> ImportError: No module named cairo
> [humberto@localhost build]$

the shebang (#!) indicates python, and most distros python point to python 2 so you try installing the module on the latter:


lsandov1@lsandov1-mobl2:~/poky$ which python
/usr/bin/python
lsandov1@lsandov1-mobl2:~/poky$ ls -la /usr/bin/python
lrwxrwxrwx 1 root root 9 Mar 16  2015 /usr/bin/python -> python2.7
Comment 5 Humberto Ibarra 2017-01-30 18:07:03 UTC
So, is this script expected to work with python2 and its libraries and not python3? If so, is there a mention to this in the documentation?

I thought Mega-Manual marked Python3 as yocto dependency and python2 was added as an openembedded dependency. So, is this script part of openembedded? If this script is meant to be run with python2, I find it weird that I got this issue in the first place. Is cairo module not installed by default with python2? Not sure if the user is supposed to have or install this library on his own or if it should be mentioned in the manual as a dependency.
Comment 6 Humberto Ibarra 2017-01-30 20:16:44 UTC
Leonardo told me that there was no place to put dependencies for the scripts in scripts/ folder. Closing this.