Review Request 120567: Porting Cantor Python2 backend to Python3

Minh Ngo nlminhtl at gmail.com
Tue Nov 4 08:04:02 UTC 2014



> On Oct. 19, 2014, 8:29 p.m., Filipe Saraiva wrote:
> > Hello Minh Ngo, first thanks for your contribution and sorry for the delay.
> > 
> > I think your contribution is a good way to provide Python 3 support. I would like to provide Python 2 and Python 3 supports together, and you contribution provide it. Then, thank you and congratulation for this.
> > 
> > But I would like to merge your contribution only after the Qt5/KF5 port of Cantor, because that is the high priority for now.
> > 
> > On your contribution, I would like to give these feedbacks:
> > 
> > **1 - FindPython3.cmake**
> > 
> > I can not to find/compile Python 3 backend with your FindPython3.cmake. I need to provide a hardcoded ```SET (PYTHON3_INCLUDE_DIR /usr/include/python3.4m)``` in line 3 of FindPython3.cmake to compile it. Maybe could you to provide some generic way to do it? See for example [FindLuaJIT.cmake](https://projects.kde.org/projects/kde/kdeedu/cantor/repository/revisions/master/entry/cmake/FindLuaJIT.cmake).
> > 
> > **2 - Error when import modules**
> > 
> > I am using Mageia Cauldron x86_64, and unfortunatelly I can not to import modules in Python 3 backend - but I can to do it in Python 3 terminal without problem.
> > 
> > For example, I get the error below when I run *import numpy* in Cantor + Python 3:
> > 
> > ```Traceback (most recent call last):
> > File "", line 1, in 
> > File "/usr/lib64/python3.4/site-packages/numpy/__init__.py", line 153, in 
> > from . import add_newdocs
> > File "/usr/lib64/python3.4/site-packages/numpy/add_newdocs.py", line 13, in 
> > from numpy.lib import add_newdoc
> > File "/usr/lib64/python3.4/site-packages/numpy/lib/__init__.py", line 8, in 
> > from .type_check import *
> > File "/usr/lib64/python3.4/site-packages/numpy/lib/type_check.py", line 11, in 
> > import numpy.core.numeric as _nx
> > File "/usr/lib64/python3.4/site-packages/numpy/core/__init__.py", line 6, in 
> > from . import multiarray
> > ImportError: /usr/lib64/python3.4/site-packages/numpy/core/multiarray.cpython-34m.so: undefined symbol: PyExc_SystemError
> > ```
> > 
> > Do you have some idea about it? Which your OS and Python 3 version?
> > 
> > 
> > Let's keep the work to merge it in the future!
> > Best regard;
> 
> Minh Ngo wrote:
>     Hi Filipe,
>     
>     Hm, probably, the second error is a consequence of the first. I will fix it ASAP.
>     
>     Best regards,
>     
>     Minh
> 
> Minh Ngo wrote:
>     Hi Filipe,
>     
>     A problem is that for KDE applications the command cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` .. is usually used for configuring instead of cmake $KDE_SRC -DCMAKE_INSTALL_PREFIX=$KDEDIR, that is from the README file of the cantor project.
>     
>     As a result, in the first case the variable ${INCLUDE_INSTALL_DIR} is equal to /usr/include/kde4, in the second (I have tried on my PC) is /include. Therefore, when you run the second command, my script cannot find anything.
>     
>     But yes, I think it will better if you, as a project owner, will make a decision about that :).
>     
>     Best regards,
>     
>     Minh

I meant this command https://gist.github.com/Ignotus/40b8ae51cede0bcaaf0b . Markdown has deleted symbols from the previous message :)


- Minh


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/120567/#review68722
-----------------------------------------------------------


On Oct. 12, 2014, 8:54 p.m., Minh Ngo wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/120567/
> -----------------------------------------------------------
> 
> (Updated Oct. 12, 2014, 8:54 p.m.)
> 
> 
> Review request for KDE Edu, Alexander Rieder and Filipe Saraiva.
> 
> 
> Repository: cantor
> 
> 
> Description
> -------
> 
> Hi,
> 
> I have ported Python2 backend to Python3.
> 
> There is some bug in the default cmake script for finding PythonLibs script so it cannot find PythonLibs3 now http://www.cmake.org/Bug/print_bug_page.php?bug_id=13794, therefore I decided to write my own script (FindPythonLibs3.cmake).
> 
> Headers moving were made to make it compilible. See more: http://stackoverflow.com/questions/20300201/why-python-h-of-python-3-2-must-be-included-as-first-together-with-qt4
> 
> Regards,
> 
> Minh
> 
> 
> Diffs
> -----
> 
>   src/backends/python3/CMakeLists.txt PRE-CREATION 
>   src/backends/python3/python3backend.desktop PRE-CREATION 
>   src/backends/CMakeLists.txt 687e5d6 
>   src/backends/python2/python2backend.cpp 2b724f1 
>   src/backends/python2/python2backend.kcfg 22564c1 
>   src/backends/python2/python2completionobject.cpp 08c00c3 
>   src/backends/python2/python2expression.cpp 32a7380 
>   src/backends/python2/python2session.h bb6650d 
>   src/backends/python2/python2session.cpp 513f6ec 
>   src/backends/python2/python2utils.h PRE-CREATION 
>   src/backends/python3/python3backend.kcfg PRE-CREATION 
> 
> Diff: https://git.reviewboard.kde.org/r/120567/diff/
> 
> 
> Testing
> -------
> 
> Looks like it works :)
> 
> Have done some simple things like that:
> import numpy as np
> a = np.array([1, 2, 3])
> print(a)
> 
> 
> Thanks,
> 
> Minh Ngo
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-edu/attachments/20141104/7f59e14d/attachment.html>


More information about the kde-edu mailing list