pytraj icon indicating copy to clipboard operation
pytraj copied to clipboard

TypeError: no default __reduce__ due to non-trivial __cinit__ pmap/watershell

Open krlitros87 opened this issue 2 years ago • 6 comments

Hi, Some info: I installed ambertools via conda as explained here: https://ambermd.org/GetAmber.php Everything went well, without problems.

But when trying to run wathershell: shell_anions = pt.pmap(pt.watershell, traj, solute_mask=' :1', solvent_mask=':Cl-', upper=10, image=False,n_cores=4) I get the following error message:

Traceback (most recent call last): File "/store1/navarro/PpGLR1/CA/wider/300mV/1/parallel.py", line 108, in main() File "/store1/navarro/PpGLR1/CA/wider/300mV/1/parallel.py", line 104, in main shell_anions = pt.pmap(pt.watershell, traj, solute_mask=' :1', solvent_mask=':Cl-', upper=10, image=False,n_cores=4) File "/home/navarro/miniconda3/envs/AmberTools22/lib/python3.10/site-packages/pytraj/parallel/multiprocess.py", line 229, in pmap return _pmap(func, traj, *args, **kwargs) File "/home/navarro/miniconda3/envs/AmberTools22/lib/python3.10/site-packages/pytraj/parallel/multiprocess.py", line 219, in _pmap data = p.map(pfuncs, [rank for rank in range(n_cores)]) File "/home/navarro/miniconda3/envs/AmberTools22/lib/python3.10/multiprocessing/pool.py", line 367, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "/home/navarro/miniconda3/envs/AmberTools22/lib/python3.10/multiprocessing/pool.py", line 774, in get raise self._value File "/home/navarro/miniconda3/envs/AmberTools22/lib/python3.10/multiprocessing/pool.py", line 540, in _handle_tasks put(task) File "/home/navarro/miniconda3/envs/AmberTools22/lib/python3.10/multiprocessing/connection.py", line 211, in send self._send_bytes(_ForkingPickler.dumps(obj)) File "/home/navarro/miniconda3/envs/AmberTools22/lib/python3.10/multiprocessing/reduction.py", line 51, in dumps cls(buf, protocol).dump(obj) File "stringsource", line 2, in pytraj.trajectory.c_traj.c_trajectory.TrajectoryCpptraj.reduce_cython TypeError: no default reduce due to non-trivial cinit

I haven't found a way to solve this problem, so any help is more than welcome. Thanks!

krlitros87 avatar Aug 31 '22 19:08 krlitros87

@krlitros87

  • ha, I have never tried with python3.101. What's your platform? linux or macos?
  • shell_anions = pt.watershell(traj, solute_mask=' :1', solvent_mask=':Cl-', upper=10, image=False) -> does this work for you (not using pmap parallel)?

hainm avatar Aug 31 '22 20:08 hainm

@hainm I'm working on linux (Description: openSUSE Leap 15.3). Yeah, watershell works fine without using pmap

for residue in range (2,471,1): shell_anions = pt.watershell(traj, solute_mask=' :'+str(residue),solvent_mask=':Cl-', upper=10, image=False) np.savetxt(str(residue)+'_anions.csv', shell_anions, delimiter=",")

krlitros87 avatar Aug 31 '22 20:08 krlitros87

For now, please not to use pmap since it takes time to debug/fix this issue. Cheers Carlos.

hainm avatar Aug 31 '22 20:08 hainm

Thank you @hainm. Do you think this will work on macOS? I don't understand what the problem could be, since this works for most of the people here

krlitros87 avatar Aug 31 '22 20:08 krlitros87

Do you think this will work on macOS?

Yes, I've tried with my macOS.

I don't understand what the problem could be,

It's kind of complicated and partially because of the cython version that was used to generate C code for pytraj.

hainm avatar Aug 31 '22 21:08 hainm

@hainm will it work if I try installing a different version on my env? In any case, I'm downloading everything to my MacBook, so I'll post an update asap

krlitros87 avatar Aug 31 '22 21:08 krlitros87