TypeError: No registered converter was able to produce a C++ rvalue of type std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > from this Python object of type str

Asked by ytang

Hi everyone, I am newly here.

Recently, I'm trying to use the cluster to do some simulation. I can run the script on my own computer and I can also run some simple scripts on the cluster. but this morning when I try another script. there is an error as follows:

TCP python prompt on localhost:9000, auth cookie `suekyc'
Welcome to Yade 2019.01a
XMLRPC info provider on http://localhost:21000
Running script make-sample.py
Traceback (most recent call last):
  File "/packages/7x/yade/2019.01/bin/yade-2019.01a", line 241, in runScript
    execfile(script,globals())
  File "make-sample.py", line 16, in <module>
    sp2 = pack.filterSpherePack(pred,sp,returnSpherePack=True)
  File "/packages/7x/yade/2019.01/lib64/yade-2019.01a/py/yade/pack.py", line 373, in filterSpherePack
    if dimP[0]>dimS[0] or dimP[1]>dimS[1] or dimP[2]>dimS[2]: warnings.warn("Packing's dimension (%s) doesn't fully contain dimension of the predicate (%s)."%(dimS,dimP))
TypeError: No registered converter was able to produce a C++ rvalue of type std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > from this Python object of type str

Actually, I can run the same script on my own computer, but it failed on the cluster, is there anybody can help me?

I have searched some information on the internet, it seems that something wrong with the boost. But I'm not very sure about it. I hope someone can give me some information
Thanks.

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
Jérôme Duriez (jduriez) said :
#1

Hi,

It seems to me your script passed a Python string argument to a Python YADE function, whose internal code is in C++ and thus needs to work with a C++ string, that should reflect the Python string appearing in your script (a systematic situation in YADE).

Boost library such as [*] is indeed instrumental for such operations in YADE.

It seems here the conversion did not work... I thus suspect a difference in terms of availability/version of e.g. libboost-all-dev (a prerequisite of YADE, see [**]) packages between your cluster and your computer.

This is for background information.. If you need further help you may have to wait for other answers; providing your script (minimal working fashion, please) and the operating systems of the two machines (at least ?) may be very helpful for these other answers.

[*] https://www.boost.org/doc/libs/1_69_0/libs/python/doc/html/index.html
[**] https://yade-dev.gitlab.io/trunk/installation.html#prerequisites

Revision history for this message
ytang (ytang116) said :
#2

Hi Jduriez,

Actually, I have seen the prerequisites for YADE, it said that the boost should be at least 1.47.

But I found the following information in the cluster:

// Boost version.hpp configuration header file ------------------------------//

// (C) Copyright John maddock 1999. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

// See http://www.boost.org/libs/config for documentation

#ifndef BOOST_VERSION_HPP
#define BOOST_VERSION_HPP

//
// Caution, this is the only boost header that is guarenteed
// to change with every boost release, including this header
// will cause a recompile every time a new boost version is
// released.
//
// BOOST_VERSION % 100 is the patch level
// BOOST_VERSION / 100 % 1000 is the minor version
// BOOST_VERSION / 100000 is the major version

#define BOOST_VERSION 105300

//
// BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION
// but as a *string* in the form "x_y[_z]" where x is the major version
// number, y is the minor version number, and z is the patch level if not 0.
// This is used by <config/auto_link.hpp> to select which library version to link to.

#define BOOST_LIB_VERSION "1_53"

#endif

Does this mean the version of the boost in this cluster is not compatible with the version of YADE right now in this cluster? (BTW, the version of YADE in the cluster is 2019.01a)

Revision history for this message
ytang (ytang116) said :
#3

In my own computer, the version of the operating system is Ubuntu 10.04LTS and the version of YADE is 2018.02b. while the version of the operating system in the cluster is CentOS Linux release 7.4.1078 (Core), the version of YADE is 2019.01a.

Here is the script:

from yade import pack,qt, plot
qt.View()
qt.Controller()
from yade import utils
compFricDegree = 30
targetPorosity = 0.98
stabilityThreshold=0.3
finalFricDegree=19.5
damp=0.8
young=4e8
O.materials.append(CohFrictMat(young=young,poisson=0.3,frictionAngle=radians(compFricDegree),isCohesive=False,alphaKr=0.2,alphaKtw=0,etaRoll=0.5,momentRotationLaw=True,density=2648,label='spheres'))
O.materials.append(FrictMat(young=young,poisson=0.3,frictionAngle=0,density=0,label='walls'))
mn,mx=Vector3(0,0,0),Vector3(400e-3,400e-3,300e-3)
psdSizes,psdCumm = [3e-3,3.48e-3,3.98e-3,4.41e-3,4.78e-3,5.12e-3,5.53e-3,6.09e-3,7.37e-3,9.47e-3],[0.,0.11,0.22,0.33,0.44,0.56,0.67,0.78,0.89,1.0]
sp = pack.SpherePack()
sp.makeCloud(mn,mx,psdSizes=psdSizes,psdCumm=psdCumm,num=50026,distributeMass=1,seed=1)
pred=pack.inCylinder((200e-3,200e-3,0),(200e-3,200e-3,300e-3),radius=200e-3)
sp2 = pack.filterSpherePack(pred,sp,returnSpherePack=True)
sp2.toSimulation(material='spheres')
facets = geom.facetCylinder((200e-3,200e-3,150e-3),200e-3,300e-3,wallMask=6,material='walls',segmentsNumber=100)
O.bodies.append(facets)
print "num_spheres= ", len(O.bodies)
O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
 InteractionLoop(
   [Ig2_Sphere_Sphere_ScGeom6D(),Ig2_Facet_Sphere_ScGeom()],
   [Ip2_FrictMat_FrictMat_FrictPhys(),Ip2_CohFrictMat_CohFrictMat_CohFrictPhys()], [Law2_ScGeom_FrictPhys_CundallStrack(),Law2_ScGeom6D_CohFrictPhys_CohesionMoment(useIncrementalForm=True,always_use_moment_law=True,label='cohesiveLaw')]
 ),
 GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=10,timestepSafetyCoefficient=0.8),
 NewtonIntegrator(gravity=(0,0,-9.81),damping=damp),

]
O.dt=.5*PWaveTimeStep()

while 1:
 O.run(3000,True)
 unb=unbalancedForce()
 print 'unbalanced force: ',unb
 if unb<stabilityThreshold:
  break
O.save('make_sample_1.yade.gz')
O.saveTmp()

Is there is anyone can help me?

Revision history for this message
Robert Caulk (rcaulk) said :
#4

Can you help with this problem?

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

To post a message you must log in.