← Back to team overview

yade-users team mailing list archive

Re: [Question #686704]: PicklingError

 

Question #686704 on Yade changed:
https://answers.launchpad.net/yade/+question/686704

    Status: Answered => Open

Nima Goudarzi is still having a problem:
Hi Bruno,

Thanks for getting back to me and sorry for keeping it so brief. I thought that a similar issue has popped up previously for someone else since this kind of coupling is not easy to implement. My YADE version is  yade-2019.01a and I am working on Ubuntu 18.04.  Here is a detailed explanation of what I did. I followed the instruction in the biaxialSmooth.py by 
1- sudo apt install python-escript (Although I had installed escript from the source--see 3)

2- cd examples/FEMxDEM (So I am in the  folder for FEMxDEM examples)

3- export PYTHONPATH="/usr/lib/python-
escript:/home/ngoudarz/Desktop/myYade/install/lib/x86_64-linux-
gnu/yade-2019.01a/py/yade/FEMxDEM"

Note: /usr/lib/python-escrip is the address of my python-escript
Installed by sudo apt install python-escript (not from source). I first
addressed the location of the folder containing the executable from the
one I had installed from the source code but I received an error:
ImportError: No module named escript. I resolved this by changing the
address as explained above.

4-  export LD_LIBRARY_PATH='/usr/lib/python-escript/lib'
Note: This is the address of the lib folder of my python-escript installed by sudo apt install python-escript (not from source).

5- ln -s '/home/ngoudarz/Desktop/myYade/install/lib/x86_64-linux-
gnu/yade-2019.01a/py/yade/FEMxDEM/yadeimport.py'. The path after the ln
-s is the location where I put my yade.import.py file and is the place
where the simDEM.py file is also located.

6- When I run '/home/ngoudarz/Desktop/myYade/install/bin/yade-2019.01a'
./biaxialSmooth.py, I first got an error: ImportError: cannot import
name QtWebkit (even before the error explained in 3 above). I resolved
this by sudo apt-get install python-pyqt5.qtwebkit. I then got the error
mentioned in 3 which I resolved by changing the address and then another
error. ImportError: No module named yadeimport. I traced the source of
the error in the simDEM.py (line 15). To resolve this I first run sudo
apt-get install python-yade and then changed line 15 in the simDEM.py
from "from yadeimport import *" to "rom yade import *" as Jan Stránský
had proposed in https://answers.launchpad.net/yade/+question/670527.
This resolved this issue and finally, I was able to start running the
script by inputting
'/home/ngoudarz/Desktop/myYade/install/bin/yade-2019.01a'
./biaxialSmooth.py

Note: I have installed Yade from the source and
/home/ngoudarz/Desktop/myYade/install/bin/yade-2019.01a is the path to
its executable.

Here is my execution:
ngoudarz@Nima-VPCZ122GX:~/Desktop/myYade/trunk-2019.01a/examples/FEMxDEM$ sudo apt install python-escript
ngoudarz@Nima-VPCZ122GX:~$ cd '/home/ngoudarz/Desktop/myYade/trunk-2019.01a/examples/FEMxDEM' 
ngoudarz@Nima-VPCZ122GX:~/Desktop/myYade/trunk-2019.01a/examples/FEMxDEM$ export PYTHONPATH="/usr/lib/python-escript:/home/ngoudarz/Desktop/myYade/install/lib/x86_64-linux-gnu/yade-2019.01a/py/yade/FEMxDEM"
ngoudarz@Nima-VPCZ122GX:~/Desktop/myYade/trunk-2019.01a/examples/FEMxDEM$ export LD_LIBRARY_PATH='/usr/lib/python-escript/lib' 
ngoudarz@Nima-VPCZ122GX:~/Desktop/myYade/trunk-2019.01a/examples/FEMxDEM$ ln -s '/home/ngoudarz/Desktop/myYade/install/lib/x86_64-linux-gnu/yade-2019.01a/py/yade/FEMxDEM/yadeimport.py' 
ngoudarz@Nima-VPCZ122GX:~/Desktop/myYade/trunk-2019.01a/examples/FEMxDEM$ ln -s '/home/ngoudarz/Desktop/myYade/install/lib/x86_64-linux-gnu/yade-2019.01a/py/yade/FEMxDEM/yadeimport.py' 

Here is the output:

Welcome to Yade 2019.01a 
TCP python prompt on localhost:9000, auth cookie `asused'
XMLRPC info provider on http://localhost:21000
Running script ./retainingSmooth.py
=======================================================================
For better performance compile python-escript with direct solver method
=======================================================================
Press Enter to continue...

When I hit enter, this is what I get:

Traceback (most recent call last):
  File "/home/ngoudarz/Desktop/myYade/install/bin/yade-2019.01a", line 241, in runScript
    execfile(script,globals())
  File "./retainingSmooth.py", line 45, in <module>
    prob = MultiScale(domain=mydomain,ng=numg,np=nump,random=False,rtol=1e-2,usePert=False,pert=-2.e-5,verbose=True)
  File "/home/ngoudarz/Desktop/myYade/install/lib/x86_64-linux-gnu/yade-2019.01a/py/yade/FEMxDEM/msFEM2D.py", line 85, in __init__
    self.__scenes=self.__pool.map(initLoad,range(ng))
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 253, in map
    return self.map_async(func, iterable, chunksize).get()
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 572, in get
    raise self._value
PicklingError: Can't pickle <type 'function'>: attribute lookup __builtin__.function failed
[[ ^L clears screen, ^U kills line. F12 controller, F11 3d view (use h-key for showing help), F10 both, F9 generator, F8 plot. ]]

In [1]:

As you see, the only step I skipped is run `mv biaxialSmooth.yade.gz
0.yade.gz` as described in biaxialSmooth.py to generate initial RVE
packing. Do I need to do so? If yes how?

Noteworthy that the result folder containing gauss, packing, and vtk subfolders are built in the directory ( FEMxDEM) but never occupied by any files due to the error. 
Anyway, this is the final stage of my journey toward running this FEMxDEM and I am looking forward to a workaround to resolve the issue.

Thanks so much for your time and patience

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.