taurus-org / taurus

Moved to https://gitlab.com/taurus-org/taurus
http://taurus-scada.org
43 stars 46 forks source link

taurus designer not loading taurus extensions #1047

Closed dschick closed 4 years ago

dschick commented 4 years ago

Hi,

I have installed the latested taurus version from the develop branch and run it with python 3.6 under Debian.

When I start taurus designer I get the following error in the command line and there are no taurus plugins loaded in the designer:

taurus designer
MainThread     WARNING  2019-12-18 19:23:57,743 TaurusRootLogger: <frozen importlib._bootstrap>:219: DeprecationWarning: taurus.external.qt.Qwt5 is deprecated since 4.5

Traceback (most recent call last):
  File "/home/labuser/.local/lib/python3.6/site-packages/taurus/qt/qtdesigner/containerplugin.py", line 46, in <module>
    from taurus.external.qt import QtDesigner
ImportError: No module named taurus.external.qt
Traceback (most recent call last):
  File "/home/labuser/.local/lib/python3.6/site-packages/taurus/qt/qtdesigner/extraguiqwtplugin.py", line 38, in <module>
    from taurus.core.util.log import debug
ImportError: No module named taurus.core.util.log
Traceback (most recent call last):
  File "/home/labuser/.local/lib/python3.6/site-packages/taurus/qt/qtdesigner/tauruspluginplugin.py", line 31, in <module>
    from taurus.external.qt import QtDesigner
ImportError: No module named taurus.external.qt

The check-deps gives the following result:

Dependencies for taurus 4.6.5a0:
    [*] numpy>=1.1
    [*] pint>=0.8
    [*] future
    [*] click

Extras:
Dependencies for taurus[taurus-epics]:
    [*] numpy>=1.1
    [*] pint>=0.8
    [*] future
    [*] click
    [*] pyepics>=3.2.4
Dependencies for taurus[taurus-h5file]:
    [*] numpy>=1.1
    [*] pint>=0.8
    [*] future
    [*] click
    [*] h5file
Dependencies for taurus[taurus-qt]:
    [*] numpy>=1.1
    [*] pint>=0.8
    [*] future
    [*] click
    [*] ply>=2.3
    [*] lxml>=2.1
    [*] guiqwt>=3
    [*] PyQt4>=4.8 (not in PyPI)
    [ ] PyQt4.Qwt5>=5.2 (not in PyPI)
Dependencies for taurus[taurus-qt-editor]:
    [*] numpy>=1.1
    [*] pint>=0.8
    [*] future
    [*] click
    [*] spyder>=3
Dependencies for taurus[taurus-tango]:
    [*] numpy>=1.1
    [*] pint>=0.8
    [*] future
    [*] click
    [*] PyTango>=7.1

Any dependency clash between PyQt4 and PyQt5?

cmft commented 4 years ago

I did test with develop on Debian9 (python 3.5) with PyQt4 and PyQt5 and I can not reply the errors.


cfalcon@pc253: $ QT_API=pyqt4 ipython3 
In [1]: from taurus.external.qt import QtDesigner
MainThread     INFO     2019-12-19 08:32:28,722 TaurusRootLogger: Using PyQt4 (v4.11.4 with Qt 4.8.7 and Python 3.5.3)

cfalcon@pc253: $ QT_API=pyqt5 ipython3 
In [1]: from taurus.external.qt import QtDesigner

MainThread     INFO     2019-12-19 08:32:52,203 TaurusRootLogger: Using PyQt5 (v5.7 with Qt 5.7.1 and Python 3.5.3)

Do you have these modules?

compat.py  __init__.py  __pycache__  QtCore.py  QtDesigner.py  QtGui.py  QtHelp.py  QtNetwork.py  Qt.py  QtSvg.py  QtUiTools.py  QtWebKit.py  QtWidgets.py  Qwt5.py  uic.py

Seems an installation problem, Could you try to remove the old installation and try again?

cmft commented 4 years ago

It also works in a conda env. using py36

dschick commented 4 years ago

thanks for the quick reply.

here are my results:

QT_API=pyqt4 ipython3
from taurus.external.qt import QtDesigner                                                                     
MainThread     INFO     2019-12-19 13:03:38,763 TaurusRootLogger: Using PyQt4 (v4.12.1 with Qt 4.8.7 and Python 3.6.9)
QT_API=pyqt5 ipython3
from taurus.external.qt import QtDesigner                                                                     
MainThread     INFO     2019-12-19 13:04:06,752 TaurusRootLogger: Using PyQt5 (v5.12.3 with Qt 5.12.6 and Python 3.6.9)

using PyQt4 or PyQt5 I cannot import

import QtUiTools                                                                     
MainThread     WARNING  2019-12-19 13:06:00,563 TaurusRootLogger: <frozen importlib._bootstrap>:219: DeprecationWarning: taurus.external.qt.QtUiTools is deprecated since 4.5. Use PySide(2).QtUiTools or PyQt(4,5).loadUi instead

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-10-9f4ea39c03af> in <module>
----> 1 from taurus.external.qt import QtUiTools

~/.local/lib/python3.6/site-packages/taurus/external/qt/QtUiTools.py in <module>
     41     from PySide.QtUiTools import *
     42 else:
---> 43     raise ImportError('QtUiTools not supported for {}'.format(API_NAME))

ImportError: QtUiTools not supported for PyQt5
from taurus.external.qt import QtWebKit                                                                      
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-11-95ad69697c92> in <module>
----> 1 from taurus.external.qt import QtWebKit

~/.local/lib/python3.6/site-packages/taurus/external/qt/QtWebKit.py in <module>
     30 
     31 if PYQT5:
---> 32     from PyQt5.QtWebKit import *
     33     # import * from QtWebkitWidgets for PyQt4 style compat
     34     from PyQt5.QtWebKitWidgets import *

ModuleNotFoundError: No module named 'PyQt5.QtWebKit'
import Qwt5                                                                          
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-13-fd97f6e5ddae> in <module>
----> 1 from taurus.external.qt import Qwt5

~/.local/lib/python3.6/site-packages/taurus/external/qt/Qwt5.py in <module>
     35     from PyQt4.Qwt5 import *
     36 else:
---> 37     raise ImportError('Qwt5 bindings not supported for {}'.format(API_NAME))

ImportError: Qwt5 bindings not supported for PyQt5
cmft commented 4 years ago

Hola Daniel, You can solve your import troubles:

ImportError: QtUiTools not supported for PyQt5

QtUiTools module is deprecated in taurus. It only makes sense when using PySide(2) (which were not supported before taurus 4.5), So, you need PySide installed

ModuleNotFoundError: No module named 'PyQt5.QtWebKit'

In Py3 qtwebkit was refactored form pyqt5. You can install it : apt install python3-pyqt5.qtwebkit

ImportError: Qwt5 bindings not supported for PyQt5

Qwt5 is not supported in Py3. You can use tauruspyqtgraph instead

dschick commented 4 years ago

thanks @cmft but I do have apt install python3-pyqt5.qtwebkit and tauruspyqtgraph installed

I do also have python3-pyside packages installed using apt.

I use the command:

taurus designer

and the error is still there

reszelaz commented 4 years ago

Hi Daniel,

I was able to reproduce the problem with the QtWebKit. When I use the PyQt5 installed in the system (with Debian package) I don't have any problem. If I install PyQt5 with pip with the --user mode then I can reproduce your problem. I think this is because the QtWebKit installed with python3-pyqt5.qtwebkit package is injected only in the PyQt5 in the system (which make sense to me).

For importing QtUiTools please try it with QT_API=pyside ipython3.

dschick commented 4 years ago

Hi @reszelaz

thanks for your help.

For importing QtUiTools please try it with QT_API=pyside ipython3

This actually works for QtUiTools but then importing QtDesigner does not work anymore.

However, I do have installed python3-pyqt5.qtwebkit via apt and not pip --user. This is what you proposed, right?

Instead of using the taurus designer command, I get the same error when cd into taurus/lib/taurus/qt/qtdesigner/ and executing python3 taurusdesigner.py error message:

python3 taurusdesigner.py
MainThread     INFO     2019-12-19 23:18:26,625 TaurusRootLogger: Using PyQt4 (v4.12.1 with Qt 4.8.7 and Python 3.6.9)
Traceback (most recent call last):
  File "/home/labuser/.local/lib/python3.6/site-packages/taurus/qt/qtdesigner/containerplugin.py", line 46, in <module>
    from taurus.external.qt import QtDesigner
ImportError: No module named taurus.external.qt
Traceback (most recent call last):
  File "/home/labuser/.local/lib/python3.6/site-packages/taurus/qt/qtdesigner/extraguiqwtplugin.py", line 38, in <module>
    from taurus.core.util.log import debug
ImportError: No module named taurus.core.util.log
Traceback (most recent call last):
  File "/home/labuser/.local/lib/python3.6/site-packages/taurus/qt/qtdesigner/tauruspluginplugin.py", line 31, in <module>
    from taurus.external.qt import QtDesigner
ImportError: No module named taurus.external.qt

What I do not understand, that the following commands work without problems:

python3 tauruspluginplugin.py
python3 extraguiqwtplugin.py
python3 containerplugin.py

So isn't this all an import problem of the taurusdesigner.py file?

reszelaz commented 4 years ago

However, I do have installed python3-pyqt5.qtwebkit via apt and not pip --user. This is what you proposed, right?

No, I suspect that you have PyQt5 installed with pip --user. Try in ipython3:

import PyQt5
print(PyQt5.__file__)

This then take precedence over the one in the system, the one which actually has the QtWebToolkit.

dschick commented 4 years ago

of course you are right that I had QtWebToolkit installed both via pip --user and with apt, but I have removed the former one before my last post and now I get

print(PyQt5.__file__) 
/usr/lib/python3/dist-packages/PyQt5/__init__.py

Which should be the system one and I get still the same errors when starting taurus designer

cpascual commented 4 years ago

Note: AFAIK, the designer plugins (which are used by taurus to customize the Qt designer) are not supported by PySide.

In fact, in an environment with just PySide2 and not PyQt4/PyQt5, the taurus designer opens just as a regular Qt designer (i.e. the taurus widgets are not available):

conda create -n pyside2 python=3.7 pyside2 lxml future pillow pint ply numpy scipy click
git clone https://github.com/taurus-org/taurus.git
pip install -e ./taurus
python -m taurus.qt.qtdesigner.taurusdesigner
cpascual commented 4 years ago

Anyway... this is getting too confusing for me to follow because it seems that we are talking about mixed environments here (e.g. @dschick mentions debian-installed packages, but also python3.6 which is not part of any debian distro, it also looks like there were packages installed with pip on $HOME/.local, etc). So I propose to first try to set a clear working environment which we can all set to base this investigation.

So @dschick, please let us know in which environment do you need to have it working:

  1. debian9 using system packages for the deps?
  2. debian10 using system packages for the deps?
  3. conda environment?
  4. other? (name it)
dschick commented 4 years ago

thanks @cpascual for trying to solve that. I am currently working on the latest Linux Mint 19.3 which should be based on Ubuntu 18.04 LTS --> Debian 9, right? I am not using conda at all. So I have installed the qt-related packges via apt out of convinience, but used pip to install e.g. sardana and taurus in the user environment with the--user option.

I could try to install taurus without the --user option to check if it is working.

dschick commented 4 years ago

I somehow solved this issue by using the debian PyQt5 libs instead of the pip3 packages.

Thanks for your help