pyg-team / pytorch_geometric

Graph Neural Network Library for PyTorch
https://pyg.org
MIT License
21.38k stars 3.67k forks source link

Failed building wheel for torch-cluster #4460

Open HUSTNO1WXY opened 2 years ago

HUSTNO1WXY commented 2 years ago

😵 Describe the installation problem

Looking in links: https://data.pyg.org/whl/torch-1.8.1+cu102.html
Collecting torch-cluster
  Using cached torch_cluster-1.6.0.tar.gz (43 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: torch-cluster
  Building wheel for torch-cluster (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [80 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-3.8
      creating build\lib.win-amd64-3.8\torch_cluster
      copying torch_cluster\fps.py -> build\lib.win-amd64-3.8\torch_cluster
      copying torch_cluster\graclus.py -> build\lib.win-amd64-3.8\torch_cluster
      copying torch_cluster\grid.py -> build\lib.win-amd64-3.8\torch_cluster
      copying torch_cluster\knn.py -> build\lib.win-amd64-3.8\torch_cluster
      copying torch_cluster\nearest.py -> build\lib.win-amd64-3.8\torch_cluster
      copying torch_cluster\radius.py -> build\lib.win-amd64-3.8\torch_cluster
      copying torch_cluster\rw.py -> build\lib.win-amd64-3.8\torch_cluster
      copying torch_cluster\sampler.py -> build\lib.win-amd64-3.8\torch_cluster
      copying torch_cluster\__init__.py -> build\lib.win-amd64-3.8\torch_cluster
      running egg_info
      writing torch_cluster.egg-info\PKG-INFO
      writing dependency_links to torch_cluster.egg-info\dependency_links.txt
      writing requirements to torch_cluster.egg-info\requires.txt
      writing top-level names to torch_cluster.egg-info\top_level.txt
      reading manifest file 'torch_cluster.egg-info\SOURCES.txt'
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\14438\AppData\Local\Temp\pip-install-1_m0s98v\torch-cluster_8cfbf8365faf46e3bd2131b2bf0fee16\setup.py", line 98, in <module>
          setup(
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\__init__.py", line 145, in setup
          return distutils.core.setup(**attrs)
        File "D:\Anaconda\envs\loftr\lib\distutils\core.py", line 148, in setup
          dist.run_commands()
        File "D:\Anaconda\envs\loftr\lib\distutils\dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "D:\Anaconda\envs\loftr\lib\distutils\dist.py", line 985, in run_command
          cmd_obj.run()
        File "D:\Anaconda\envs\loftr\lib\site-packages\wheel\bdist_wheel.py", line 299, in run
          self.run_command('build')
        File "D:\Anaconda\envs\loftr\lib\distutils\cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "D:\Anaconda\envs\loftr\lib\distutils\dist.py", line 985, in run_command
          cmd_obj.run()
        File "D:\Anaconda\envs\loftr\lib\distutils\command\build.py", line 135, in run
          self.run_command(cmd_name)
        File "D:\Anaconda\envs\loftr\lib\distutils\cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "D:\Anaconda\envs\loftr\lib\distutils\dist.py", line 985, in run_command
          cmd_obj.run()
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\build_py.py", line 53, in run
          self.build_package_data()
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\build_py.py", line 118, in build_package_data
          for package, src_dir, build_dir, filenames in self.data_files:
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\build_py.py", line 66, in __getattr__
          self.data_files = self._get_data_files()
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\build_py.py", line 82, in _get_data_files
          self.analyze_manifest()
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\build_py.py", line 138, in analyze_manifest
          self.run_command('egg_info')
        File "D:\Anaconda\envs\loftr\lib\distutils\cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "D:\Anaconda\envs\loftr\lib\distutils\dist.py", line 985, in run_command
          cmd_obj.run()
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\egg_info.py", line 296, in run
          self.find_sources()
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\egg_info.py", line 303, in find_sources
          mm.run()
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\egg_info.py", line 534, in run
          self.add_defaults()
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\egg_info.py", line 578, in add_defaults
          self.read_manifest()
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\sdist.py", line 199, in read_manifest
          self.filelist.append(line)
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\egg_info.py", line 476, in append
          path = convert_path(item)
        File "D:\Anaconda\envs\loftr\lib\distutils\util.py", line 122, in convert_path
          raise ValueError("path '%s' cannot be absolute" % pathname)
      ValueError: path '/Users/rusty1s/github/pytorch_cluster/csrc/fps.cpp' cannot be absolute
      Error in atexit._run_exitfuncs:
      Traceback (most recent call last):
        File "D:\Anaconda\envs\loftr\lib\site-packages\colorama\ansitowin32.py", line 59, in closed
          return stream.closed
      ValueError: underlying buffer has been detached
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for torch-cluster
  Running setup.py clean for torch-cluster
Failed to build torch-cluster
Installing collected packages: torch-cluster
  Running setup.py install for torch-cluster ... error
  error: subprocess-exited-with-error

  × Running setup.py install for torch-cluster did not run successfully.
  │ exit code: 1
  ╰─> [82 lines of output]
      running install
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-3.8
      creating build\lib.win-amd64-3.8\torch_cluster
      copying torch_cluster\fps.py -> build\lib.win-amd64-3.8\torch_cluster
      copying torch_cluster\graclus.py -> build\lib.win-amd64-3.8\torch_cluster
      copying torch_cluster\grid.py -> build\lib.win-amd64-3.8\torch_cluster
      copying torch_cluster\knn.py -> build\lib.win-amd64-3.8\torch_cluster
      copying torch_cluster\nearest.py -> build\lib.win-amd64-3.8\torch_cluster
      copying torch_cluster\radius.py -> build\lib.win-amd64-3.8\torch_cluster
      copying torch_cluster\rw.py -> build\lib.win-amd64-3.8\torch_cluster
      copying torch_cluster\sampler.py -> build\lib.win-amd64-3.8\torch_cluster
      copying torch_cluster\__init__.py -> build\lib.win-amd64-3.8\torch_cluster
      running egg_info
      writing torch_cluster.egg-info\PKG-INFO
      writing dependency_links to torch_cluster.egg-info\dependency_links.txt
      writing requirements to torch_cluster.egg-info\requires.txt
      writing top-level names to torch_cluster.egg-info\top_level.txt
      reading manifest file 'torch_cluster.egg-info\SOURCES.txt'
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\14438\AppData\Local\Temp\pip-install-1_m0s98v\torch-cluster_8cfbf8365faf46e3bd2131b2bf0fee16\setup.py", line 98, in <module>
          setup(
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\__init__.py", line 145, in setup
          return distutils.core.setup(**attrs)
        File "D:\Anaconda\envs\loftr\lib\distutils\core.py", line 148, in setup
          dist.run_commands()
        File "D:\Anaconda\envs\loftr\lib\distutils\dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "D:\Anaconda\envs\loftr\lib\distutils\dist.py", line 985, in run_command
          cmd_obj.run()
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\install.py", line 61, in run
          return orig.install.run(self)
        File "D:\Anaconda\envs\loftr\lib\distutils\command\install.py", line 545, in run
          self.run_command('build')
        File "D:\Anaconda\envs\loftr\lib\distutils\cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "D:\Anaconda\envs\loftr\lib\distutils\dist.py", line 985, in run_command
          cmd_obj.run()
        File "D:\Anaconda\envs\loftr\lib\distutils\command\build.py", line 135, in run
          self.run_command(cmd_name)
        File "D:\Anaconda\envs\loftr\lib\distutils\cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "D:\Anaconda\envs\loftr\lib\distutils\dist.py", line 985, in run_command
          cmd_obj.run()
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\build_py.py", line 53, in run
          self.build_package_data()
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\build_py.py", line 118, in build_package_data
          for package, src_dir, build_dir, filenames in self.data_files:
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\build_py.py", line 66, in __getattr__
          self.data_files = self._get_data_files()
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\build_py.py", line 82, in _get_data_files
          self.analyze_manifest()
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\build_py.py", line 138, in analyze_manifest
          self.run_command('egg_info')
        File "D:\Anaconda\envs\loftr\lib\distutils\cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "D:\Anaconda\envs\loftr\lib\distutils\dist.py", line 985, in run_command
          cmd_obj.run()
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\egg_info.py", line 296, in run
          self.find_sources()
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\egg_info.py", line 303, in find_sources
          mm.run()
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\egg_info.py", line 534, in run
          self.add_defaults()
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\egg_info.py", line 578, in add_defaults
          self.read_manifest()
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\sdist.py", line 199, in read_manifest
          self.filelist.append(line)
        File "D:\Anaconda\envs\loftr\lib\site-packages\setuptools\command\egg_info.py", line 476, in append
          path = convert_path(item)
        File "D:\Anaconda\envs\loftr\lib\distutils\util.py", line 122, in convert_path
          raise ValueError("path '%s' cannot be absolute" % pathname)
      ValueError: path '/Users/rusty1s/github/pytorch_cluster/csrc/fps.cpp' cannot be absolute
      Error in atexit._run_exitfuncs:
      Traceback (most recent call last):
        File "D:\Anaconda\envs\loftr\lib\site-packages\colorama\ansitowin32.py", line 59, in closed
          return stream.closed
      ValueError: underlying buffer has been detached
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> torch-cluster

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Environment

rusty1s commented 2 years ago

Can you try to fix the versioning according to the latest supported version of torch-cluster for PyTorch 1.8 (see here)?

pip install torch-cluster==1.5.9 -f https://data.pyg.org/whl/torch-1.8.1+cu102.html
kliang31 commented 2 years ago

Hi Matthias, I had the same issue as OP, and tried version 1.5.9 install, but modified for my case (note I'm using pipenv): pipenv install torch-cluster==1.5.9 -f https://data.pyg.org/whl/torch-1.8.1+cpu.html

the link specified also failed to build for my case, but I got a different error. See below abbreviated output

C:\Users\Paran.virtualenvs\HSR_Project-f_Oht-Bk\lib\site-packages\torch\include\c10/util/Optional.h(540): note: see reference to alias template instantiation 'c10::OptionalBase<std::tuple<at::Tensor,at::Tensor>>' being compiled C:\Users\Paran.virtualenvs\HSR_Project-f_Oht-Bk\lib\site-packages\torch\include\torch\csrc\api\include\torch/nn/modules/rnn.h(155): note: see reference to class template instantiation 'c10::optional<std::tuple<at::Tensor,at::Tensor>>' being compiled C:\Users\Paran.virtualenvs\HSR_Project-f_Oht-Bk\lib\site-packages\torch\include\c10/util/Optional.h(432): warning C4624: 'c10::trivially_copyable_optimization_optional_base': destructor was implicitly defined as deleted with [ T=std::tuple<at::Tensor,at::Tensor> ] C:\Users\Paran.virtualenvs\HSR_Project-f_Oht-Bk\lib\site-packages\torch\include\c10/util/Optional.h(198): warning C4624: 'c10::constexpr_storage_t': destructor was implicitly defined as deleted with [ T=std::vector<at::Tensor,std::allocator> ] C:\Users\Paran.virtualenvs\HSR_Project-f_Oht-Bk\lib\site-packages\torch\include\c10/util/Optional.h(397): note: see reference to class template instantiation 'c10::constexpr_storage_t' being compiled with [ T=std::vector<at::Tensor,std::allocator> ] C:\Users\Paran.virtualenvs\HSR_Project-f_Oht-Bk\lib\site-packages\torch\include\c10/util/Optional.h(540): note: see reference to class template instantiation 'c10::trivially_copyable_optimization_optional_base' being compiled with [ T=std::vector<at::Tensor,std::allocator> ] C:\Users\Paran.virtualenvs\HSR_Project-f_Oht-Bk\lib\site-packages\torch\include\c10/util/Optional.h(540): note: see reference to alias template instantiation 'c10::OptionalBase<std::vector<at::Tensor,std::allocator>>' being compiled C:\Users\Paran.virtualenvs\HSR_Project-f_Oht-Bk\lib\site-packages\torch\include\torch\csrc\api\include\torch/optim/lbfgs.h(46): note: see reference to class template instantiation 'c10::optional<std::vector<at::Tensor,std::allocator>>' being compiled C:\Users\Paran.virtualenvs\HSR_Project-f_Oht-Bk\lib\site-packages\torch\include\c10/util/Optional.h(432): warning C4624: 'c10::trivially_copyable_optimization_optional_base': destructor was implicitly defined as deleted with [ T=std::vector<at::Tensor,std::allocator> ] C:\Users\Paran\AppData\Local\Temp\pip-install-bujwkm12\torch-cluster_7b1ab611b05444128708e28bcd0e9163\csrc\cpu\fps_cpu.cpp : fatal error C1083: Cannot open compiler generated file: '': Invalid argument error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe' failed with exit code 1 [end of output]

rusty1s commented 2 years ago

This error suggests that it is not actually picking up the wheels from https://data.pyg.org/whl/torch-1.8.1+cpu.html. Does pipenv support the -f option? What's the output when installing via --verbose?

kliang31 commented 2 years ago

Right, I realized with a separate package that -f is not supported. pipenv requires you to directly reference the whl if not found in the default directory, as far as I can tell. I managed to install with this:

pipenv install https://data.pyg.org/whl/torch-1.8.0%2Bcpu/torch_cluster-1.5.9-cp39-cp39-win_amd64.whl

Mridhula311 commented 1 year ago

Can you try to fix the versioning according to the latest supported version of torch-cluster for PyTorch 1.8 (see here)?

pip install torch-cluster==1.5.9 -f https://data.pyg.org/whl/torch-1.8.1+cu102.html

this solution worked

snow-lin commented 3 months ago

您可以尝试根据 PyTorch 1.8 的最新支持版本修复版本控制吗(请参阅此处)?torch-cluster

pip install torch-cluster==1.5.9 -f https://data.pyg.org/whl/torch-1.8.1+cu102.html

这个解决方案奏效了

这个可以

twangnh commented 3 months ago

still cannot install with torch 1.13.1, tried pip install torch-cluster==1.5.9 -f https://data.pyg.org/whl/torch-1.13.1+cu116.html

siddharthyashaswee commented 2 months ago

I solved using these steps:

  1. go to https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html
  2. Select Pytorch, cuda version and OS, set package as pip
  3. Copy the link that appears after Optional dependency, my case it was: https://data.pyg.org/whl/torch-2.4.0+cu124.html
  4. Go to the link and note the torch-cluster version a/c to your OS/architecture, my case : 1.6.3
  5. Run command with torch-cluster version and link from above steps, my case: pip install torch-cluster==1.6.3 -f https://data.pyg.org/whl/torch-2.4.0+cu124.html Worked like a charm for me!!