uvemas / ViTables

ViTables, a GUI for PyTables
GNU General Public License v3.0
151 stars 53 forks source link

pyside support? #96

Open nilswagner opened 4 years ago

nilswagner commented 4 years ago

Does ViTables intend to support pyside?

uvemas commented 4 years ago

Well, ViTables uses qtpy so in theory it supports pyside. But in practice there is a problem: vitables makes use of loadUIType() function from the uic module. It seems this function doesn't exist in pyside so vitables won't run out of the box with pyside. I don't plan to work on this issue in the next future (but PRs are welcome).

In addition it seems there are compatibility problems whit pip packages for pyside and qtpy. For instance, python-3.8.0 and the latest pyside2 don't work well together (at least for me). The same happens with the latest versions of qtpy and pyside2. However those problems do not exist when installing qtpy and pyside2 in a conda environment.

avalentino commented 4 years ago

Hi @uvemas, hi @nilswagner, I submitted a PR (spyder-ide/qtpy#202) to QtPy providing an implementation of loadUIType(). The PR has been still not accepted, but maybe you may want to give it a try.

uvemas commented 4 years ago

Hi @avalentino, thanks for your comment. Your implementation looks promising. I'll give it a try for sure.

AgilentGCMS commented 4 years ago

Is there a way to tell vitables to not use pyside?

I recently installed vitables using pip3 install vitables, but trying to start vitables gets me this error message:

$ vitables
Traceback (most recent call last):
  File "/Users/sbasu1/packages/macports/bin/vitables", line 5, in <module>
    from vitables.start import gui
  File "/Users/sbasu1/packages/macports/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/vitables/start.py", line 31, in <module>
    from vitables.vtapp import VTApp
  File "/Users/sbasu1/packages/macports/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/vitables/vtapp.py", line 36, in <module>
    import vitables.utils
  File "/Users/sbasu1/packages/macports/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/vitables/utils.py", line 41, in <module>
    import vitables.vtwidgets.renamedlg as renamedlg
  File "/Users/sbasu1/packages/macports/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/vitables/vtwidgets/renamedlg.py", line 52, in <module>
    from qtpy.uic import loadUiType
ImportError: cannot import name 'loadUiType' from 'qtpy.uic' (/Users/sbasu1/packages/macports/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/qtpy/uic.py)

Googling around brought me to this bug report. Sure enough, if I look at qtpy/uic.py, both PYQT4 and PYQT5 are False inside, so loadUiType is not defined. I have PyQt5 installed, so I don't need to use pyside. But how do I tell vitables to not use pyside? Just uninstalling pyside doesn't work, it then throws this error:

$ vitables
Traceback (most recent call last):
  File "/Users/sbasu1/packages/macports/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/qtpy/__init__.py", line 204, in <module>
    from PySide import __version__ as PYSIDE_VERSION  # analysis:ignore
ModuleNotFoundError: No module named 'PySide'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sbasu1/packages/macports/bin/vitables", line 5, in <module>
    from vitables.start import gui
  File "/Users/sbasu1/packages/macports/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/vitables/start.py", line 28, in <module>
    import qtpy.QtCore as qtcore
  File "/Users/sbasu1/packages/macports/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/qtpy/__init__.py", line 210, in <module>
    raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found

Help?

uvemas commented 4 years ago

Hi @AgilentGCMS,

ViTables does NOT use pyside by default. It uses qtpy, which by default uses PyQt (if several bindings are installed). If you have PyQt5 and ViTables installed for the same Python interpreter it should run out of the box.

From your error message 'No Qt bindings could be found' it seems that ViTables doesn't find any Qt bindings installed (nor PyQt neither PySide).

Can you create a new virtual environment and install ViTables again? It should install qtpy and pyqt5 as dependencies and run just fine.

PS: your problem is not the same than the issue used to open this thread. Please, open a new issue if the lines above don't help you. Thanks

AgilentGCMS commented 4 years ago

OK, will do.

stonebig commented 2 years ago

PySide2-5.15.2 is the only Qt currently available on Python-3.10 / Windows and compatible with Spyder (by removing PyQt wheel dependancy).

Wouldn't it make sense, if you use QtPy, to NOT make PyQt5 a wheel dependancy for vitables too ?