Project-MONAI / MONAI

AI Toolkit for Healthcare Imaging
https://monai.io/
Apache License 2.0
5.92k stars 1.09k forks source link

g++ error: no such file or directory (To build with MONAI Cpp/CUDA extensions) #3201

Closed hired-ld closed 3 years ago

hired-ld commented 3 years ago

c, I ran codes: git clone https://github.com/Project-MONAI/MONAI.git cd MONAI/ BUILD_MONAI=1 python setup.py develop

but, some errors happened. How to solve this question?

g++: error: /home/.../MONAI/build/temp.linux-x86_64-3.6/home/.../MONAI/monai/csrc/ext.o: 没有那个文件或目录 g++: error: /home/.../MONAI/build/temp.linux-x86_64-3.6/home/.../MONAI/monai/csrc/resample/pushpull_cpu.o: 没有那个文件或目录 g++: error: /home/.../MONAI/build/temp.linux-x86_64-3.6/home/.../MONAI/monai/csrc/filtering/bilateral/bilateral.o: 没有那个文件或目录 g++: error: /home/.../MONAI/build/temp.linux-x86_64-3.6/home/.../MONAI/monai/csrc/filtering/bilateral/bilateralfilter_cpu.o: 没有那个文件或目录 g++: error: /home/.../MONAI/build/temp.linux-x86_64-3.6/home/.../MONAI/monai/csrc/filtering/bilateral/bilateralfilter_cpu_phl.o: 没有那个文件或目录 g++: error: /home/.../MONAI/build/temp.linux-x86_64-3.6/home/.../MONAI/monai/csrc/filtering/permutohedral/permutohedral_cpu.o: 没有那个文件或目录 g++: error: /home/.../MONAI/build/temp.linux-x86_64-3.6/home/.../MONAI/monai/csrc/filtering/permutohedral/permutohedral.o: 没有那个文件或目录 g++: error: /home/.../MONAI/build/temp.linux-x86_64-3.6/home/.../MONAI/monai/csrc/lltm/lltm_cpu.o: 没有那个文件或目录 g++: error: /home/.../MONAI/build/temp.linux-x86_64-3.6/home/.../MONAI/monai/csrc/resample/pushpull_cuda.o: 没有那个文件或目录 g++: error: /home/.../MONAI/build/temp.linux-x86_64-3.6/home/.../MONAI/monai/csrc/filtering/bilateral/bilateralfilter_cuda.o: 没有那个文件或目录 g++: error: /home/.../MONAI/build/temp.linux-x86_64-3.6/home/.../MONAI/monai/csrc/filtering/bilateral/bilateralfilter_cuda_phl.o: 没有那个文件或目录 g++: error: /home/.../MONAI/build/temp.linux-x86_64-3.6/home/.../MONAI/monai/csrc/filtering/permutohedral/permutohedral_cuda.o: 没有那个文件或目录 g++: error: /home/.../MONAI/build/temp.linux-x86_64-3.6/home/.../MONAI/monai/csrc/lltm/lltm_cuda.o: 没有那个文件或目录

wyli commented 3 years ago

could you please post the full logs?

hired-ld commented 3 years ago

could you please post the full logs?

ok, when I ran "cd MONAI" and ' BUILD_MONAI=1 python setup.py develop', the full logs are as follow:

setup.py with torch 1.8.1 BUILD_MONAI_CPP=True, BUILD_MONAI_CUDA=True, TORCH_VERSION=10801. running develop running egg_info writing monai.egg-info/PKG-INFO writing dependency_links to monai.egg-info/dependency_links.txt writing requirements to monai.egg-info/requires.txt writing top-level names to monai.egg-info/top_level.txt reading manifest file 'monai.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'monai.egg-info/SOURCES.txt' running build_ext building 'monai._C' extension Emitting ninja build file /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/build.ninja... Compiling objects... Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N) 1.10.2.git.kitware.jobserver-1 g++ -pthread -shared -B /home/common/anaconda3/envs/dsh/compiler_compat -L/home/common/anaconda3/envs/dsh/lib -Wl,-rpath=/home/common/anaconda3/envs/dsh/lib -Wl,--no-as-needed -Wl,--sysroot=/ /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/ext.o /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/resample/pushpull_cpu.o /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/filtering/bilateral/bilateral.o /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/filtering/bilateral/bilateralfilter_cpu.o /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/filtering/bilateral/bilateralfilter_cpu_phl.o /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/filtering/permutohedral/permutohedral_cpu.o /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/filtering/permutohedral/permutohedral.o /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/lltm/lltm_cpu.o /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/resample/pushpull_cuda.o /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/filtering/bilateral/bilateralfilter_cuda.o /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/filtering/bilateral/bilateralfilter_cuda_phl.o /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/filtering/permutohedral/permutohedral_cuda.o /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/lltm/lltm_cuda.o -L/home/common/anaconda3/envs/dsh/lib/python3.6/site-packages/torch/lib -L/usr/local/cuda-11.0/lib64 -lc10 -ltorch -ltorch_cpu -ltorch_python -lcudart -lc10_cuda -ltorch_cuda_cu -ltorch_cuda_cpp -o build/lib.linux-x86_64-3.6/monai/_C.so -fopenmp g++: error: /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/ext.o: 没有那个文件或目录 g++: error: /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/resample/pushpull_cpu.o: 没有那个文件或目录 g++: error: /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/filtering/bilateral/bilateral.o: 没有那个文件或目录 g++: error: /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/filtering/bilateral/bilateralfilter_cpu.o: 没有那个文件或目录 g++: error: /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/filtering/bilateral/bilateralfilter_cpu_phl.o: 没有那个文件或目录 g++: error: /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/filtering/permutohedral/permutohedral_cpu.o: 没有那个文件或目录 g++: error: /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/filtering/permutohedral/permutohedral.o: 没有那个文件或目录 g++: error: /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/lltm/lltm_cpu.o: 没有那个文件或目录 g++: error: /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/resample/pushpull_cuda.o: 没有那个文件或目录 g++: error: /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/filtering/bilateral/bilateralfilter_cuda.o: 没有那个文件或目录 g++: error: /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/filtering/bilateral/bilateralfilter_cuda_phl.o: 没有那个文件或目录 g++: error: /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/filtering/permutohedral/permutohedral_cuda.o: 没有那个文件或目录 g++: error: /home/common/DSH/Liver_Y/MONAI/build/temp.linux-x86_64-3.6/home/common/DSH/Liver_Y/MONAI/monai/csrc/lltm/lltm_cuda.o: 没有那个文件或目录 error: command 'g++' failed with exit status 1

After ran the code:'python -c 'import monai; monai.config.print_config()', the output is :

Numpy version: 1.19.2 Pytorch version: 1.8.1 MONAI flags: HAS_EXT = False, USE_COMPILED = False MONAI rev id: 7dc364cdf5524fd6a2d24d2abc63894651ce4c61

Optional dependencies: Pytorch Ignite version: 0.4.6 Nibabel version: 3.2.1 scikit-image version: 0.17.2 Pillow version: 8.2.0 Tensorboard version: 2.6.0 gdown version: 4.2.0 TorchVision version: 0.9.1 tqdm version: 4.59.0 lmdb version: 1.2.1 psutil version: 5.8.0 pandas version: 1.1.5 einops version: 0.3.2 transformers version: 4.11.3 mlflow version: 1.21.0

For details about installing the optional dependencies, please visit: https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies

wyli commented 3 years ago

looks like some build process is missing from the log, could you run sh runtests.sh --clean to clean up the temporary files and try again?

hired-ld commented 3 years ago

Thank you. I create a new env, and setup the monai successfully.

Concretely, I run BUILD_MONAI=1 pip install --no-build-isolation git+https://github.com/Project-MONAI/MONAI#egg=monai