error with plotting in the second example (Gravity deposition)

Asked by abdul on 2013-07-10

Dear all,

I am new to yade and linux system. I installed ubuntu 12.04.Also, I had the Yade ((0.97.0+3326+18~precise1)) installation done from package, but when I tried to run the second example code (Gravity deposition) by writing the code step by step in the terminal or by saving it and then using execfile('...py') it gives me this errors:

this is the first error :

yade.plot: creating fake plot, since there are no y-data yet
/usr/lib/pymodules/python2.7/matplotlib/axes.py:4486: UserWarning: No labeled objects found. Use label='...' kwarg on individual plots.
  warnings.warn("No labeled objects found. "

and then when I ran the simulation it gave me this error:

NameError Traceback (most recent call last)
/home/abdul/<string> in <module>()

NameError: name 'addPlotData' is not defined
----------------------------------------------------------------------------------------------------------------------
NameError Traceback (most recent call last)
/home/abdul/<string> in <module>()

NameError: name 'checkUnbalanced' is not defined

 how can I resolve it?

I am doing my final project for MSc and I need to use Yade and plot some results but with this errors nothing appear in the figure .

Many thanks,

Abdul

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
2013-07-10
Last reply:
2014-04-26
Christian Jakob (jakob-ifgt) said : #1

Hi and welcome to yade community,

> I tried to run the second example code

which one? is it in examples folder?

> by writing the code step by step in the terminal or by saving it and then using execfile('...py')

there is no need to type the code line by line, just execute your script like this:

/path/to/yade/bin/yadeXYZ /path/to/example.py

or shorter:

cd /path/to/example

yade example.py

Jan Stránský (honzik) said : #2

Hello Abdul,

if you have already saved file with all the commands, do not use
execfile(...). Use

yade filename.py

console command (so not from yade, but from terminal-console). yade is the
command to start Yade (I suppose you started it without any file name
afterwards), now just add the name of the file (e,g. gravity.py). The plot
window as well as yade controlling window should appear. Then you only
click to run button and can watch :-)

If something was not clear or did not work, let us know
HTH
Jan

2013/7/10 abdul <email address hidden>

> New question #232190 on Yade:
> https://answers.launchpad.net/yade/+question/232190
>
> Dear all,
>
> I am new to yade and linux system. I installed ubuntu 12.04.Also, I had
> the Yade ((0.97.0+3326+18~precise1)) installation done from package, but
> when I tried to run the second example code (Gravity deposition) by writing
> the code step by step in the terminal or by saving it and then using
> execfile('...py') it gives me this errors:
>
> this is the first error :
>
> yade.plot: creating fake plot, since there are no y-data yet
> /usr/lib/pymodules/python2.7/matplotlib/axes.py:4486: UserWarning: No
> labeled objects found. Use label='...' kwarg on individual plots.
> warnings.warn("No labeled objects found. "
>
>
> and then when I ran the simulation it gave me this error:
>
> NameError Traceback (most recent call last)
> /home/abdul/<string> in <module>()
>
> NameError: name 'addPlotData' is not defined
>
> ----------------------------------------------------------------------------------------------------------------------
> NameError Traceback (most recent call last)
> /home/abdul/<string> in <module>()
>
> NameError: name 'checkUnbalanced' is not defined
>
>
>
>
> how can I resolve it?
>
> I am doing my final project for MSc and I need to use Yade and plot some
> results but with this errors nothing appear in the figure .
>
>
>
>
> Many thanks,
>
> Abdul
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Jan Stránský (honzik) said : #3

@Christian: https://yade-dem.org/doc/tutorial-examples.html

2013/7/10 Christian Jakob <email address hidden>

> Question #232190 on Yade changed:
> https://answers.launchpad.net/yade/+question/232190
>
> Christian Jakob posted a new comment:
> Hi and welcome to yade community,
>
> > I tried to run the second example code
>
> which one? is it in examples folder?
>
> > by writing the code step by step in the terminal or by saving it and
> then using execfile('...py')
>
> there is no need to type the code line by line, just execute your script
> like this:
>
> /path/to/yade/bin/yadeXYZ /path/to/example.py
>
> or shorter:
>
> cd /path/to/example
>
> yade example.py
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

abdul (alharbi64) said : #4

Hi Christian Jakob,
thank you for replying.

I meant by the second example the one which is here: ((Gravity deposition))

https://yade-dem.org/doc/tutorial-examples.html

even after I executed my script like what you said .It is still gave me the same errors I mentioned before.

abdul (alharbi64) said : #5

Hi Jan Stránský ,
thank you for replying and the way you descried it is very clear.
But still the errors appear again.
I do not know why.....the figure appears but it is empty and it is written :

yade.plot: creating fake plot, since there are no y-data yet
/usr/lib/pymodules/python2.7/matplotlib/axes.py:4486: UserWarning: No labeled objects found. Use label='...' kwarg on individual plots.
  warnings.warn("No labeled objects found. "

and then when I ran the simulation it gave me this error:

NameError Traceback (most recent call last)
/home/abdul/<string> in <module>()

NameError: name 'addPlotData' is not defined
----------------------------------------------------------------------------------------------------------------------
NameError Traceback (most recent call last)
/home/abdul/<string> in <module>()

NameError: name 'checkUnbalanced' is not defined

Jan Stránský (honzik) said : #6

Hi Abdul,

in the beginning, the figure is empty (because there are no data to plot).

> yade.plot: creating fake plot, since there are no y-data yet
> /usr/lib/pymodules/python2.7/matplotlib/axes.py:4486: UserWarning: No
> labeled objects found. Use label='...' kwarg on individual plots.
> warnings.warn("No labeled objects found. "
>

these errors are ok, I got the same, but still was able to run the
simulation without problem

>
>
> and then when I ran the simulation it gave me this error:
>
>
> NameError Traceback (most recent call last)
> /home/abdul/<string> in <module>()
>
> NameError: name 'addPlotData' is not defined
>
> ----------------------------------------------------------------------------------------------------------------------
> NameError Traceback (most recent call last)
> /home/abdul/<string> in <module>()
>
> NameError: name 'checkUnbalanced' is not defined
>

So you are still getting NameErrors even after running directly from
console? I ran it with yade-daily without any problem, so maybe you could
try it [1]..

Jan

[1] https://yade-dem.org/doc/installation.html#packages

Anton Gladky (gladky-anton) said : #7

Hi,

I have just copy-pasted-executed the script and it seems
works. I did not analyze that, but diagrams are drawing and
the script is executing.

Be sure, you do not missed the indention, as Python-Scripts
are sensitive to that.

Cheers,

Anton

2013/7/10 abdul <email address hidden>:
> Question #232190 on Yade changed:
> https://answers.launchpad.net/yade/+question/232190
>
> Status: Answered => Open
>
> abdul is still having a problem:
> Hi Christian Jakob,
> thank you for replying.
>
> I meant by the second example the one which is here: ((Gravity
> deposition))
>
> https://yade-dem.org/doc/tutorial-examples.html
>
> even after I executed my script like what you said .It is still gave
> me the same errors I mentioned before.
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp

abdul (alharbi64) said : #8

I just want to be sure that the way I downloaded Yade was correct.

I followed these steps:

sudo add-apt-repository ppa:yade-pkg/stable
sudo add-apt-repository ppa:yade-users/external
sudo apt-get update
sudo apt-get install yade-stable

is that enough to make Yade perfectly installed ?
Do I need to compile or to install something else after these steps?

Luis Barbosa (luis-pires-b) said : #9

Abdul, did you solve this problem with gravity deposition? I'm facing the same trouble!

Jan Stránský (honzik) said : #10

Hi Luis,
what version of Yade do you use and how did you install it? Could you also
send us the script you are using?
Thanks
Jan

2014-04-15 23:41 GMT+02:00 Luis Barbosa <
<email address hidden>>:

> Question #232190 on Yade changed:
> https://answers.launchpad.net/yade/+question/232190
>
> Luis Barbosa posted a new comment:
> Abdul, did you solve this problem with gravity deposition? I'm facing
> the same trouble!
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Luis Barbosa (luis-pires-b) said : #11

Hi Jan,
I just copy and paste:

sudo bash -c 'echo "deb http://www.yade-dem.org/packages/ precise/" >> /etc/apt/sources.list'
wget -O - http://www.yade-dem.org/packages/yadedev_pub.gpg
sudo apt-get update
sudo apt-get install yadedaily

the version of yade is 1.05.0

I'm trying to run the gravity deposition by copy from the example (web site) and paste in terminal and the errors are the same presented by Abdul.
Is there another way to open the example
Thanks
Luis

Jan Stránský (honzik) said : #12

Hi Luis,

try not to copy-paste in terminal, but rather copy the commands to a .py
(e.g. gravdep.py) file and then run
yadedaily gravdep.py

let us know if it helped or not
cheers
Jan

2014-04-26 15:51 GMT+02:00 Luis Barbosa <
<email address hidden>>:

> Question #232190 on Yade changed:
> https://answers.launchpad.net/yade/+question/232190
>
> Luis Barbosa requested more information:
> Hi Jan,
> I just copy and paste:
>
> sudo bash -c 'echo "deb http://www.yade-dem.org/packages/ precise/" >>
> /etc/apt/sources.list'
> wget -O - http://www.yade-dem.org/packages/yadedev_pub.gpg
> sudo apt-get update
> sudo apt-get install yadedaily
>
> the version of yade is 1.05.0
>
> I'm trying to run the gravity deposition by copy from the example (web
> site) and paste in terminal and the errors are the same presented by Abdul.
> Is there another way to open the example
> Thanks
> Luis
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Luis Barbosa (luis-pires-b) said : #13

Yes, its's exactly what I'm trying, the errors now:

luis@luis-VirtualBox:~$ yadedaily example1.py
Welcome to Yade 1.05.0
TCP python prompt on localhost:9000, auth cookie `ukscas'
XMLRPC info provider on http://localhost:21000
Running script example1.py
Traceback (most recent call last):
  File "/usr/bin/yadedaily", line 174, in runScript
    execfile(script,globals())
IOError: [Errno 2] file or dir not found: 'example1.py'
[[ ^L clears screen, ^U kills line. F12 controller, F11 3d view (use h-key for showing help), F10 both, F9 generator, F8 plot. ]]

I've just used a text edior from Ubuntu and saved the example as .odt, in dir home. Do I need save in the same dir of the yadedaily
Or am I creating .py in a wrong way

Jan Stránský (honzik) said : #14

Hi Luis,

there seems to be two problems:

1) "file or dir not found". You should specify the example1.py location
correctly.

Either change directory (cd) to the directory where example1.is saved
(preferable way)
cd path/where/the/example/is/saved
yadedaily example1.py

or specify complete path to example1.py as an yadedaily argument
yadedaily /path/to/example1.py

if you saved your example in home, skip this topic, but for future use have
it in mind

2) you need python file (.py extension), not .odt file (from LibreOffice I
guess). Do not use Word-like editors for editing scripts and source files,
use gedit instead (gedit is Ubuntu default editor for such purposes, you
can also use some other plain text editor like geany, vim, emacs...)

HTH
Jan

2014-04-26 20:41 GMT+02:00 Luis Barbosa <
<email address hidden>>:

> Question #232190 on Yade changed:
> https://answers.launchpad.net/yade/+question/232190
>
> Luis Barbosa requested more information:
> Yes, its's exactly what I'm trying, the errors now:
>
> luis@luis-VirtualBox:~$ yadedaily example1.py
> Welcome to Yade 1.05.0
> TCP python prompt on localhost:9000, auth cookie `ukscas'
> XMLRPC info provider on http://localhost:21000
> Running script example1.py
> Traceback (most recent call last):
> File "/usr/bin/yadedaily", line 174, in runScript
> execfile(script,globals())
> IOError: [Errno 2] file or dir not found: 'example1.py'
> [[ ^L clears screen, ^U kills line. F12 controller, F11 3d view (use h-key
> for showing help), F10 both, F9 generator, F8 plot. ]]
>
> I've just used a text edior from Ubuntu and saved the example as .odt, in
> dir home. Do I need save in the same dir of the yadedaily
> Or am I creating .py in a wrong way
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Luis Barbosa (luis-pires-b) said : #15

Very good!
It's working now, my problem was the wrong way to create .py!
Thanks for your patience Jan.

Can you help with this problem?

Provide an answer of your own, or ask abdul for more information if necessary.

To post a message you must log in.