pmh47 / dirt

DIRT: a fast differentiable renderer for TensorFlow
MIT License
312 stars 63 forks source link

Error while using tensorflow 1.15. #70

Open OOF-dura opened 4 years ago

OOF-dura commented 4 years ago

System information

I switch the tf version from 1.13 to 1.15. When I run the code, I got the following errors.

_rasterise_module = tf.load_op_library(_lib_path + '/librasterise.so')

Errors:

  File "/home/frank/Desktop/mesh-py3/my_venv/lib/python3.5/site-packages/dirt/rasterise_ops.py", line 6, in <module>
    _rasterise_module = tf.load_op_library(_lib_path + '/librasterise.so')
  File "/home/frank/Desktop/mesh-py3/my_venv/lib/python3.5/site-packages/tensorflow_core/python/framework/load_library.py", line 61, in load_op_library
    lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: libtensorflow_framework.so: cannot open shared object file: No such file or directory

Should I reinstall the dirt? or just make some settings can fix this problem?

Best regards, thanks!

pmh47 commented 4 years ago

Yes, you should reinstall / rebuild DIRT. Tensorflow changes this library from version to version, and DIRT needs to be built with the right one.

OOF-dura commented 4 years ago

Yes, you should reinstall / rebuild DIRT. Tensorflow changes this library from version to version, and DIRT needs to be built with the right one.

Hi~ I rebuild and reinstall via:

source venv/bin/activate
cd dirt
rm -r build
mkdir build
cd build
cmake -D_OPENGL_LIB_PATH=/usr/lib/nvidia-410 ../csrc
make -j12
cd ..
pip install -e .

My python is 3.5.

Then I ran

python tests/square_test.py

I still get:

/home/frank/.local/lib/python3.5/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/frank/.local/lib/python3.5/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/frank/.local/lib/python3.5/site-packages/tensorflow/python/framework/dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/frank/.local/lib/python3.5/site-packages/tensorflow/python/framework/dtypes.py:529: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/frank/.local/lib/python3.5/site-packages/tensorflow/python/framework/dtypes.py:530: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/frank/.local/lib/python3.5/site-packages/tensorflow/python/framework/dtypes.py:535: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
Traceback (most recent call last):
  File "tests/square_test.py", line 4, in <module>
    import dirt
  File "/home/frank/Documents/dirt/dirt/__init__.py", line 2, in <module>
    from .rasterise_ops import rasterise, rasterise_batch, rasterise_deferred, rasterise_batch_deferred
  File "/home/frank/Documents/dirt/dirt/rasterise_ops.py", line 6, in <module>
    _rasterise_module = tf.load_op_library(_lib_path + '/librasterise.so')
  File "/home/frank/.local/lib/python3.5/site-packages/tensorflow/python/framework/load_library.py", line 61, in load_op_library
    lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: libtensorflow_framework.so.1: cannot open shared object file: No such file or directory
Frank-Dz commented 4 years ago

Hi~ I met a similar problem that is when I run the code in terminal in Pycharm, it works well for me but when I run the code in the GUI of Pycharm, I got:

processing... data index:  2 , pose index:  0 , rotation index:  0
/media/frank/Elements1/data/Train_data/arbitrary_01/combination3/2/pose0/imgs/V1.txt
/media/frank/Elements1/data/Train_data/arbitrary_01/combination3/2/pose0/imgs/V1.txt
2020-05-06 22:25:04.673730: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10.0
2020-05-06 22:25:05.022392: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
2020-05-06 22:25:05.025248: F /home/frank/Documents/dirt/csrc/gl_common.h:46] extensions eglQueryDevicesEXT, eglQueryDeviceAttribEXT and eglGetPlatformDisplayEXT not available

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

My env is python 3.7 in conda with TF 1.15.0.

pmh47 commented 4 years ago

The problem with pycharm is likely that an environment variable is set in the terminal, but not in the pycharm run configuration. It's therefore finding a different version of libEGL. Do export in the terminal to see what LD_LIBRARY_PATH, LD_PRELOAD, etc. are set to, and then set them similarly in the pycharm run configuration environment variables.

The other problem, with tf 1.15, is strange; I think you somehow built DIRT in the venv with tf 1.15, but then ran in another python install with tf 1.13.

divyaYK commented 3 years ago

Hi, @pmh47 ! Could you please tell me how to install dirt with tensorflow 1.15? Everytime I run pip install -e . after building, pip is automatically trying to install tensorflow 2.5.0

pmh47 commented 3 years ago

@divyaYK Try adding --no-deps to pip command

divyaYK commented 3 years ago

Thank you @pmh47, that worked!