PicklingError

Asked by LiKang

Sorry to bother you sir,

My YADE version is yade-2019.01a and I am working on Ubuntu 18.04. I am trying to run biaxialSmooth.py from FEM-DEM examples.
Then get the error I get is this:

PicklingError: Can't pickle <type 'function'>: attribute lookup __builtin__.function failed.

I have read the same issue in https://answers.launchpad.net/yade/+question/686704 , and his solution is

 '' It is all about paths. Where and how you creat yadeimport.py, where you export your python path''

but i am still confused how to change and export the python path. Here is a detailed explanation of what I did. I followed the instruction in the biaxialSmooth.py by

1- sudo apt install python-escript

2- cd examples/FEMxDEM

3-export PYTHONPATH="/usr/lib/python-escript:/home/weicc/下载/dem-fem-couplinp master/installation/_build/yade/source/examples/FEMxDEM"

4-export LD_LIBRARY_PATH='/usr/lib/python-escript/lib'

5-ln -s '/home/weicc/下载/dem-fem-coupling-master/installation/_build/yade/source/examples/FEMxDEM/yadeimport.py'

and it show the worning:'' ln: Could not create symbolic link './yadeimport.py': File already exists

Here is the output:

Welcome to Yade 2019.01a
TCP python prompt on localhost:9000, auth cookie `cyueks'
XMLRPC info provider on http://localhost:21000
Running script biaxialSmooth.py
=======================================================================
For better performance compile python-escript with direct solver method
=======================================================================
Press Enter to continue...
Traceback (most recent call last):
  File "/home/weicc/下载/dem-fem-coupling-master/installation/_build/yade/install/bin/yade", line 241, in runScript
    execfile(script,globals())
  File "biaxialSmooth.py", line 43, 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/weicc/下载/dem-fem-coupling-master/installation/_build/yade/source/examples/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

Looking forward to a piece of advice!

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hello,
have a look at https://answers.launchpad.net/yade/+question/686704, seems similar (did not study in detail).
cheers
Jan

Revision history for this message
LiKang (likang118) said :
#2

thank you Jan ,
i have read this before, to be honest , it did not give the solution, and then it go on to another problem.
what he talk about to solve the problem is :
"it is all about paths. Where and how you creat yadeimport.py, where you export your python path"
 i tried many times but still get the same error, it confuse me that where is the correct place to creat the yadeimport.py and the python path.

Revision history for this message
Jan Stránský (honzik) said :
#3

if that post did not help you, you have to wait for somebody else to answer, I really have no experience with that part of Yade..
cheers
Jan

Can you help with this problem?

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

To post a message you must log in.