Pytorch-Correlation-extension
Pytorch-Correlation-extension copied to clipboard
Three months ago, I can use the pip command to compile this, but now it's not working.
Three months ago, I used this 'pip install spatial-correlation-sampler' in cuda 11.6 perfectly.
Now, after I create a new conda env which includes cuda11.8, pytorch 2.1. Then, I use the pip command, it will prompt an error:
Collecting spatial-correlation-sampler
Using cached https://mirrors.aliyun.com/pypi/packages/66/dd/a0caccedffdbe27c94851eb1faba5d61c86aacf161005580249550dd969b/spatial_correlation_sampler-0.5.0.tar.gz (9.8 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: torch>=1.1 in ./miniconda3/envs/fewShot/lib/python3.8/site-packages (from spatial-correlation-sampler) (2.1.0)
Requirement already satisfied: numpy in ./miniconda3/envs/fewShot/lib/python3.8/site-packages (from spatial-correlation-sampler) (1.24.1)
Requirement already satisfied: filelock in ./miniconda3/envs/fewShot/lib/python3.8/site-packages (from torch>=1.1->spatial-correlation-sampler) (3.13.1)
Requirement already satisfied: typing-extensions in ./miniconda3/envs/fewShot/lib/python3.8/site-packages (from torch>=1.1->spatial-correlation-sampler) (4.11.0)
Requirement already satisfied: sympy in ./miniconda3/envs/fewShot/lib/python3.8/site-packages (from torch>=1.1->spatial-correlation-sampler) (1.12)
Requirement already satisfied: networkx in ./miniconda3/envs/fewShot/lib/python3.8/site-packages (from torch>=1.1->spatial-correlation-sampler) (3.0)
Requirement already satisfied: jinja2 in ./miniconda3/envs/fewShot/lib/python3.8/site-packages (from torch>=1.1->spatial-correlation-sampler) (3.1.3)
Requirement already satisfied: fsspec in ./miniconda3/envs/fewShot/lib/python3.8/site-packages (from torch>=1.1->spatial-correlation-sampler) (2024.2.0)
Requirement already satisfied: MarkupSafe>=2.0 in ./miniconda3/envs/fewShot/lib/python3.8/site-packages (from jinja2->torch>=1.1->spatial-correlation-sampler) (2.1.3)
Requirement already satisfied: mpmath>=0.19 in ./miniconda3/envs/fewShot/lib/python3.8/site-packages (from sympy->torch>=1.1->spatial-correlation-sampler) (1.3.0)
Building wheels for collected packages: spatial-correlation-sampler
Building wheel for spatial-correlation-sampler (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for spatial-correlation-sampler (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [68 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-38
creating build/lib.linux-x86_64-cpython-38/spatial_correlation_sampler
copying Correlation_Module/spatial_correlation_sampler/spatial_correlation_sampler.py -> build/lib.linux-x86_64-cpython-38/spatial_correlation_sampler
copying Correlation_Module/spatial_correlation_sampler/init.py -> build/lib.linux-x86_64-cpython-38/spatial_correlation_sampler
running build_ext
/tmp/pip-build-env-qykojga5/overlay/lib/python3.8/site-packages/torch/utils/cpp_extension.py:499: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
warnings.warn(msg.format('we could not find ninja.'))
Traceback (most recent call last):
File "/home/xuchengcheng/miniconda3/envs/fewShot/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in
note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for spatial-correlation-sampler Failed to build spatial-correlation-sampler ERROR: Could not build wheels for spatial-correlation-sampler, which is required to install pyproject.toml-based projects
Is there anything wrong with my experimental environment?Hoping the owner can answer my doubts, thanks!
Hi, by default, this will build the package with an isolated package, with the last version of pytorch (the one you would get by calling pip install torch . If your pytorch version differs, you now need to use the --no-build-isolation option so that it gets built within your environment with the right pytorch (and cuda) version
pip install spatial-correlation-sample --no-build-isolation
This is because new pip build scripts are now required to run within a dedicated virtual environment. See related discussion for xformers : https://github.com/facebookresearch/xformers/issues/940#issuecomment-1952131339
I met the same problem "The detected CUDA version (12.4) mismatches the version that was used to compile
PyTorch (11.7). ". I used conda install cudatoolkit==11.7 to try to install the suitable version, and I found cuda-nvcc=12.4 in the downloading list. I install cuda-nvcc=11.7 separately and this works.