zzangjinsun / NLSPN_ECCV20

Park et al., Non-Local Spatial Propagation Network for Depth Completion, ECCV, 2020
MIT License
321 stars 55 forks source link

DCN is installed in global environment rather than activated conda virtual environment #55

Closed JiaqiongLi closed 1 year ago

JiaqiongLi commented 1 year ago

I tried to build the DCN module in my virtual environment. However, it was always installed in the global environment. It was built successfully but not in the virtual environment I wanted. Is there anyone know the reason?

setup: CUDA 11.3 + pytorch 1.10.1 + python 3.8 This is how I set up the variable path in ~/.bashrc and cuda is the symlink of cuda-11.3 if [ $LD_LIBRARY_PATH ]; then export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64 else export LD_LIBRARY_PATH=/usr/local/cuda/lib64 fi

if [ $PATH ]; then export PATH=$PATH:/usr/local/cuda/bin else export PATH=/usr/local/cuda/bin fi

if [ $CUDA_HOME ]; then export CUDA_HOME=$CUDA_HOME:/usr/local/cuda else export CUDA_HOME=/usr/local/cuda fi

Installed /usr/local/lib/python3.6/dist-packages/DCN-1.0-py3.6-linux-x86_64.egg Processing dependencies for DCN==1.0 Finished processing dependencies for DCN==1.0

zzangjinsun commented 1 year ago

I think you should install cudatoolkit-dev in your conda environment (not cudatoolkit)

JiaqiongLi commented 1 year ago

I think you should install cudatoolkit-dev in your conda environment (not cudatoolkit)

Thank you so much for your quick reply. Unfortunately, it doesn't work.

JiaqiongLi commented 1 year ago

I think you should install cudatoolkit-dev in your conda environment (not cudatoolkit)

I still doubt there is a small mistake in the environment variable setup. Could you kindly share your environment path, including $PATH, $CUDA_HOME, and $LD_LIBRARY_PATH ? Besides, I tried to replace DCN with mmcv.ops.modulated_deform_conv to replace. However, it seems that some functions are different for the two modules. Is it doable to replace DCN with the implementation in mmcv?

Any replies would be appreciated!

zzangjinsun commented 1 year ago

I do not explicitly set PATH, CUDA_HOME, and LD_LIBRARY_PATH variables in ~/.bashrc. Why don't you try removing all of the export commands, then activate your conda to build DCN?

JiaqiongLi commented 1 year ago

I do not explicitly set PATH, CUDA_HOME, and LD_LIBRARY_PATH variables in ~/.bashrc. Why don't you try removing all of the export commands, then activate your conda to build DCN?

Probably not, as PATH will tell the system the location of conda. If I delete conda from the PATH, CUDA_HOME, and LD_LIBRARY_PATH, I cannot use conda to activate the environment and nvcc will not be found. Anyway, thank you so much!

JiaqiongLi commented 1 year ago

I finally found the reason is that the python link is "usr/bin/python" which points to the global python when I run "python setup.py build install" even though I activated the conda environment. It's weird as it should be the path under conda environment, and the first value of $PATH is current conda path. When I run other scripts the python path is right. To bypass this issue and install DCN to the conda environment, I deleted the link that points to the global python and changed it the python under conda environment as follows: sudo rm /usr/bin/python, sudo ln -s ~/anaconda3/envs/depth/bin/python3.7 /usr/bin/python