Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
problems with pyqtgraph, pyuic4 and pyqtgraph example files
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
mikefot
l33t
l33t


Joined: 19 Nov 2014
Posts: 709

PostPosted: Sun Nov 19, 2017 3:50 pm    Post subject: problems with pyqtgraph, pyuic4 and pyqtgraph example files Reply with quote

Dear Gentoo folks,

I am interested to learn a bit about plotting 3d surfaces with matplotlib using pyqtgraph and Qt designer as a gui/interface set up.

I googled around and looked at some websites on this and a number of videos before having a go with this.

Amongst other things, I found a web site here:

https://nikolak.com/pyqt-qt-designer-getting-started/

and got some general info in this area.

This helpful site tells you that e.g. in Debian or Ubuntu you would enter the following commands at the terminal to install relevant packages etc:


Code:
$ apt-get install python-qt4 pyqt4-dev-tools qt4-designer


and then if you run

Code:
$ pyuic4
Error: one input ui-file must be specified


you are looking good here

BUT

if you would get

Code:
"command not found"


etc that would NOT be good and need to google around etc and find a way of fixing that problem.....

In this case I am interested to install pyqtgraph not just pyqt but still.......

It's giving me some useful hints at this stage I reckon.

I then successfully installed matplotlib, pyqtgraph and qtdesigner on my Gentoo installation (amd64-stable/kaveri box).

I had a look at the pyqtgraph website for some hints on installation and use of the software http://www.pyqtgraph.org/.

I tried running
Code:
pyuic4


and you guessed it, I obtained the
Code:
"command not found"
response under Gentoo (but it worked as recommended in debian which I have also been experimenting with).

Suggestions on fixing this IF it is actually required in a Gentoo installation of pyqtgraph are most welcome.

I also tried running qtdesigner. It ran OK but there was no desktop icon for it and so I ran it from the terminal prompt; the executable lives in /usr/bin.

I then found a video on youtube: https://www.youtube.com/watch?v=vSbyDoXqAJI

where the author had pyqtgraph running on a Mac laptop of some kind.

This chap had managed to download some pyqtgraph example plot files written in python and entered some simple commands at the terminal prompt and was able to display them.

E.g.
Code:
$python Plotting.py


or something very similar etc.

I copied the pyqtgraph example files from the github repository to my home user directory.

I then tried running e.g.

Code:
$python Plotting.py


etc the terminal prompt as he did but I got a grumble from the interpreter that the module was not in the python path...

I then googled around and found some instructions on adding the path to my copy of the pyqtgraph example files and ran it.

I then checked to see if the new path really had been added to the paths already known to python and it appeared to have worked.

But when I then tried running

Code:
$python Plotting.py


it still failed with more gripes from the interpreter.

I will run it again shortly and post up the output on this in more detail.

I am groping around in the dark a bit here with this. I would appreciate any general hints or pointers to do somewhat better with this.

For example people seem to suggest that running Qt designer with pyqtgraph is a good match.

But others seem to run pyqtgraph with something called jupyter or alternatively another package called panda.

Comments and suggestions on how to familarise myself more adequately here would be appreciated. It would also be helpful
to know that I have installed and configured all the packages I need for this endeavour properly.

Regards

Michael Fothergill


Last edited by mikefot on Sun Nov 19, 2017 5:36 pm; edited 2 times in total
Back to top
View user's profile Send private message
mikefot
l33t
l33t


Joined: 19 Nov 2014
Posts: 709

PostPosted: Sun Nov 19, 2017 5:28 pm    Post subject: more relevant output on pyqtgraph trials Reply with quote

Dear All,

I have posted this here and on the pyqtgraph support forum:

Here are the example plot files I mentioned in the previous posting:

Code:
djt /home/mikef/pyqtgraph-examples/pyqtgraph-develop/examples # ls

Arrow.py                         GradientWidget.py            py2exe
BarGraphItem.py                  GraphicsLayout.py            __pycache__
beeswarm.py                      GraphicsScene.py             relativity
CLIexample.py                    GraphItem.py                 relativity_demo.py
ColorButton.py                   hdf5.py                      RemoteGraphicsView.py
ConsoleWidget.py                 HistogramLUT.py              RemoteSpeedTest.py
contextMenu.py                   histogram.py                 ROIExamples.py
crosshair.py                     imageAnalysis.py             ROItypes.py
customGraphicsItem.py            ImageItem.py                 ScaleBar.py
CustomGraphItem.py               ImageView.py                 ScatterPlot.py
customPlot.py                    infiniteline_performance.py  ScatterPlotSpeedTest.py
cx_freeze                        InfiniteLine.py              ScatterPlotSpeedTestTemplate_pyqt.py
DataSlicing.py                   initExample.py               ScatterPlotSpeedTestTemplate_pyside.py
DataTreeWidget.py                __init__.py                  ScatterPlotSpeedTestTemplate.ui
designerExample.py               isocurve.py                  ScatterPlotWidget.py
designerExample.ui               JoystickButton.py            scrollingPlots.py
dockarea.py                      Legend.py                    SimplePlot.py
Draw.py                          linkedViews.py               SpinBox.py
ErrorBarItem.py                  logAxis.py                   Symbols.py
exampleLoaderTemplate_pyqt5.py   LogPlotTest.py               TableWidget.py
exampleLoaderTemplate_pyqt.py    __main__.py                  template.py
exampleLoaderTemplate_pyside.py  MouseSelection.py            test_examples.py
exampleLoaderTemplate.ui         MultiplePlotAxes.py          text.py
FillBetweenItem.py               multiplePlotSpeedTest.py     TreeWidget.py
FlowchartCustomNode.py           MultiPlotSpeedTest.py        utils.py
Flowchart.py                     MultiPlotWidget.py           verlet_chain
GLBarGraphItem.py                multiprocess.py              verlet_chain_demo.py
GLImageItem.py                   optics                       VideoSpeedTest.py
GLIsosurface.py                  optics_demos.py              VideoTemplate_pyqt5.py
GLLinePlotItem.py                PanningPlot.py               VideoTemplate_pyqt.py
GLMeshItem.py                    parallelize.py               VideoTemplate_pyside.py
GLScatterPlotItem.py             parametertree.py             VideoTemplate.ui
GLshaders.py                     PlotAutoRange.py             ViewBoxFeatures.py
GLSurfacePlot.py                 PlotSpeedTest.py             ViewBox.py
GLViewWidget.py                  Plotting.py                  ViewLimits.py
GLVolumeItem.py                  PlotWidget.py
GradientEditor.py                ProgressDialog.py


Here is the module path crash:

Code:
djt /home/mikef/pyqtgraph-examples/pyqtgraph-develop/examples # !486
python /home/mikef/pyqtgraph-examples/pyqtgraph-develop/examples/Plotting.py
Traceback (most recent call last):
  File "/home/mikef/pyqtgraph-examples/pyqtgraph-develop/examples/Plotting.py", line 8, in <module>
    import initExample ## Add path to library (just for examples; you do not need this)
  File "/home/mikef/pyqtgraph-examples/pyqtgraph-develop/examples/initExample.py", line 30, in <module>
    from pyqtgraph.Qt import QtGui
  File "/usr/lib64/python3.4/site-packages/pyqtgraph/__init__.py", line 13, in <module>
    from .Qt import QtGui
  File "/usr/lib64/python3.4/site-packages/pyqtgraph/Qt.py", line 153, in <module>
    from PyQt5 import QtGui, QtCore, QtWidgets, uic
ImportError: cannot import name 'QtWidgets'


So I did this to try to fix the path problem:

Code:
djt /home/mikef/pyqtgraph-examples/pyqtgraph-develop/examples # python
Python 3.4.5 (default, Sep 17 2017, 11:21:18)
[GCC 5.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.path)
['', '/usr/lib64/python34.zip', '/usr/lib64/python3.4', '/usr/lib64/python3.4/plat-linux', '/usr/lib64/python3.4/lib-dynload', '/usr/lib64/python3.4/site-packages']
>>> import sys
>>> sys.path.insert(0, "/home/mikef/pyqtgraph-examples/pyqtgraph-develop/examples")
>>> import sys
>>> print(sys.path)
['/home/mikef/pyqtgraph-examples/pyqtgraph-develop/examples', '', '/usr/lib64/python34.zip', '/usr/lib64/python3.4', '/usr/lib64/python3.4/plat-linux', '/usr/lib64/python3.4/lib-dynload', '/usr/lib64/python3.4/site-packages']
>>>
KeyboardInterrupt
>>> print(sys.path)
['/home/mikef/pyqtgraph-examples/pyqtgraph-develop/examples', '', '/usr/lib64/python34.zip', '/usr/lib64/python3.4', '/usr/lib64/python3.4/plat-linux', '/usr/lib64/python3.4/lib-dynload', '/usr/lib64/python3.4/site-packages']
>>>


Then I closed the file with ctrl D (please correct me if I am getting it wrong here).

It still doesn't cure the problem.


Code:
djt /home/mikef/pyqtgraph-examples/pyqtgraph-develop/examples # python /home/mikef/pyqtgraph-examples/pyqtgraph-develop/examples/Plotting.py
Traceback (most recent call last):
  File "/home/mikef/pyqtgraph-examples/pyqtgraph-develop/examples/Plotting.py", line 8, in <module>
    import initExample ## Add path to library (just for examples; you do not need this)
  File "/home/mikef/pyqtgraph-examples/pyqtgraph-develop/examples/initExample.py", line 30, in <module>
    from pyqtgraph.Qt import QtGui
  File "/usr/lib64/python3.4/site-packages/pyqtgraph/__init__.py", line 13, in <module>
    from .Qt import QtGui
  File "/usr/lib64/python3.4/site-packages/pyqtgraph/Qt.py", line 153, in <module>
    from PyQt5 import QtGui, QtCore, QtWidgets, uic
ImportError: cannot import name 'QtWidgets'
djt /home/mikef/pyqtgraph-examples/pyqtgraph-develop/examples #


Once again, suggestions are most welcome on how to proceed here.

Cheers

Michael Fothergill
Back to top
View user's profile Send private message
mikefot
l33t
l33t


Joined: 19 Nov 2014
Posts: 709

PostPosted: Sun Nov 19, 2017 6:59 pm    Post subject: I seem to have more than one version of dev-qt/designer Reply with quote

Dear Folks,

I seem to have more than one version of dev-qt/designer:


Code:
djt /home/mikef/pyqtgraph-examples/pyqtgraph-develop/examples # equery -q l designer
dev-qt/designer-4.8.7
dev-qt/designer-5.7.1

I tried removing them individually and ran eix-update a few times but emerge just wants to reinstall both versions.........


I only seem to have the one version of qtwidgets installed:

Code:
djt /home/mikef/pyqtgraph-examples/pyqtgraph-develop/examples # equery -q l qtwidgets
dev-qt/qtwidgets-5.7.1


Comments appreciated

Regards

MF
Back to top
View user's profile Send private message
mikefot
l33t
l33t


Joined: 19 Nov 2014
Posts: 709

PostPosted: Sun Nov 19, 2017 9:29 pm    Post subject: I have got the example plots working in debian.... Reply with quote

Dear Folks,

I tried running python on the example files in Debian and it worked!

I will see if I can get Qt4 designer working with pyqtgraph and produce myown simple plot.

With a bit more hacking I think I should be able to get Gentoo on the go here with it as well.

Cheers

MF
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum