question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build lib/make.sh with python3 env. failed

See original GitHub issue

Hi Jianwei, I’ve tried to build this project in conda venv with python3 and cuda 9.0. But encountered compile failure while running lib/make.sh.

More build details: https://github.com/clement10601/faster-rcnn.pytorch

Env:

  • OS: Archlinux (4.14.8)
  • x86_64-conda_cos6-linux-gnu-cc: gcc version 7.2.0 (Thread model: posix)
  • nvcc: release 9.0, V9.0.176
  • Graphic card: Tesla k20m

Env var:

  • CPATH=/opt/cuda/include
  • CUDA_PATH=/opt/cuda/

Traceback

/home/kchwang/miniconda3/envs/frcnn3/bin/x86_64-conda_cos6-linux-gnu-cc -DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -fPIC -DWITH_CUDA -I/home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include -I/home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/THC -I/home/kchwang/miniconda3/envs/frcnn3/include/python3.6m -c _roi_crop.c -o ./_roi_crop.o
In file included from /home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/THC/THC.h:4:0,
                 from _roi_crop.c:493:
/home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/THC/THCGeneral.h:9:10: fatal error: cuda.h: No such file or directory
 #include "cuda.h"
          ^~~~~~~~
compilation terminated.
Traceback (most recent call last):
  File "/home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/distutils/unixccompiler.py", line 118, in _compile
    extra_postargs)
  File "/home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/distutils/ccompiler.py", line 909, in spawn
    spawn(cmd, dry_run=self.dry_run)
  File "/home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/distutils/spawn.py", line 36, in spawn
    _spawn_posix(cmd, search_path, dry_run=dry_run)
  File "/home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/distutils/spawn.py", line 159, in _spawn_posix
    % (cmd, exit_status))
distutils.errors.DistutilsExecError: command '/home/kchwang/miniconda3/envs/frcnn3/bin/x86_64-conda_cos6-linux-gnu-cc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/site-packages/cffi/ffiplatform.py", line 51, in _build
    dist.run_command('build_ext')
  File "/home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/distutils/command/build_ext.py", line 339, in run
    self.build_extensions()
  File "/home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
    self._build_extensions_serial()
    1 #!/usr/bin/env bash
  File "/home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
    self.build_extension(ext)
  File "/home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/distutils/command/build_ext.py", line 533, in build_extension
    depends=ext.depends)
  File "/home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/distutils/ccompiler.py", line 574, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "/home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/distutils/unixccompiler.py", line 120, in _compile
    raise CompileError(msg)
distutils.errors.CompileError: command '/home/kchwang/miniconda3/envs/frcnn3/bin/x86_64-conda_cos6-linux-gnu-cc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "build.py", line 36, in <module>
    ffi.build()
  File "/home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/site-packages/torch/utils/ffi/__init__.py", line 167, in build
    _build_extension(ffi, cffi_wrapper_name, target_dir, verbose)
  File "/home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/site-packages/torch/utils/ffi/__init__.py", line 103, in _build_extension
    ffi.compile(tmpdir=tmpdir, verbose=verbose, target=libname)
  File "/home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/site-packages/cffi/api.py", line 690, in compile
    compiler_verbose=verbose, debug=debug, **kwds)
  File "/home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/site-packages/cffi/recompiler.py", line 1515, in recompile
    compiler_verbose, debug)
  File "/home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/site-packages/cffi/ffiplatform.py", line 22, in compile
    outputfilename = _build(tmpdir, ext, compiler_verbose, debug)
  File "/home/kchwang/miniconda3/envs/frcnn3/lib/python3.6/site-packages/cffi/ffiplatform.py", line 58, in _build
    raise VerificationError('%s: %s' % (e.__class__.__name__, e))
cffi.error.VerificationError: CompileError: command '/home/kchwang/miniconda3/envs/frcnn3/bin/x86_64-conda_cos6-linux-gnu-cc' failed with exit status 1

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
AceCooooolcommented, Mar 8, 2018

@ShoufaChen Test “compile one” first:

cd model/nms/src
echo "Compiling nms kernels by nvcc..."
nvcc -c -o nms_cuda_kernel.cu.o nms_cuda_kernel.cu -x cu -Xcompiler -fPIC -arch=sm_52
cd ../
python build.py

if it’s compling correct~ you can change others like this. (Note: sm_xx depend to you gpu)

2reactions
clement10601commented, Jan 25, 2018

@dereyly Problem solved, using following command: CPATH=/opt/cuda/include ./make.sh

Read more comments on GitHub >

github_iconTop Results From Across the Web

pipenv fails to create a virtual environment - Stack Overflow
I create a folder or my Python project and cd into it. I type 'pipenv shell'. I get the following error: Creating a...
Read more >
venv — Creation of virtual environments — Python 3.11.1 ...
Running this command creates the target directory (creating any parent directories that don't exist already) and places a pyvenv.cfg file in it with...
Read more >
Elegantly activating a virtualenv in a Dockerfile - Python⇒Speed
Since you're using a virtualenv , you need to activate it—but if you're just getting started with Dockerfiles, the naive way doesn't work....
Read more >
Python - NixOS Wiki
shell.nix { pkgs ? import <nixpkgs> {} }: let my-python = pkgs.python3; ... In some cases virtualenv fails to install a library because...
Read more >
Installing and using virtualenv with Python 3
Virtualenv is a tool used to create an isolated Python environment. ... you must log into your server via SSH with your Shell...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found