dirt icon indicating copy to clipboard operation
dirt copied to clipboard

cmake error when pip install .

Open yangbiaobiao500 opened this issue 5 years ago • 19 comments

Building wheels for collected packages: dirt Building wheel for dirt (setup.py) ... error ERROR: Command errored out with exit status 1: command: /home/ybb/.virtualenvs/py27/bin/python2.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-udrMk2/setup.py'"'"'; file='"'"'/tmp/pip-req-build-udrMk2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-TPRh9h --python-tag cp27 cwd: /tmp/pip-req-build-udrMk2/ Complete output (47 lines): running bdist_wheel running build -- The CXX compiler identification is GNU 5.4.0 -- The CUDA compiler identification is NVIDIA 10.0.130 -- 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 -- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc -- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc -- works -- Detecting CUDA compiler ABI info -- Detecting CUDA compiler ABI info - done -- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: EGL_LIBRARIES linked by target "rasterise" in directory /tmp/pip-req-build-udrMk2/csrc

-- Configuring incomplete, errors occurred! See also "/tmp/pip-req-build-udrMk2/build/CMakeFiles/CMakeOutput.log". Traceback (most recent call last): File "", line 1, in File "/tmp/pip-req-build-udrMk2/setup.py", line 50, in 'Programming Language :: Python :: 3.7', File "/home/ybb/.virtualenvs/py27/local/lib/python2.7/site-packages/setuptools/init.py", line 145, in setup return distutils.core.setup(**attrs) File "/usr/lib/python2.7/distutils/core.py", line 151, in setup dist.run_commands() File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands self.run_command(cmd) File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command cmd_obj.run() File "/home/ybb/.virtualenvs/py27/local/lib/python2.7/site-packages/wheel/bdist_wheel.py", line 192, in run self.run_command('build') File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command self.distribution.run_command(command) File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command cmd_obj.run() File "/tmp/pip-req-build-udrMk2/setup.py", line 24, in run build_csrc() File "/tmp/pip-req-build-udrMk2/setup.py", line 18, in build_csrc subprocess.check_call(['cmake', os.path.join(base_path, 'csrc')], cwd=build_path) File "/usr/lib/python2.7/subprocess.py", line 541, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['cmake', '/tmp/pip-req-build-udrMk2/csrc']' returned non-zero exit status 1

ERROR: Failed building wheel for dirt Running setup.py clean for dirt Failed to build dirt Installing collected packages: dirt Running setup.py install for dirt ... error ERROR: Command errored out with exit status 1: command: /home/ybb/.virtualenvs/py27/bin/python2.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-udrMk2/setup.py'"'"'; file='"'"'/tmp/pip-req-build-udrMk2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-8uY14h/install-record.txt --single-version-externally-managed --compile --install-headers /home/ybb/.virtualenvs/py27/include/site/python2.7/dirt cwd: /tmp/pip-req-build-udrMk2/ Complete output (36 lines): running install running build CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: EGL_LIBRARIES linked by target "rasterise" in directory /tmp/pip-req-build-udrMk2/csrc

-- Configuring incomplete, errors occurred!
See also "/tmp/pip-req-build-udrMk2/build/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-req-build-udrMk2/setup.py", line 50, in <module>
    'Programming Language :: Python :: 3.7',
  File "/home/ybb/.virtualenvs/py27/local/lib/python2.7/site-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/ybb/.virtualenvs/py27/local/lib/python2.7/site-packages/setuptools/command/install.py", line 61, in run
    return orig.install.run(self)
  File "/usr/lib/python2.7/distutils/command/install.py", line 601, in run
    self.run_command('build')
  File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/tmp/pip-req-build-udrMk2/setup.py", line 24, in run
    build_csrc()
  File "/tmp/pip-req-build-udrMk2/setup.py", line 18, in build_csrc
    subprocess.check_call(['cmake', os.path.join(base_path, 'csrc')], cwd=build_path)
  File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '/tmp/pip-req-build-udrMk2/csrc']' returned non-zero exit status 1
----------------------------------------

ERROR: Command errored out with exit status 1: /home/ybb/.virtualenvs/py27/bin/python2.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-udrMk2/setup.py'"'"'; file='"'"'/tmp/pip-req-build-udrMk2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-8uY14h/install-record.txt --single-version-externally-managed --compile --install-headers /home/ybb/.virtualenvs/py27/include/site/python2.7/dirt Check the logs for full command output.

yangbiaobiao500 avatar Nov 13 '19 13:11 yangbiaobiao500

See #17, you need to find libEGL.so and add to CMAKE_LIBRARY_PATH

pmh47 avatar Nov 13 '19 13:11 pmh47

I have done what you said, but there is a problem. I found libEGL.so as follows lrwxrwxrwx 1 root root 19 5月 6 2019 /usr/lib/x86_64-linux-gnu/libGLEWmx.so.1.13 -> libGLEWmx.so.1.13.0 -rw-r--r-- 1 root root 448632 11月 10 2015 /usr/lib/x86_64-linux-gnu/libGLEWmx.so.1.13.0 lrwxrwxrwx 1 root root 17 5月 6 2019 /usr/lib/x86_64-linux-gnu/libGLEW.so.1.13 -> libGLEW.so.1.13.0 -rw-r--r-- 1 root root 514176 11月 10 2015 /usr/lib/x86_64-linux-gnu/libGLEW.so.1.13.0 lrwxrwxrwx 1 root root 13 6月 10 17:02 /usr/lib/x86_64-linux-gnu/libGL.so -> mesa/libGL.so -rw-r--r-- 1 root root 911218 10月 24 2015 /usr/lib/x86_64-linux-gnu/libGLU.a lrwxrwxrwx 1 root root 15 10月 24 2015 /usr/lib/x86_64-linux-gnu/libGLU.so -> libGLU.so.1.3.1 lrwxrwxrwx 1 root root 15 5月 6 2019 /usr/lib/x86_64-linux-gnu/libGLU.so.1 -> libGLU.so.1.3.1 -rw-r--r-- 1 root root 453352 10月 24 2015 /usr/lib/x86_64-linux-gnu/libGLU.so.1.3.1 lrwxrwxrwx 1 root root 21 2月 12 2019 /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5 -> libQt5OpenGL.so.5.5.1 lrwxrwxrwx 1 root root 21 2月 12 2019 /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5.5 -> libQt5OpenGL.so.5.5.1 -rw-r--r-- 1 root root 362752 2月 12 2019 /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5.5.1 lrwxrwxrwx 1 root root 20 4月 5 2016 /usr/lib/x86_64-linux-gnu/libQtOpenGL.so.4 -> libQtOpenGL.so.4.8.7 lrwxrwxrwx 1 root root 20 4月 5 2016 /usr/lib/x86_64-linux-gnu/libQtOpenGL.so.4.8 -> libQtOpenGL.so.4.8.7 -rw-r--r-- 1 root root 1052024 4月 5 2016 /usr/lib/x86_64-linux-gnu/libQtOpenGL.so.4.8.7

but the guide is as follows You should ensure that libGL and libEGL are in a location on LD_LIBRARY_PATH, and that these are the versions shipped with your Nvidia driver. In particular, if you have installed Mesa or Hybris, their libGL or libEGL may be used (or may even have overwritten the Nvidia versions), and these will not work with DIRT Now i do not know how to solve.I have export the adress of libEGL.so to CMAKE_LIBRARY_PATH ,but still exist the same problems

yangbiaobiao500 avatar Nov 17 '19 09:11 yangbiaobiao500

The libraries you listed there are from mesa and/or other packages, not from the nvidia driver. Run ls -l /usr/lib/*/*GL*, and that should include some entries with _nvidia in the name, and including libEGL.so.1. If you are using recent Ubuntu, the folder is probably /usr/lib/nvidia-XXX where XXX is your nvidia driver version.

Once you found that folder, set environment variable LIB accordingly, e.g. export LIB=/usr/lib/nvidia-384 before running pip install.

If this still doesn't work, install DIRT in development mode, as described in the README, and run cmake -D_OPENGL_LIB_PATH=/usr/lib/nvidia-384 (or whatever version number).

pmh47 avatar Nov 17 '19 13:11 pmh47

Thank you very much for your answer, because my graphics card driver was manually installed before, it shows that the installation is successful, the version is nvidia-430, but I did not find nvidia-430 in /usr/lib

yangbiaobiao500 avatar Nov 18 '19 01:11 yangbiaobiao500

if i installl in development mode,it still have a problem. Screenshot from 2019-11-18 09-29-47

yangbiaobiao500 avatar Nov 18 '19 01:11 yangbiaobiao500

I am sorry to trouble you again. In development mode Screenshot from 2019-11-18 10-35-14 I can't find the relevant answer on this question online. I really look forward to your reply.

yangbiaobiao500 avatar Nov 18 '19 02:11 yangbiaobiao500

ls -l /usr/lib/*/*GL* should show the nvidia GL libraries, regardless of whether you used the ubuntu package or nvidia runfile installer.

For the last problem, see the troubleshooting notes in the README; you need to run cmake with -DCMAKE_CUDA_FLAGS='-DNDEBUG'. I'll change this in master soon, as lots of people have the same problem (really it's a bug in tensorflow).

pmh47 avatar Nov 18 '19 13:11 pmh47

ls -l /usr/lib/*/GL do not show the nvidia GL libraries.But Nvidia graphics driver does show successful installation.So I have to install in development mode.I set DCMAKE_CUDA_FLAGS='-DNDEBUG as you said.

Screenshot from 2019-11-18 23-01-44

As you can see, I did this, but I don’t know if it’s right. Then i make . Screenshot from 2019-11-18 23-08-27 As shown in the figure, because the code is too long, I intercepted a part, and the compilation was reported at 57 percent. It was 14 percent before.I really appreciate your patience in answering my question!

yangbiaobiao500 avatar Nov 18 '19 15:11 yangbiaobiao500

For the NDEBUG change, you need to still have the original flags too. So change that line 40 to set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -arch=sm_30 --expt-relaxed-constexpr -DNDEBUG") instead of commenting it.

pmh47 avatar Nov 18 '19 15:11 pmh47

Thank you very much for your help. I seem to have successfully installed the dirt, but there was something wrong with the verification. Screenshot from 2019-11-19 09-09-00 Screenshot from 2019-11-19 09-14-35

yangbiaobiao500 avatar Nov 19 '19 01:11 yangbiaobiao500

It's not finding libEGL correctly at runtime (it may or may not have found the right version at build time). What is the full output of ls -l /usr/lib/*/*GL* and ldd dirt/librasterise.so (run from dirt folder)? That'll show (i) what GL libraries you have, and (ii) which DIRT is trying to load. Also, please check the value of EGL_LIBRARIES in build/CMakeCache.txt.

pmh47 avatar Nov 19 '19 01:11 pmh47

Screenshot from 2019-11-19 09-44-28 I think I may have set some wrong places here, but I am not sure where the mistake is.

yangbiaobiao500 avatar Nov 19 '19 01:11 yangbiaobiao500

First, the path to libEGL is as follows: Screenshot from 2019-11-17 16-46-11 So I have to install in development mode. when i use cmake,the value of EGL_LIBRARIES need to add. So I added the absolute path to its location. As you said,i also add cmake -D_OPENGL_LIB_PATH=/usr/lib/nvidia-384 Screenshot from 2019-11-19 09-55-35 I think I may have problems with the path settings of these variables. I hope you can tell me where the error is. I am grateful.

yangbiaobiao500 avatar Nov 19 '19 01:11 yangbiaobiao500

The Nvidia GL/EGL libraries seem to be missing entirely. Do you have a folder /usr/lib/x86_64-linux-gnu/nvidia/? That is another possible (non-standard) location on some machines.

Reinstalling the nvidia driver package should add them. DIRT will not work with the versions that you have installed currently (which are from Qt and mesa packages).

pmh47 avatar Nov 19 '19 11:11 pmh47

I think I probably know where the problem is. I chose –no-opengl-files when I installed the Nvidia graphics driver, because NVIDIA drivers will install OpenGL by default, and the Ubuntu kernel itself has OpenGL and is closely related to the GUI display. Once NVIDIA's driver overwrites OpenGL, it causes problems when the GUI needs to dynamically link OpenGL libraries. Then I don't know what to do when I reinstall the NVIDIA graphics driver, because not installing the OpenGL file will cause the login interface to circulate.

yangbiaobiao500 avatar Nov 21 '19 04:11 yangbiaobiao500

@yangbiaobiao500 That will certainly be why you have a problem. DIRT strictly requires nvidia's OpenGL/EGL -- there is no way to avoid this, as it uses nvidia-specific extensions to interoperate efficiently with tensorflow.

In practice, for modern versions of Ubuntu, both the apt and nvidia packages for the driver work correctly with OpenGL on all systems I have tried -- I don't know why you have had issues.

pmh47 avatar Nov 21 '19 11:11 pmh47

I am very sorry to bother you again, I have reinstalled the nvidia driver, but the results have not changed.

Screenshot from 2019-11-25 19-44-30

Screenshot from 2019-11-25 19-43-56

Screenshot from 2019-11-25 19-45-29 Screenshot from 2019-11-25 19-46-41

yangbiaobiao500 avatar Nov 25 '19 12:11 yangbiaobiao500

for collected packages: dirt Building wheel for dirt (setup.py) ... error ERROR: Command errored out with exit status 1: command: /home/ybb/.virtualenvs/py27/bin/python2.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-udrMk2/setup.py'"'"'; file='"'"'/tmp/pip-req-build-udrMk2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-TPRh9h --python-tag cp27 cwd: /tmp/pip-req-build-udrMk2/ Complete output (47 lines): running bdist_wheel running build -- The CXX compiler identification is GNU 5.4.0 -- The CUDA compiler identification is NVIDIA 10.0.130 -- 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 -- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc -- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc -- works -- Detecting CUDA compiler ABI info -- Detecting CUDA compiler ABI info - done -- Found OpenGL: /usr/lib/x86_64-linux-g

I had the same problem, how did you solve it?

electronicliujiang avatar Dec 08 '19 13:12 electronicliujiang

I seem to have the same problem as you. Where the setup does not find the correct EGL lib files:

Building wheels for collected packages: dirt
  Building wheel for dirt (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/zal/anaconda3/envs/octopus/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-b23xu1f0/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-b23xu1f0/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-2w8q2hvl --python-tag cp37
       cwd: /tmp/pip-req-build-b23xu1f0/
  Complete output (96 lines):
  running bdist_wheel
  running build
  -- The CXX compiler identification is GNU 7.4.0
  -- The CUDA compiler identification is NVIDIA 9.1.85
  -- 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
  -- Check for working CUDA compiler: /usr/bin/nvcc
  -- Check for working CUDA compiler: /usr/bin/nvcc -- works
  -- Detecting CUDA compiler ABI info
  -- Detecting CUDA compiler ABI info - done
  -- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so  found components:  OpenGL EGL

This makes the compilation to break with the following segfault:

[ 71%] Building CXX object CMakeFiles/rasterise.dir/shaders.cpp.o
  Segmentation fault (core dumped)
  CMakeFiles/rasterise.dir/build.make:86: recipe for target 'CMakeFiles/rasterise.dir/rasterise_egl.cu.o' failed
  make[2]: *** [CMakeFiles/rasterise.dir/rasterise_egl.cu.o] Error 139
  make[2]: *** Waiting for unfinished jobs....
  Segmentation fault (core dumped)
  CMakeFiles/rasterise.dir/build.make:134: recipe for target 'CMakeFiles/rasterise.dir/rasterise_grad_egl.cu.o' failed
  make[2]: *** [CMakeFiles/rasterise.dir/rasterise_grad_egl.cu.o] Error 139
  CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/rasterise.dir/all' failed
  make[1]: *** [CMakeFiles/rasterise.dir/all] Error 2
  Makefile:83: recipe for target 'all' failed

I looked for the nvidia EGL libs, and found they are in the same path as libOpenGL /usr/lib/x86_64-linux-gnu/. For this reason I decided to create a new dir at /usr/lib/nvidia-440 (as my nvidia driver is 440.44), and copy all the nvidia files there. My file listing in that new folder is:

ll /usr/lib/nvidia-440
.rw-r--r--  16M root  1 Jan 18:24 libcuda.so.440.44
.rw-r--r-- 1.3M root  1 Jan 18:24 libEGL_nvidia.so.440.44
.rw-r--r--  63k root  1 Jan 18:24 libGLESv1_CM_nvidia.so.440.44
.rw-r--r-- 111k root  1 Jan 18:24 libGLESv2_nvidia.so.440.44
.rw-r--r-- 1.1M root  1 Jan 18:24 libGLX_nvidia.so.440.44
.rw-r--r-- 3.2M root  1 Jan 18:24 libnvcuvid.so.440.44
.rw-r--r-- 402k root  1 Jan 18:24 libnvidia-cbl.so.440.44
.rw-r--r-- 200k root  1 Jan 18:24 libnvidia-cfg.so.440.44
.rw-r--r--  49M root  1 Jan 18:24 libnvidia-compiler.so.440.44
.rw-r--r--  26M root  1 Jan 18:24 libnvidia-eglcore.so.440.44
.rw-r--r--  99k root  1 Jan 18:24 libnvidia-encode.so.440.44
.rw-r--r-- 386k root  1 Jan 18:24 libnvidia-fatbinaryloader.so.440.44
.rw-r--r-- 135k root  1 Jan 18:24 libnvidia-fbc.so.440.44
.rw-r--r--  28M root  1 Jan 18:24 libnvidia-glcore.so.440.44
.rw-r--r-- 682k root  1 Jan 18:24 libnvidia-glsi.so.440.44
.rw-r--r--  11M root  1 Jan 18:24 libnvidia-glvkspirv.so.440.44
.rw-r--r-- 207k root  1 Jan 18:24 libnvidia-ifr.so.440.44
.rw-r--r-- 1.5M root  1 Jan 18:24 libnvidia-ml.so.440.44
.rw-r--r--  29M root  1 Jan 18:24 libnvidia-opencl.so.440.44
.rw-r--r--  40k root  1 Jan 18:24 libnvidia-opticalflow.so.440.44
.rw-r--r-- 8.9M root  1 Jan 18:24 libnvidia-ptxjitcompiler.so.440.44
.rw-r--r--  33M root  1 Jan 18:24 libnvidia-rtcore.so.440.44
.rw-r--r--  14k root  1 Jan 18:24 libnvidia-tls.so.440.44
.rw-r--r--  94M root  1 Jan 18:24 libnvoptix.so.440.44

However, despite of setting up the flags as proposed in this solution, while building it still finds the EGL files to be at the original OpenGL folder /usr/lib/x86_64-linux-gnu/. I think the problem might come from the csrc/CMakeLists.txt on line 9:

 find_library(EGL_LIBRARIES NAMES egl EGL REQUIRED)

I do not know how to make this to actually point toward my nvidia library folder /usr/lib/nvidia-440. Can someone help me with this? Am I in the right direction? Thank you!

salmedina avatar Jan 02 '20 00:01 salmedina