some scripts possibly not compatible with python 2.5

Bug #416906 reported by Václav Šmilauer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Yade
Fix Released
Low
Unassigned

Bug Description

Python 2.5 should be fully supported because it is in lenny, squeeze and hardy, which we want to support for 0.20. All scripts should be checked that they work with python 2.5. The initial report was use of itertools.product in yade.pack by Janek.

Changed in yade:
importance: Undecided → Low
milestone: none → 0.20-0
Revision history for this message
Janek Kozicki (cosurgi) wrote :

since I have 2.5 here I can check this, just tell me which scripts should I run? All scripts from yade/scripts and yade/scripts/test and yade/examples ?

I can do it like this for example:

  find -iname "*py" -exec yade {} \; > RESULT 2>&1

Revision history for this message
Václav Šmilauer (eudoxos) wrote :

Hm, that wouldn't work, some of the scripts don't exit automatically etc.

Can you run by hand just a few?

scripts/regression-tests.py (fast)
examples/concrete/uniaxial/rb.py (takes longer the first time)
scripts/test: clump.py pack-cloud.py pack-predicates.py regular-sphere-pack.py interpolating-force.py

Most problems should be spotted this way, I guess.

Thanks.

Revision history for this message
Janek Kozicki (cosurgi) wrote :
Download full text (4.3 KiB)

ok, I tried them all. Only two seem to produce errors:

rb.py:

INFO /home/janek/tmp/ZZ/yade/core/yade.cpp:266 main: Loading /home/janek/.yade-ZZ-test-fast/preferences.xml
INFO /home/janek/tmp/ZZ/yade/core/yade.cpp:268 main: Loading plugins
INFO gui/qt3/YadeQtMainWindow.cpp:64 YadeQtMainWindow: Loading configuration file: /home/janek/.yade-ZZ-test-fast/QtGUIPreferences.xml.
Python TCP server listening on localhost:9001, auth cookie is `kuadse'
/usr/lib/python2.5/site-packages/pytz/__init__.py:32: UserWarning: Module dateutil was already imported from /usr/lib/pymodules/python2.5/dateutil/__init__.py, but /usr/lib/pymodules/python2.5 is being added to sys.path
  from pkg_resources import resource_stream
Traceback (most recent call last):
  File "/home/janek/tmp/ZZ/BIN/lib/yade-ZZ-test-fast/gui/PythonUI_rc.py", line 128, in <module>
    execfile(runtime.script)
  File "../../yade/examples/concrete/uniaxial/rb.py", line 66, in <module>
    spheres=pack.triaxialPack(pack.inHyperboloid((0,0,-.5*specimenLength),(0,0,.5*specimenLength),.25*specimenLength,.2*specimenLength),radius=sphereRadius,memoizeDb='/tmp/triaxPackCache.sqlite',young=young,poisson=poisson,frictionAngle=frictionAngle,physParamsClass='CpmMat',density=density)
  File "/home/janek/tmp/ZZ/BIN/lib/yade-ZZ-test-fast/py/yade/pack.py", line 228, in triaxialPack
    if type(predicate)==inGtsSurface and useOBB:
NameError: global name 'inGtsSurface' is not defined

interpolating-force.py:

INFO /home/janek/tmp/ZZ/yade/core/yade.cpp:266 main: Loading /home/janek/.yade-ZZ-test-fast/preferences.xml
INFO /home/janek/tmp/ZZ/yade/core/yade.cpp:268 main: Loading plugins
INFO gui/qt3/YadeQtMainWindow.cpp:64 YadeQtMainWindow: Loading configuration file: /home/janek/.yade-ZZ-test-fast/QtGUIPreferences.xml.
Python TCP server listening on localhost:9001, auth cookie is `csakud'
/usr/lib/python2.5/site-packages/pytz/__init__.py:32: UserWarning: Module dateutil was already imported from /usr/lib/pymodules/python2.5/dateutil/__init__.py, but /usr/lib/pymodules/python2.5 is being added to sys.path
  from pkg_resources import resource_stream
Running script ../../yade/scripts/test/interpolating-force.py
INFO /home/janek/tmp/ZZ/yade/core/Omega.cpp:270 saveSimulation: Saving file :memory:
INFO gui/qt3/GLViewer.cpp:368 centerScene: Less than 500 bodies, moving possible. Select with shift, press 'm' to move.
INFO pkg/common/RenderingEngine/OpenGLRenderingEngine/OpenGLRenderingEngine.cpp:68 initgl: (re)initializing GL for gldraw methods.

Traceback (most recent call last):
  File "/home/janek/tmp/ZZ/BIN/lib/yade-ZZ-test-fast/gui/PythonUI_rc.py", line 128, in <module>
    execfile(runtime.script)
  File "../../yade/scripts/test/interpolating-force.py", line 68, in <module>
    yp.plot()
  File "/home/janek/tmp/ZZ/BIN/lib/yade-ZZ-test-fast/py/yade/plot.py", line 98, in plot
    pylab.figure()
  File "/usr/lib/python2.5/site-packages/matplotlib/pyplot.py", line 260, in figure
    draw_if_interactive()
  File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_tkagg.py", line 61, in draw_if_interactive
    figManager.show()
  File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_tkagg...

Read more...

Revision history for this message
Janek Kozicki (cosurgi) wrote :

the errors in interpolating-force.py seem to be related to those empty "tk" windows that open by themselves. I suppose that they should contain some graph.

Revision history for this message
Václav Šmilauer (eudoxos) wrote :

1. Can you retry examples/concrete/uniaxia/rb.py with r1717? You compiled without GTS, right?

2. Can you try scripts/simple-scene-graph.py and type yp.plot.plot() after a while it runs? It seems like error of your matplotlib installation or the initialization. If that doesn't work, please try commenting out the "matplotlib.use('TkAgg')" line at the beginning of py/plot.py, or try using some of the other backends (GTKCairo and QtAgg), if that makes any difference.

Thanks

Revision history for this message
Janek Kozicki (cosurgi) wrote :

in r1717 rb.py runs. I can see some spheres being compresses. Should I let it run for some time?

python-matplotlib version 0.98.3-5

It just worked when using GTKCairo - I can see two plots.

so maybe I would need to install some package to have it working with Tcl?

with QtAgg it segfaults, backtrace showing a problem with qt (and nothing useful at all):

(gdb) bt
#0 0x00007f0c1290f383 in QBoxLayout::setupGeom () from /usr/lib/libqt-mt.so.3
#1 0x00007f0c129102a0 in QBoxLayout::setGeometry () from /usr/lib/libqt-mt.so.3
#2 0x00007f0bd447ed19 in sipQHBoxLayout::setGeometry () from /usr/lib/pymodules/python2.5/qt.so
#3 0x00007f0c128cc81b in QLayout::activate () from /usr/lib/libqt-mt.so.3
#4 0x00007f0c128ccaea in QLayout::eventFilter () from /usr/lib/libqt-mt.so.3
#5 0x00007f0bd447f39b in sipQHBoxLayout::eventFilter () from /usr/lib/pymodules/python2.5/qt.so
#6 0x00007f0c12925972 in QObject::activate_filters () from /usr/lib/libqt-mt.so.3
#7 0x00007f0c129259c7 in QObject::event () from /usr/lib/libqt-mt.so.3
#8 0x00007f0c12956df3 in QWidget::event () from /usr/lib/libqt-mt.so.3
#9 0x00007f0bd45cca6b in sipQWidget::event () from /usr/lib/pymodules/python2.5/qt.so
#10 0x00007f0c128d0953 in QApplication::internalNotify () from /usr/lib/libqt-mt.so.3
#11 0x00007f0c128d162e in QApplication::notify () from /usr/lib/libqt-mt.so.3
#12 0x00007f0c128d203a in QApplication::sendPostedEvents () from /usr/lib/libqt-mt.so.3
#13 0x00007f0c128869dd in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
#14 0x00007f0c128e5001 in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
#15 0x00007f0c128e4eb2 in QEventLoop::exec () from /usr/lib/libqt-mt.so.3
#16 0x00007f0be23508c7 in QtGUI::run () from /home/janek/tmp/ZZ/BIN/lib/yade-ZZ-test-fast/gui/libQtGUI.so
#17 0x000000000047dcb7 in main ()

I need to leave for today. see you on monday, maybe sunday.

Revision history for this message
Václav Šmilauer (eudoxos) wrote :

Oh yes, let run rb.py till the very end, it should report tensile/compressive strength, save the curve to gnuplot file and exit (much faster with the optimized build).

Revision history for this message
Janek Kozicki (cosurgi) wrote :

OK, I let it run until the end... and it produced one file (in the attachment), and an error:

INFO pkg/dem/Engine/DeusExMachina/TriaxialCompressionEngine.cpp:234 applyCondition: UnbalancedForce=0.024853, rel stress 0.0048636
Packing saved to the database /tmp/triaxPackCache.sqlite
Traceback (most recent call last):
  File "/home/janek/tmp/ZZ/BIN/lib/yade-ZZ-test-fast/gui/PythonUI_rc.py", line 128, in <module>
    execfile(runtime.script)
  File "../../yade/examples/concrete/uniaxial/rb.py", line 68, in <module>
    bb=utils.uniaxialTestFeatures()
  File "/home/janek/tmp/ZZ/BIN/lib/yade-ZZ-test-fast/py/yade/utils.py", line 486, in uniaxialTestFeatures
    dim=aabbDim(); axis=dim.index(max(dim))
AttributeError: 'tuple' object has no attribute 'index'

File in the attachment.

Revision history for this message
Janek Kozicki (cosurgi) wrote :

I didn't notice anywhere (I'm blind, or is that this 2.5 incompatibility problem): 1. tensile/compressive strength 2. curve in gnuplot file

Revision history for this message
Václav Šmilauer (eudoxos) wrote :

Of course if you get error you are not going to get the results. What did you let run "to the end"? Be more patient. This compat issue with python 2.5 fixed in r1733.

Revision history for this message
Václav Šmilauer (eudoxos) wrote :

Janek, I mean: try again, please.

Revision history for this message
Václav Šmilauer (eudoxos) wrote :

You should get something like this at the end:

[...]
20090824T191100p10899 compression -0.00240422028947 -17908342.1724
20090824T191100p10899 compression -0.00300402316377 -11794465.9303
Damaged, stopping.
Strengths fc=-2.70021e+07, ft=3.34939e+06, |fc/ft|=8.06182
gnuplot 20090824T191100p10899.gnuplot
Bye.

(you will have different values and the gnuplot plot might be a little bogus for concrete, but that is the public version of the CPM model).

Revision history for this message
Janek Kozicki (cosurgi) wrote :

I will leave it running for the night. no problem at all :)

Revision history for this message
Janek Kozicki (cosurgi) wrote :

The file examples/concrete/uniaxial/rb.py does not exist anymore. But instead I see there examples/concrete/uniax.py which gives following error (ah, ok, you have renamed it):

Running script ../../yade/examples/concrete/uniax.py
/usr/lib/python2.5/site-packages/pytz/__init__.py:32: UserWarning: Module pylab was already imported from /usr/lib/pymodules/python2.5/pylab.py, but /usr/lib/pymodules/python2.5 is being added to sys.path
  from pkg_resources import resource_stream
/usr/lib/python2.5/site-packages/pytz/__init__.py:32: UserWarning: Module matplotlib was already imported from /usr/lib/pymodules/python2.5/matplotlib/__init__.py, but /usr/lib/pymodules/python2.5 is being added to sys.path
  from pkg_resources import resource_stream
Traceback (most recent call last):
  File "/home/janek/tmp/ZZ/BIN/lib/yade-ZZ-test-fast/gui/PythonUI_rc.py", line 128, in <module>
    execfile(runtime.script)
  File "../../yade/examples/concrete/uniax.py", line 69, in <module>
    spheres=pack.randomDensePack(pack.inHyperboloid((0,0,-.5*specimenLength),(0,0,.5*specimenLength),.25*specimenLength,.2*specimenLength),spheresInCell=2000,radius=sphereRadius,memoizeDb='/tmp/triaxPackCache.sqlite',young=young,poisson=poisson,frictionAngle=frictionAngle,physParamsClass='CpmMat',density=density)
  File "/home/janek/tmp/ZZ/BIN/lib/yade-ZZ-test-fast/py/yade/pack.py", line 266, in randomDensePack
    except OperationalError:
NameError: global name 'OperationalError' is not defined

Most strange that now it doesn't even start calculations. It errors before generating the sample. Let me know when to try again :)

Revision history for this message
Václav Šmilauer (eudoxos) wrote :

Try with r1734 (wonder how this could have passed so far). The packing was already generated and saved in the memoizeDb, now it was trying to load it again.

Revision history for this message
Janek Kozicki (cosurgi) wrote :

I bzr upped:
janek@atak:~/tmp/ZZ/yade$ bzr up
 M py/pack.py
All changes applied successfully.
Updated to revision 1734.

unfortunately the error is the same...:

Running script ../../yade/examples/concrete/uniax.py
/usr/lib/python2.5/site-packages/pytz/__init__.py:32: UserWarning: Module pylab was already imported from /usr/lib/pymodules/python2.5/pylab.py, but /usr/lib/pymodules/python2.5 is being added to sys.path
  from pkg_resources import resource_stream
/usr/lib/python2.5/site-packages/pytz/__init__.py:32: UserWarning: Module matplotlib was already imported from /usr/lib/pymodules/python2.5/matplotlib/__init__.py, but /usr/lib/pymodules/python2.5 is being added to sys.path
  from pkg_resources import resource_stream
Traceback (most recent call last):
  File "/home/janek/tmp/ZZ/BIN/lib/yade-bzr1733/gui/PythonUI_rc.py", line 128, in <module>
    execfile(runtime.script)
  File "../../yade/examples/concrete/uniax.py", line 69, in <module>
    spheres=pack.randomDensePack(pack.inHyperboloid((0,0,-.5*specimenLength),(0,0,.5*specimenLength),.25*specimenLength,.2*specimenLength),spheresInCell=2000,radius=sphereRadius,memoizeDb='/tmp/triaxPackCache.sqlite',young=young,poisson=poisson,frictionAngle=frictionAngle,physParamsClass='CpmMat',density=density)
  File "/home/janek/tmp/ZZ/BIN/lib/yade-bzr1733/py/yade/pack.py", line 266, in randomDensePack
    except OperationalError:
NameError: global name 'OperationalError' is not defined

Revision history for this message
Janek Kozicki (cosurgi) wrote :

ooops, sorry false alarm. I forgot to run scons to install new version of this script, hold on.

Revision history for this message
Janek Kozicki (cosurgi) wrote :

ok... so I installed new script. I forgot to set version=trunk so it was a full recompile ;) And now I get another error:

Running script ../../yade/examples/concrete/uniax.py
/usr/lib/python2.5/site-packages/pytz/__init__.py:32: UserWarning: Module pylab was already imported from /usr/lib/pymodules/python2.5/pylab.py, but /usr/lib/pymodules/python2.5 is being added to sys.path
  from pkg_resources import resource_stream
/usr/lib/python2.5/site-packages/pytz/__init__.py:32: UserWarning: Module matplotlib was already imported from /usr/lib/pymodules/python2.5/matplotlib/__init__.py, but /usr/lib/pymodules/python2.5 is being added to sys.path
  from pkg_resources import resource_stream
Traceback (most recent call last):
  File "/home/janek/tmp/ZZ/BIN/lib/yade-bzr1734/gui/PythonUI_rc.py", line 128, in <module>
    execfile(runtime.script)
  File "../../yade/examples/concrete/uniax.py", line 69, in <module>
    spheres=pack.randomDensePack(pack.inHyperboloid((0,0,-.5*specimenLength),(0,0,.5*specimenLength),.25*specimenLength,.2*specimenLength),spheresInCell=2000,radius=sphereRadius,memoizeDb='/tmp/triaxPackCache.sqlite',young=young,poisson=poisson,frictionAngle=frictionAngle,physParamsClass='CpmMat',density=density)
  File "/home/janek/tmp/ZZ/BIN/lib/yade-bzr1734/py/yade/pack.py", line 267, in randomDensePack
    raise RuntimeError("ERROR: database",memoizeDb," not compatible with randomDensePack (deprecated format or not db created by randomDensePack)")
RuntimeError: ('ERROR: database', '/tmp/triaxPackCache.sqlite', ' not compatible with randomDensePack (deprecated format or not db created by randomDensePack)')

So I deleted this file /tmp/triaxPackCache.sqlite and ran the script again... And now it is running. It only printed few warnings:

janek@atak:~/tmp/ZZ/BIN/bin$ ./yade-bzr1734 ../../yade/examples/concrete/uniax.py
INFO /home/janek/tmp/ZZ/yade/core/yade.cpp:266 main: Loading /home/janek/.yade-bzr1734/preferences.xml
INFO /home/janek/tmp/ZZ/yade/core/yade.cpp:268 main: Loading plugins
INFO gui/qt3/YadeQtMainWindow.cpp:64 YadeQtMainWindow: Loading configuration file: /home/janek/.yade-bzr1734/QtGUIPreferences.xml.
Python TCP server listening on localhost:9000, auth cookie is `sdycsk'
Running script ../../yade/examples/concrete/uniax.py
/usr/lib/python2.5/site-packages/pytz/__init__.py:32: UserWarning: Module pylab was already imported from /usr/lib/pymodules/python2.5/pylab.py, but /usr/lib/pymodules/python2.5 is being added to sys.path
  from pkg_resources import resource_stream
/usr/lib/python2.5/site-packages/pytz/__init__.py:32: UserWarning: Module matplotlib was already imported from /usr/lib/pymodules/python2.5/matplotlib/__init__.py, but /usr/lib/pymodules/python2.5 is being added to sys.path
  from pkg_resources import resource_stream
INFO pkg/common/RenderingEngine/OpenGLRenderingEngine/OpenGLRenderingEngine.cpp:68 initgl: (re)initializing GL for gldraw methods.

also in the OpenGL view I see it being compressed and some circles/wire-spheres appearing and disappearing around. But after 9000 they stopped appearing around, and it is just compressing.

I'll let you know when it will finish.

Revision history for this message
Václav Šmilauer (eudoxos) wrote :

OK, let me know. It shouldn't take terribly long, though, even the first time. The circles are spheres wrapping from the other side of the periodic cell (shown in yellow).

Revision history for this message
Janek Kozicki (cosurgi) wrote :
Download full text (7.2 KiB)

I suppose that it works now:

janek@atak:~/tmp/ZZ/BIN/bin$ rm /tmp/triaxPackCache.sqlite
janek@atak:~/tmp/ZZ/BIN/bin$ ./yade-bzr1734 ../../yade/examples/concrete/uniax.py
INFO /home/janek/tmp/ZZ/yade/core/yade.cpp:266 main: Loading /home/janek/.yade-bzr1734/preferences.xml
INFO /home/janek/tmp/ZZ/yade/core/yade.cpp:268 main: Loading plugins
INFO gui/qt3/YadeQtMainWindow.cpp:64 YadeQtMainWindow: Loading configuration file: /home/janek/.yade-bzr1734/QtGUIPreferences.xml.
Python TCP server listening on localhost:9000, auth cookie is `sdycsk'
Running script ../../yade/examples/concrete/uniax.py
/usr/lib/python2.5/site-packages/pytz/__init__.py:32: UserWarning: Module pylab was already imported from /usr/lib/pymodules/python2.5/pylab.py, but /usr/lib/pymodules/python2.5 is being added to sys.path
  from pkg_resources import resource_stream
/usr/lib/python2.5/site-packages/pytz/__init__.py:32: UserWarning: Module matplotlib was already imported from /usr/lib/pymodules/python2.5/matplotlib/__init__.py, but /usr/lib/pymodules/python2.5 is being added to sys.path
  from pkg_resources import resource_stream
INFO pkg/common/RenderingEngine/OpenGLRenderingEngine/OpenGLRenderingEngine.cpp:68 initgl: (re)initializing GL for gldraw methods.

INFO extra/PeriodicInsertionSortCollider.cpp:432 action: Loaded to 1e+11 done, going to 1e+08 now
INFO pkg/common/RenderingEngine/OpenGLRenderingEngine/OpenGLRenderingEngine.cpp:68 initgl: (re)initializing GL for gldraw methods.

INFO extra/PeriodicInsertionSortCollider.cpp:428 action: Finished
Packing saved to the database /tmp/triaxPackCache.sqlite
Timestep 1.2521980674e-06
INFO /home/janek/tmp/ZZ/yade/core/Omega.cpp:272 saveSimulation: Saving file :memory:initial
init
init done, will now run.
INFO pkg/dem/Engine/StandAloneEngine/UniaxialStrainer.cpp:40 init: Setting initial length to 0.19226 (between #21 and #390)
INFO pkg/dem/Engine/StandAloneEngine/UniaxialStrainer.cpp:64 init: Strain speed will be 0.019226, strain rate 0.1; velocities will be set directly at the beginning.
INFO pkg/dem/Engine/StandAloneEngine/UniaxialStrainer.cpp:84 init: Stress will be updated every 79 steps.

        __ __ ____ ____ _
        \ \ / /_ _| _ \ ___ / ___|___ _ __ ___ ___ | | ___
         \ V / _` | | | |/ _ \ | | / _ \| '_ \/ __|/ _ \| |/ _ \
          | | (_| | |_| | __/ | |__| (_) | | | \__ \ (_) | | __/
          |_|\__,_|____/ \___| \____\___/|_| |_|___/\___/|_|\___|

In [1]: 20090825T103420p3155 tension 2.89257753603e-05 299967.505565
20090825T103420p3155 tension 4.38269323642e-05 877874.455292
20090825T103420p3155 tension 5.87280893678e-05 1458510.79307
20090825T103420p3155 tension 7.36292463717e-05 2039108.81177
20090825T103420p3155 tension 8.80295241485e-05 2039108.81177
20090825T103420p3155 tension 0.000102930681152 2608309.68231
20090825T103420p3155 tension 0.000117831838156 3105548.79418
20090825T103420p3155 tension 0.000131981676319 3478610.11643
20090825T103420p3155 tension 0.000146757613516 3629749.68248
20090825T103420p3155 tension 0.000161533550713 3629749.68248
20090825T103420p3155 tension 0.000176184268104 3865066.494
20090825T103420p3155 tension ...

Read more...

Revision history for this message
Václav Šmilauer (eudoxos) wrote :

Cool, that's it. Thanks for testing. Closing.

Changed in yade:
status: New → Fix Committed
Changed in yade:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.