Git Product home page Git Product logo

Comments (14)

EvanLavizadeh avatar EvanLavizadeh commented on July 17, 2024 2

Thanks @SilviaSapora
I had a similar situation where I tried a bunch of stuff in rapid succession and it works but I didn't do it methodically so now I don't remember exactly which steps fixed which symptoms.

One thing I did that seemed to fix the issue was to specify the path for Boost in the lib path by these steps:

  1. Create new .conf file in directory /etc/ld.so.conf.d (filename doesn't matter. I called mine local.conf) (You will need root permissions to do this)
  2. Add these three lines (I don't know if all 3 are necessary):
    /usr/local/lib
    /usr/local/lib64
    /usr/local/include/boost

I think this achieves the same result.

from dex-net.

mariabauza avatar mariabauza commented on July 17, 2024 1

I had the same problem and this is how I solved it:

  1. After installing Boost.Numpy, the file "libboost_numpy.so " went into the folder: /usr/local/lib64
  2. If you do ldd meshrender.so you get:
    libboost_numpy.so => /usr/local/lib/libboost_numpy.so
  3. I moved the file libboost_numpy.so to the folder where it is expected to be: /usr/local/lib

Finally, because there are 2 meshrenders, I actually called meshrender.so as meshrender2.so and import that one (import meshrender2 ) as @SilviaSapora mentioned.
Hope it helps!

from dex-net.

EvanLavizadeh avatar EvanLavizadeh commented on July 17, 2024

I get the same error. Can you please post the entire output from the terminal after executing the test command?

from dex-net.

jeffmahler avatar jeffmahler commented on July 17, 2024

This is a symptom of meshrender failing to build and install properly. Can you run:

cd /path/to/meshpy
sh install_meshrender.sh

And post the output? I believe you have error messages somewhere.

from dex-net.

EvanLavizadeh avatar EvanLavizadeh commented on July 17, 2024

@jeffmahler
When running sh install_meshrender.sh:

-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /usr/bin/python (found version "2.7.12")
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so (found suitable version "2.7.12", minimum required is "2.7")
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so
-- Found GLUT: /usr/lib/x86_64-linux-gnu/libglut.so
-- Boost version: 1.58.0
-- Found the following Boost libraries:
-- python
-- Configuring done
-- Generating done
-- Build files have been written to: /home/evan/dex-net-python/dex-net/deps/meshpy/build
/usr/bin/cmake -H/home/evan/dex-net-python/dex-net/deps/meshpy -B/home/evan/dex-net-python/dex-net/deps/meshpy/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/evan/dex-net-python/dex-net/deps/meshpy/build/CMakeFiles /home/evan/dex-net-python/dex-net/deps/meshpy/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/evan/dex-net-python/dex-net/deps/meshpy/build'
make -f meshpy/CMakeFiles/meshrender.dir/build.make meshpy/CMakeFiles/meshrender.dir/depend
make[2]: Entering directory '/home/evan/dex-net-python/dex-net/deps/meshpy/build'
cd /home/evan/dex-net-python/dex-net/deps/meshpy/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/evan/dex-net-python/dex-net/deps/meshpy /home/evan/dex-net-python/dex-net/deps/meshpy/meshpy /home/evan/dex-net-python/dex-net/deps/meshpy/build /home/evan/dex-net-python/dex-net/deps/meshpy/build/meshpy /home/evan/dex-net-python/dex-net/deps/meshpy/build/meshpy/CMakeFiles/meshrender.dir/DependInfo.cmake --color=
Scanning dependencies of target meshrender
make[2]: Leaving directory '/home/evan/dex-net-python/dex-net/deps/meshpy/build'
make -f meshpy/CMakeFiles/meshrender.dir/build.make meshpy/CMakeFiles/meshrender.dir/build
make[2]: Entering directory '/home/evan/dex-net-python/dex-net/deps/meshpy/build'
[ 50%] Building CXX object meshpy/CMakeFiles/meshrender.dir/meshrender.cpp.o
cd /home/evan/dex-net-python/dex-net/deps/meshpy/build/meshpy && /usr/bin/c++ -Dmeshrender_EXPORTS -I/usr/include/python2.7 -fPIC -o CMakeFiles/meshrender.dir/meshrender.cpp.o -c /home/evan/dex-net-python/dex-net/deps/meshpy/meshpy/meshrender.cpp
[100%] Linking CXX shared module meshrender.so
cd /home/evan/dex-net-python/dex-net/deps/meshpy/build/meshpy && /usr/bin/cmake -E cmake_link_script CMakeFiles/meshrender.dir/link.txt --verbose=1
/usr/bin/c++ -fPIC -shared -o meshrender.so CMakeFiles/meshrender.dir/meshrender.cpp.o -lboost_python -lpython2.7 -lboost_numpy -lglut -lXmu -lXi -lOSMesa
make[2]: Leaving directory '/home/evan/dex-net-python/dex-net/deps/meshpy/build'
[100%] Built target meshrender
make[1]: Leaving directory '/home/evan/dex-net-python/dex-net/deps/meshpy/build'
/usr/bin/cmake -E cmake_progress_start /home/evan/dex-net-python/dex-net/deps/meshpy/build/CMakeFiles 0

from dex-net.

jeffmahler avatar jeffmahler commented on July 17, 2024

Interesting that actually looks correct. Do you also have the other version of meshrender installed?: https://github.com/BerkeleyAutomation/meshrender

Perhaps there is a name conflict.

from dex-net.

EvanLavizadeh avatar EvanLavizadeh commented on July 17, 2024

@jeffmahler
I don't think so. I haven't separately installed meshrender outside dex-net. Is there a way I can check to be sure?

from dex-net.

jeffmahler avatar jeffmahler commented on July 17, 2024

You could try opening a Python interpreter and then examining the output of:

import meshpy
print(meshpy.__file__)

Then see if there is a file meshrender.so in that directory

from dex-net.

EvanLavizadeh avatar EvanLavizadeh commented on July 17, 2024

@jeffmahler
When trying to import meshpy, i get:

Unable to import meshrender shared library! Rendering will not work. Likely due to missing Boost.Numpy
Boost.Numpy can be installed following the instructions in https://github.com/ndarray/Boost.NumPy
WARNING:root:autolab_core not installed as catkin package, RigidTransform ros methods will be unavailable
/usr/lib/python2.7/dist-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')
WARNING:root:autolab_perception is not installed as a catkin package - ROS msg conversions will not be available for image wrappers
WARNING:root:Unable to import CNN modules! Likely due to missing tensorflow.
WARNING:root:TensorFlow can be installed following the instructions in https://www.tensorflow.org/get_started/os_setup
WARNING:root:Unable to import pylibfreenect2. Python-only Kinect driver may not work properly.
WARNING:root:Failed to import ROS in Kinect2_sensor.py. Kinect will not be able to be used in bridged mode
WARNING:root:Unable to import openni2 driver. Python-only Primesense driver may not work properly
WARNING:root:primesense_sensor.py not installed as catkin package. ROS functionality not available.
WARNING:root:Unable to import pyrealsense2.
WARNING:root:realsense_sensor.py not installed as catkin package. ROS functionality not available.
WARNING:root:Failed to import ROS in ensenso_sensor.py. ROS functionality not available
WARNING:root:Failed to import ROS in phoxi_sensor.py. PhoXiSensor functionality unavailable.

I don't know why boost.numpy couldn't install, but I'm having other issues installing boost.numpy separately. That might be something I should solve on my own?

from dex-net.

JoonHyup avatar JoonHyup commented on July 17, 2024

@jeffmahler

Hello when I type:

import meshpy
print(meshpy.file)

I got the path of the meshrender.so as follow:

'>>> import meshpy
/home/bjh/.local/lib/python2.7/site-packages/requests/init.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
warnings.warn(warning, RequestsDependencyWarning)
WARNING:root:Unable to import pylibfreenect2. Python-only Kinect driver may not work properly.
WARNING:root:Unable to import openni2 driver. Python-only Primesense driver may not work properly
WARNING:trimesh:No FCL -- collision checking will not work
'>>> print(meshpy.file)
/usr/local/lib/python2.7/dist-packages/meshpy/init.pyc

what should I do next??

from dex-net.

SilviaSapora avatar SilviaSapora commented on July 17, 2024

I have solved this problem.
There are multiple issues with this.
First of all, as Jeff mentioned, there are 2 modules with the same name(meshrender) one is used in visualization3d and is the one you install by:

pip install meshrender

And another one is the one you get by running the install_meshrender.sh script.
To solve this problem I had to rename the meshpy's meshrender to be called meshrender2.
I don't know if you had this problem.
Secondly, I you have to make sure meshpy's meshrender is building and linking correctly, and it is included to the python path.
I also see you seem to have problems with Boost.NumPy. Is there a directory called Boost.Numpy under "dex-net/deps"? If not perform the following:

sudo apt -y install  libboost1.62-dev  libpython2.7-dev libboost-python-dev
git clone https://github.com/ndarray/Boost.NumPy
cd Boost.Numpy
mkdir build
cd build
cmake ..
make 
sudo make install

Take note of where Boost.NumPy is installed.

If you have linking problems with meshrender, try not deleting the build directory and linking the file again(changing meshrender2 to meshrender if that is what you want to name it).
From the meshpy directory:

cd build
sudo /usr/bin/c++ -fPIC   -shared  -o meshrender2.so meshpy/CMakeFiles/meshrender2.dir/meshrender2.cpp.o -Wl,--whole-archive -L/usr/local/lib64/ -lboost_numpy -Wl,--no-whole-archive -lboost_python -lpython2.7 -lglut -lXmu -lXi -lOSMesa

Some things are probably overkill but this worked for me, so I'm just copy-pasting as it was.
Also for me "-L/usr/local/lib64/" was were Boost.NumPy was installed. Replace it with whatever your directory is.

Also, when you are calling your scripts, make sure the path to Boost.NumPy is included in your python path.

Sorry if the instructions are not very clear but I've spent 3h on this and I've forgotten half the things I've done/tried. Every time I solved one problem I was getting another and I really can't remember what I did to solve each one of them. If you still have problems I can try and give you more details.

I hope this is somewhat helpful.

from dex-net.

yruoxi avatar yruoxi commented on July 17, 2024

I am still having this issue. First of all, catkin_make and build was successful, no error message here. Boost.Numpy is there.

dex-net INFO Rendering images for object pineapple in pose_0
Traceback (most recent call last):
File "generate_gqcnn_dataset.py", line 611, in
config)
File "generate_gqcnn_dataset.py", line 409, in generate_gqcnn_dataset
render_samples = urv.rvs(size=image_samples_per_stable_pose)
File "/home/ryu/catkin_ws/src/autolab_core/autolab_core/random_variables.py", line 81, in rvs
return self.sample(size=size)
File "/usr/local/lib/python2.7/dist-packages/meshpy/random_variables.py", line 498, in sample
render_mode, stable_pose=self.stable_pose)
File "/usr/local/lib/python2.7/dist-packages/meshpy/mesh_renderer.py", line 587, in wrapped_images
debug=debug)
File "/usr/local/lib/python2.7/dist-packages/meshpy/mesh_renderer.py", line 489, in images
c, d = meshrender.render_mesh([P],
AttributeError: 'module' object has no attribute 'render_mesh'

Here is the exact error message, I am able to import either meshrender and meshpy in python.

import meshrender
WARNING:root:Failed to import ROS in Kinect2_sensor.py. Kinect will not be able to be used in bridged mode
WARNING:root:Unable to import openni2 driver. Python-only Primesense driver may not work properly
WARNING:root:Failed to import ROS in ensenso_sensor.py. ROS functionality not available
WARNING:root:Failed to import ROS in phoxi_sensor.py. PhoXiSensor functionality unavailable.

I tried all above methods, including adding ld_library_path, moving libboost.so, changing meshrender to meshrender2 but unable to import meshrender2

import meshrender2
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named meshrender2

In my attempts I attempted with and without the following changes, in different combinations. I did change the meshrender.cpp to meshrender2.cpp then changing the makefile to meshrender2.cpp, meshrender.so to meshrender2.so also changed the import meshrender to import meshrender2 as meshrender

PYTHON_ADD_MODULE(meshrender2 meshrender2.cpp)
INSTALL(TARGETS meshrender2 DESTINATION meshpy)

Also changed the last few lines in the meshrender2.cpp in that attempt into:

BOOST_PYTHON_MODULE(meshrender2) {
Py_Initialize();
boost::numpy::initialize();
boost::python::numeric::array::set_module_and_type("numpy", "ndarray");

def("mul_array", &mul_array);
def("render_mesh", &render_mesh);
}

followed by a catkin_make clean and catkin_make, source devel/setup.bash
still cannot find meshrender2, the error still occurs after the above suggested method, cannot find attribute render_mesh

from dex-net.

yruoxi avatar yruoxi commented on July 17, 2024

Solved, python was looking at the meshpy in dist_packages folder so it is most effective to move meshrender.cpp into the lib/python2.7/dist_packages/meshpy folder, then it will be found

from dex-net.

zch-cpu avatar zch-cpu commented on July 17, 2024

Thanks @SilviaSapora
I had a similar situation where I tried a bunch of stuff in rapid succession and it works but I didn't do it methodically so now I don't remember exactly which steps fixed which symptoms.

One thing I did that seemed to fix the issue was to specify the path for Boost in the lib path by these steps:

  1. Create new .conf file in directory /etc/ld.so.conf.d (filename doesn't matter. I called mine local.conf) (You will need root permissions to do this)
  2. Add these three lines (I don't know if all 3 are necessary):
    /usr/local/lib
    /usr/local/lib64
    /usr/local/include/boost

I think this achieves the same result.

Thanks, bro. It works for me.

from dex-net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.