Error message with povray

Asked by Thanh Nguyen

Dear all,
I got the following error messages while running bingle_vis.py, I would thank you very much if you can help me out with this.
Bests,
Thanh.

-bash-3.2$ mpirun -np 2 `which mpipython` bingle_vis.py

CSubLatticeControler::initMPI()
slave started at local/global rank 0 / 1
No handlers could be found for logger "esys.lsm.util"
Traceback (most recent call last):
  File "bingle_vis.py", line 60, in ?
    snapshot(particles=particles, index=n)
  File "bingle_vis.py", line 30, in snapshot
    size=[800,600]
  File "/home/p253629/myesys/lib/python2.4/site-packages/esys/lsm/vis/povray/Scene.py", line 142, in render
    self.getRenderer().render(self.objectList, fileName, imageFormat)
  File "/home/p253629/myesys/lib/python2.4/site-packages/esys/lsm/vis/povray/Scene.py", line 96, in render
    self.getPovRenderer().closeInput()
  File "/home/p253629/myesys/lib/python2.4/site-packages/esys/lsm/vis/povray/PovRenderer.py", line 254, in closeInput
    process.run()
  File "/home/p253629/myesys/lib/python2.4/site-packages/esys/lsm/util/Process.py", line 139, in run
    self.runNoWait()
  File "/home/p253629/myesys/lib/python2.4/site-packages/esys/lsm/util/Process.py", line 120, in runNoWait
    close_fds=True
  File "/usr/lib64/python2.4/subprocess.py", line 541, in __init__
    (p2cread, p2cwrite,
  File "/usr/lib64/python2.4/subprocess.py", line 869, in _get_handles
    errwrite = stderr.fileno()
AttributeError: 'bool' object has no attribute 'fileno'

Below is the code for bingle_vis.py

# bingle_vis.py

from esys.lsm import *
from esys.lsm.util import Vec3, BoundingBox
from esys.lsm.vis import povray

def snapshot(particles=None, index=0):
 pkg = povray
 scene = pkg.Scene()
 for pp in particles:
  povsphere = pkg.Sphere(pp.getPosn(), pp.getRadius())
  povsphere.apply(pkg.Colors.Red)
  scene.add(povsphere)
 camera = scene.getCamera()
 camera.setLookAt(Vec3(0,0,0))
 camera.setPosn(Vec3(0,0,20))
 camera.setZoom(0.1)

 scene.render(
  offScreen=True,
  interactive=False,
  fileName="snap_%.4d.png" % (index),
  size=[800,600]
 )
 return

#instantiate a simulation object and initialise the neighbour search algorithm:
sim = LsmMpi(numWorkerProcesses=1, mpiDimList=[1,1,1])
sim.initNeighbourSearch(particleType="NRotSphere",gridSpacing=2.5,verletDist=0.5)

#specify the spatial domain for the simulation:
domain = BoundingBox(Vec3(-20,-20,-20), Vec3(20,20,20))
sim.setSpatialDomain(domain)

#add the first particle to the domain:
particle=NRotSphere(id=0, posn=Vec3(-5,5,-5), radius=1.0, mass=1.0)
particle.setLinearVelocity(Vec3(1.0,-1.0,1.0))
sim.createParticle(particle)

#add the second particle to the domain:
particle=NRotSphere(id=1, posn=Vec3(5,5,5), radius=1.0, mass=10.0)
particle.setLinearVelocity(Vec3(-1.0,-1.0,-1.0))
sim.createParticle(particle)

#specify the type of interactions between colliding particles:
sim.createInteractionGroup(NRotElasticPrms(name = "elasticSpheres",normalK = 10000.0,scaling=True))

#specify the number of timesteps and timestep increment:
sim.setNumTimeSteps(10000)
sim.setTimeStepSize(0.001)

#Execute the simulation:
N_max = sim.getNumTimeSteps()
n=0
for n in range (N_max):
 sim.runTimeStep()
 if (n%100==0):
  particles = sim.getParticleList()
  snapshot(particles=particles, index=n)
 n += 1
sim.exit()

Question information

Language:
English Edit question
Status:
Solved
For:
ESyS-Particle Edit question
Assignee:
No assignee Edit question
Solved by:
Vince Boros
Solved:
Last query:
Last reply:
Revision history for this message
Best Vince Boros (v-boros) said :
#1

Hello Thanh.

This error relates to a conflict between subprocess.py (which we introduced to remove a deprecation warning) and Python 2.4. It disappears with a later version of Python.

Before you change the version, make sure to run "make uninstall" and "make distclean" on ESyS-Particle. You also need to ensure that your Boost libraries use the later Python. The simplest way to do this, if you have the option, is to upgrade to a version of your operating system that uses the Python 2.5 (or later) package by default. The Boost packages will then also use this version and you can then rebuild ESyS-Particle. Ubuntu 11.04, for example, uses Python 2.7.

Regards,

Vince

Revision history for this message
Thanh Nguyen (thanh.nguyen) said :
#2

Hi Vince,
Thank you for your reply.

I installed esys-particle on my Ubuntu Desktop and the file bingle_vis.py can be executed without problem.

However, when I installed esys-particle on a cluster computer which run Scientific Linux 5, I got another problem.

- Installed Python 2.7.1 or 2.7.2
- Installed Boost 1.45
- config esys-particle

sh autogen.sh

 ./configure CC=mpicc CXX=mpiCC --prefix=$HOME/esys-particle/esys-particle --with-boost=$HOME/esys-particle/boost

Error message
.......
checking for Py_Main in -lpython2.7... no
checking for boostlib >= 1.34.1... yes
checking whether the Boost::Filesystem library is available... yes
checking for __cxa_atexit in -lboost_filesystem... yes
checking whether the Boost::Python library is available... yes
checking for __cxa_atexit in -lboost_python... no
checking for __cxa_atexit in -lboost_python... (cached) no
checking for __cxa_atexit in -lboost_python-mt... no
configure: error:
    The boost python library was not found. Please install and
    re-run configure.

I had a look around the Q&A and I found that another person also had a similar problem with cluster computer

https://answers.launchpad.net/esys-particle/+question/147862

https://answers.launchpad.net/esys-particle/+faq/1235

For me, I did not have any problem with the installation of Boost 1.45 and Python2.4 (default of the system). The only point is the incompatibility of Python 2.4 and Povray.

When I installed Python 2.7 and Boost 1.45, I got the error message as shown above.

I wonder if there are further solutions for this problem.

Thank you.

Cheers,

Thanh.

Revision history for this message
Vince Boros (v-boros) said :
#3

Hello Thanh.

The two errors you have reported may have to do with finding the correct versions of libraries when multiple versions exist.

As I understand, you are trying to install ESyS-Particle on a Scientific Linux 5 cluster which has a default Python 2.4. You have installed your own Python 2.7. (Is Python 2.7 installed in $HOME/esys-particle/python/?) You have installed your own Boost 1.45 libraries in $HOME/esys-particle/boost/.

The first problem to fix is: "checking for Py_Main in -lpython2.7... no". The configure script knows of Python 2.7, but it seems to be locating the wrong file. The only guess I can make about how this can happen is that the configure script knows the location of the Python 2.7 binary but not the location of the library.

At the command prompt type:

ls -l `which python`
echo $PATH
echo $LD_LIBRARY_PATH

Send me the results. We will go from there.

Vince

Revision history for this message
Thanh Nguyen (thanh.nguyen) said :
#4

Hi Vince,

I installed boost, python and esys-particle in the same folder as follow:

Python: $HOME/esys-particle/python
Boost: $HOME/esys-particle/boost
Esys-particle: Python: $HOME/esys-particle/esys-particle

And the results of the three commands are:

-bash-3.2$ ls -l `which python`
lrwxrwxrwx 1 p253629 users 48 Jul 6 18:05 /home/p253629/esys-particle/python/bin/python -> /home/p253629/esys-particle/python/bin/python2.7

-bash-3.2$ echo $PATH
/home/p253629/esys-particle/boost:/home/p253629/esys-particle/boost/lib:/home/p253629/esys-particle/boost/bin.v2/libs:/home/p253629/esys-particle/python/bin:/home/p253629/esys-particle/python/include:/home/p253629/esys-particle/python/lib:/home/p253629/povray/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/cm/shared/apps/torque/2.5.5/bin:/cm/shared/apps/torque/2.5.5/sbin:/cm/shared/apps/maui/3.3/bin:/cm/shared/apps/maui/3.3/sbin:/cm/shared/apps/openmpi/gcc/64/1.3.3/bin

-bash-3.2$ echo $LD_LIBRARY_PATH
/home/p253629/esys-particle/boost/lib:/home/p253629/esys-particle/boost/bin.v2/libs:/home/p253629/esys-particle/python/lib:/cm/shared/apps/torque/2.5.5/lib/:/cm/shared/apps/maui/3.3/lib:/cm/shared/apps/openmpi/gcc/64/1.3.3/lib64

Thank you for your help.

Thanh.

Revision history for this message
Dion Weatherley (d-weatherley) said :
#5

Hi Thanh,

Try the following configure command:

 ./configure CC=mpicc CXX=mpiCC --prefix=/home/p253629/esys-particle/esys-particle --with-boost=/home/p253629/esys-particle/boost LDFLAGS="-L/home/p253629/esys-particle/python/lib -L/home/p253629/esys-particle/boost/lib"

If boost python still cannot be found, try adding the following argument to the configure command above:

--with-boost-python=/home/p253629/esys-particle/boost/lib/libboost-python

Cheers,

Dion.

Revision history for this message
Thanh Nguyen (thanh.nguyen) said :
#6

Hi Dion, Vince,

Thank you very much, the first configure command worked well.

I also tried the second command with the added --with-boost-python=..., the result was a bit different as you may see below.

I do not know if the lack of SILO library will be problem somewhere else but the configure scripts ran normally till the end.

The problem is solved with the use of LDFLAGS argument.

My sincere appreciation for the help of Vince and Dion.

Thanh.

--------------------------------------

Results as shown on screen.

1st configure command

./configure CC=mpicc CXX=mpiCC --prefix=/home/p253629/esys-particle/esys-particle --with-boost=/home/p253629/esys-particle/boost LDFLAGS="-L/home/p253629/esys-particle/python/lib -L/home/p253629/esys-particle/boost/lib"

checking for Py_Main in -lpython2.7... yes
checking for boostlib >= 1.34.1... yes
checking whether the Boost::Filesystem library is available... yes
checking for __cxa_atexit in -lboost_filesystem... yes
checking whether the Boost::Python library is available... yes
checking for __cxa_atexit in -lboost_python... yes
checking for DBClose in -lsiloh5... no
checking for DBClose in -lsilo... no
configure: WARNING:
      The SILO library was not found. SILO output will not be available.

checking for ANSI C header files... (cached) yes
checking for sys/wait.h that is POSIX.1 compatible... yes
....................................

2nd configure command

./configure CC=mpicc CXX=mpiCC --prefix=/home/p253629/esys-particle/esys-particle --with-boost=/home/p253629/esys-particle/boost LDFLAGS="-L/home/p253629/esys-particle/python/lib -L/home/p253629/esys-particle/boost/lib"

--with-boost-python=/home/p253629/esys-particle/boost/lib/libboost-python

checking for Py_Main in -lpython2.7... yes
checking for boostlib >= 1.34.1... yes
checking whether the Boost::Filesystem library is available... yes
checking for __cxa_atexit in -lboost_filesystem... yes
checking whether the Boost::Python library is available... yes
checking for __cxa_atexit in -l/home/p253629/esys-particle/boost/lib/libboost-python... no
checking for __cxa_atexit in -lboost_python-/home/p253629/esys-particle/boost/lib/libboost-python... no
checking for __cxa_atexit in -lboost_python... yes
checking for DBClose in -lsiloh5... no
checking for DBClose in -lsilo... no
configure: WARNING:
      The SILO library was not found. SILO output will not be available.

checking for ANSI C header files... (cached) yes
checking for sys/wait.h that is POSIX.1 compatible... yes
........................................

Revision history for this message
Thanh Nguyen (thanh.nguyen) said :
#7

Thanks Vince Boros, that solved my question.

Revision history for this message
Dion Weatherley (d-weatherley) said :
#8

Hi Thanh,

Great to hear you managed to install ESyS-Particle this time. As you summised, the second configure argument (--with-boost-python) didn't help. It was the LDFLAGS argument that fixed the problem. Looking at your output, configure attempted to find boost-python according to the commandline argument, failed, then found the correct one anyway.

SILO is not mandatory to use ESyS-Particle so no need to worry about that warning message. SILO adds some extra data output formats that can be useful if you wish to use VisIt for visualisation.

Let us know if you have any more problems.

Cheers,

Dion.

Revision history for this message
Vince Boros (v-boros) said :
#9

Hello Thanh.

Thank you for the feedback. I am glad that Dion's suggestion to use LDFLAGS removed the "checking for Py_Main in -lpython2.7... no" error. The fact that using LDFLAGS to supply the Python library path to the linking phase of the compiler worked indicates that this Python checking error is a failure to find the Python library (libpython2.7.so). (The earlier portion of the configure output would have indicated success at finding the python2.7 binary. This has been a cause of confusion previously: Why would there be a testing failure on Python after Python had been found? The answer seems to be that the test is done on the library, not the binary.) It also indicates that the paths in the LD_LIBRARY_PATH environment variable are not passed to the compiler.

Since I have not yet replicated the "checking for Py_Main in -lpython2.7... no" error on my machine, I would be grateful if you could test one thing for me, if you have the time. Set the LIBRARY_PATH variable to the Python library path you supplied to LDFLAGS:

export LIBRARY_PATH=/home/p253629/esys-particle/python/lib:$LIBRARY_PATH

Then run your configure script again without the LDFLAGS:

 ./configure CC=mpicc CXX=mpiCC --prefix=$HOME/esys-particle/esys-particle --with-boost=$HOME/esys-particle/boost

I am curious to see if the compiler can now link the Python library.

For now, at least, we know that with enough settings on the configure line ESyS-Particle can build successfully. I will be glad to find out if the environment variables will also work.

As an aside, I suspect (yet another hypothesis) that the -with-boost-python switch did not work because the supplied path (/home/p253629/esys-particle/boost/lib/) was used relative to the Boost libraries path which configure already knew; i.e, it was looking for /home/p253629/esys-particle/boost/lib/home/p253629/esys-particle/boost/lib/libboost-python.so, which does not exist. I think that it would be sufficient to use "-with-boost-python=boost-python". In your case, though, configure would find the Boost::Python library anyway, because of the --with-boost switch. (It had already found the Boost::Filesystem library, so it knew where to look.) But --with-boost-python would be helpful if your Boost::Python library had a nonstandard name.

I hope that this is useful, and thanks in advance for your help.

Vince

Revision history for this message
Vince Boros (v-boros) said :
#10

One correction. I glanced again over your earlier errors and noticed that configure reported finding the Boost::Python library. The error was instead failure to find "__cxa_atexit in -lboost_python". This Boost::Python library error may have been related to the earlier Python library error, or it could again be a path problem (finding the correct libboost-python.so file). Let me know what you find.

Vince

Revision history for this message
Thanh Nguyen (thanh.nguyen) said :
#11

Hi Vince,

You are right that the earlier portion of the output indicated a success in finding python 2.7.

The output looked like:
….........
checking whether make sets $(MAKE)... yes
checking for a Python interpreter with version >= 2.3... python
checking for python... /home/p253629/esys-particle/python/bin/python
checking for python version... 2.7
checking for python platform... linux2
checking for python script directory... ${prefix}/lib/python2.7/site-packages
checking for python extension module directory... ${exec_prefix}/lib/python2.7/site-packages
checking build system type... x86_64-redhat-linux-gnu
….............

And the LIBRARY_PATH has been correctly passed to the compiler

export LIBRARY_PATH=/home/p253629/esys-particle/python/lib:$LIBRARY_PATH

 ./configure CC=mpicc CXX=mpiCC --prefix=$HOME/esys-particle/esys-particle –with-boost=$HOME/esys-particle/boost

…............
checking for Py_Main in -lpython2.7... yes
checking for boostlib >= 1.34.1... yes
checking whether the Boost::Filesystem library is available... yes
checking for __cxa_atexit in -lboost_filesystem... yes
checking whether the Boost::Python library is available... yes
checking for __cxa_atexit in -lboost_python... yes
checking for DBClose in -lsiloh5... no
checking for DBClose in -lsilo... no
configure: WARNING:
      The SILO library was not found. SILO output will not be available.
….....................................................................

Concerning the –with-boost-python argument, the relative link boost-python did not work.

bash-3.2$ ./configure CC=mpicc CXX=mpiCC --prefix=/home/p253629/esys-particle/esys-particle --with-boost=/home/p253629/esys-particle/boost LDFLAGS="-L/home/p253629/esys-particle/python/lib -L/home/p253629/esys-particle/boost/lib" --with-boost-python=boost-python

…............................................................
checking for Py_Main in -lpython2.7... yes
checking for boostlib >= 1.34.1... yes
checking whether the Boost::Filesystem library is available... yes
checking for __cxa_atexit in -lboost_filesystem... yes
checking whether the Boost::Python library is available... yes
checking for __cxa_atexit in -lboost-python... no
checking for __cxa_atexit in -lboost_python-boost-python... no
checking for __cxa_atexit in -lboost_python... (cached) no
checking for __cxa_atexit in -lboost_python-mt... no
configure: error:
    The boost python library was not found. Please install and
    re-run configure.

I think that my problem here is quite similar to what Gonzalo had in Question 147862
https://answers.launchpad.net/esys-particle/+question/147862
If we can combine the two discussions, we can contribute some installation guidelines to the esys-particle community.

Once again, thanks Vince and Dion.

Cheers,

Thanh.

Revision history for this message
Vince Boros (v-boros) said :
#12

Thank you for all that trouble-shooting information Thanh. It certainly appears that setting LIBRARY_PATH is enough for the compiler to find libraries. A colleague of ours here, Cihan Altinay, was again key to helping me find the environment variable that the compiler uses. I am testing other uses of LIBRARY_PATH, and when i am finished i will modify our FAQs to include this (as well as LDFLAGS in the event that others still have trouble getting configure to locate libraries).

As for --with-boost-python (relative path), I was wrong (again). Once again configure apparently locates a Boost::Python library but fails to finds __cxa_atexit in that library. Hmm... I will need to keep tinkering. I recall that earlier I had used it to success for a Boost library with a nonstandard name. The library had a name like libboost-python-gcc-4_3.so, and I used "--with-boost-python-gcc-4_3". I will probably remove my comments in the FAQ about this option until someone figures out how to use it correctly in all situations.

I will also add a comment to the other question so that someone finding that one can easily find this one.

Best regards and thanks again for your help,

Vince

Revision history for this message
Vince Boros (v-boros) said :
#13

Hello Thanh:

I think i know why "--with-boost-python=boost-python" did not work. I should have suggested "--with-boost-python=boost_python", since the Boost::Python library is called libboost_python.so. Mixing up a dash with an underscore can make all the difference. I have been using the second spelling in my tests, and so far, so good.

Vince

Revision history for this message
Thanh Nguyen (thanh.nguyen) said :
#14

Hi Vince,

I tried the command on my machine, it didn't work.

Thanh.

./configure CC=mpicc CXX=mpiCC --prefix=/home/p253629/esys-particle/esys-particle --with-boost=/home/p253629/esys-particle/boost LDFLAGS="-L/home/p253629/esys-particle/python/lib -L/home/p253629/esys-particle/boost/lib" --with-boost-python=/home/p253629/esys-particle/boost/lib/boost_python

......
checking for Py_Main in -lpython2.4... yes
checking for boostlib >= 1.34.1... yes
checking whether the Boost::Filesystem library is available... yes
checking for __cxa_atexit in -lboost_filesystem... yes
checking whether the Boost::Python library is available... yes
checking for __cxa_atexit in -l/home/p253629/esys-particle/boost/lib/boost_python... no
checking for __cxa_atexit in -lboost_python-/home/p253629/esys-particle/boost/lib/boost_python... no
checking for __cxa_atexit in -lboost_python... no
checking for __cxa_atexit in -lboost_python-mt... no
configure: error:
    The boost python library was not found. Please install and
    re-run configure.
.............

./configure CC=mpicc CXX=mpiCC --prefix=/home/p253629/esys-particle/esys-particle --with-boost=/home/p253629/esys-particle/boost LDFLAGS="-L/home/p253629/esys-particle/python/lib -L/home/p253629/esys-particle/boost/lib" --with-boost-python=boost_python

....................
checking for Py_Main in -lpython2.4... yes
checking for boostlib >= 1.34.1... yes
checking whether the Boost::Filesystem library is available... yes
checking for __cxa_atexit in -lboost_filesystem... yes
checking whether the Boost::Python library is available... yes
checking for __cxa_atexit in -lboost_python... no
checking for __cxa_atexit in -lboost_python-boost_python... no
checking for __cxa_atexit in -lboost_python... (cached) no
checking for __cxa_atexit in -lboost_python-mt... no
configure: error:
    The boost python library was not found. Please install and
    re-run configure.

Revision history for this message
Vince Boros (v-boros) said :
#15

Hello Thanh:

Part of your environment has changed since last time. The message fragment says that you are using Python 2.4 now rather than 2.7. If your local Boost::Python library was built with Python 2.7, then the error, "checking for __cxa_atexit in -lboost_python... no", will definitely appear. This is probably the only reason that configure failed this time. I would advise checking your environment variables again as well if you want to try again.

Vince