Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request / Question] Modifications Required to run on ARM / M1 #159

Open
The-Real-Thisas opened this issue Jul 8, 2022 · 20 comments
Assignees

Comments

@The-Real-Thisas
Copy link

Since I didn't see any mention of M1 or ARM and the current build fails. I was wondering what changes may be needed to support the architecture.

Short Version:

 ~ pip install --upgrade git+https://github.com/mit-han-lab/torchsparse.git@v1.4.0

Building wheels for collected packages: torchsparse
  Building wheel for torchsparse (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [58 lines of output]
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/thisas/miniforge3/include -arch arm64 -fPIC -O2 -isystem /Users/thisas/miniforge3/include -arch arm64 -I/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/include -I/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/include/TH -I/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/include/THC -I/Users/thisas/miniforge3/include/python3.9 -c torchsparse/backend/convolution/convolution_cpu.cpp -o build/temp.macosx-11.0-arm64-cpython-39/torchsparse/backend/convolution/convolution_cpu.o -g -O3 -fopenmp -lgomp -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_clang\" -DPYBIND11_STDLIB=\"_libcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1002\" -DTORCH_EXTENSION_NAME=backend -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
      clang: warning: -lgomp: 'linker' input unused [-Wunused-command-line-argument]
      clang: error: unsupported option '-fopenmp'
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

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

  × Running setup.py install for torchsparse did not run successfully.
  │ exit code: 1
  ╰─> [60 lines of output]
      running install
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/thisas/miniforge3/include -arch arm64 -fPIC -O2 -isystem /Users/thisas/miniforge3/include -arch arm64 -I/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/include -I/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/include/TH -I/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/include/THC -I/Users/thisas/miniforge3/include/python3.9 -c torchsparse/backend/convolution/convolution_cpu.cpp -o build/temp.macosx-11.0-arm64-cpython-39/torchsparse/backend/convolution/convolution_cpu.o -g -O3 -fopenmp -lgomp -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_clang\" -DPYBIND11_STDLIB=\"_libcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1002\" -DTORCH_EXTENSION_NAME=backend -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
      clang: warning: -lgomp: 'linker' input unused [-Wunused-command-line-argument]
      clang: error: unsupported option '-fopenmp'
      error: command '/usr/bin/clang' failed with exit code 1
      [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.
╰─> torchsparse

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

Full Log:
fail.log

@The-Real-Thisas The-Real-Thisas changed the title Modifications Required to run on ARM / M1 [Feature Request / Question] Modifications Required to run on ARM / M1 Jul 8, 2022
@zhijian-liu
Copy link
Contributor

zhijian-liu commented Jul 15, 2022

Could you maybe try to use gcc instead of clang for the compilation?

@zhijian-liu zhijian-liu self-assigned this Jul 15, 2022
@The-Real-Thisas
Copy link
Author

I attempted.

I think maybe this is the wrong way to do it.

 ~ pip install --global-option build_ext --global-option --compiler=gcc --upgrade git+https://github.com/mit-han-lab/torchsparse.git@v1.4.0

WARNING: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
Collecting git+https://github.com/mit-han-lab/torchsparse.git@v1.4.0
  Cloning https://github.com/mit-han-lab/torchsparse.git (to revision v1.4.0) to /private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-req-build-x1r2vkq5
  Running command git clone --filter=blob:none --quiet https://github.com/mit-han-lab/torchsparse.git /private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-req-build-x1r2vkq5
  Running command git checkout -q 74099d10a51c71c14318bce63d6421f698b24f24
  Resolved https://github.com/mit-han-lab/torchsparse.git to commit 74099d10a51c71c14318bce63d6421f698b24f24
  Preparing metadata (setup.py) ... done
Skipping wheel build for torchsparse, due to binaries being disabled for it.
Installing collected packages: torchsparse
  Running setup.py install for torchsparse ... error
  error: subprocess-exited-with-error

  × Running setup.py install for torchsparse did not run successfully.
  │ exit code: 1
  ╰─> [2 lines of output]
      running build_ext
      error: don't know how to compile C/C++ code on platform 'posix' with 'gcc' compiler
      [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.
╰─> torchsparse

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

@The-Real-Thisas
Copy link
Author

Weirdly enough this conda package (https://anaconda.org/conda-forge/torchsparse) actually builds but when I execute an example script.

from torch import nn
from torchsparse import nn as spnn

model = nn.Sequential(
    spnn.Conv3d(in_channels, out_channels, kernel_size),
    spnn.BatchNorm(out_channels),
    spnn.ReLU(True),
)

It gives me an error.

(base)  ~ python3 temp.py
Traceback (most recent call last):
  File "/Users/thisas/temp.py", line 2, in <module>
    from torchsparse import nn as spnn
  File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torchsparse/nn/__init__.py", line 1, in <module>
    from .modules import *
  File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torchsparse/nn/modules/__init__.py", line 3, in <module>
    from .conv import *
  File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torchsparse/nn/modules/conv.py", line 9, in <module>
    from torchsparse.nn import functional as F
  File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torchsparse/nn/functional/__init__.py", line 2, in <module>
    from .conv import *
  File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torchsparse/nn/functional/conv.py", line 7, in <module>
    import torchsparse.backend
ImportError: dlopen(/Users/thisas/miniforge3/lib/python3.9/site-packages/torchsparse/backend.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '__ZNK2at10TensorBase8data_ptrIlEEPT_v'

I think this is indicative of some sort of dependacy collision.

Related Stackoverflow

Python Version: Python 3.9.13
Pytorch: 1.11.0.post2

@zhijian-liu
Copy link
Contributor

I think you could try setting CC or CXX instead to specify which compiler to use for building TorchSparse.

@The-Real-Thisas
Copy link
Author

I'm sorry @zhijian-liu I'm not sure how I can do that. Could you maybe provide what flag I should set since I feel out of my depth here.

@zhijian-liu
Copy link
Contributor

No worries! I'm not very certain either. Could you maybe try export CXX=<path-to-g++> before installation (see https://unix.stackexchange.com/questions/298810/how-to-change-the-default-cc-command-on-mac-os)?

@zhijian-liu
Copy link
Contributor

@The-Real-Thisas, I'm just checking in to see if this issue has been resolved. Thanks!

@The-Real-Thisas
Copy link
Author

Sorry @zhijian-liu I was busy for the past few weeks and was unable to focus on this.

I tested with setting CXX

(base)  ~ export CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin && pip install --upgrade git+https://github.com/mit-han-lab/torchsparse.git@v1.4.0
Collecting git+https://github.com/mit-han-lab/torchsparse.git@v1.4.0
  Cloning https://github.com/mit-han-lab/torchsparse.git (to revision v1.4.0) to /private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-req-build-iomdfi44
  Running command git clone --filter=blob:none --quiet https://github.com/mit-han-lab/torchsparse.git /private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-req-build-iomdfi44
  Running command git checkout -q 74099d10a51c71c14318bce63d6421f698b24f24
  Resolved https://github.com/mit-han-lab/torchsparse.git to commit 74099d10a51c71c14318bce63d6421f698b24f24
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-req-build-iomdfi44/setup.py", line 7, in <module>
          from torch.utils.cpp_extension import (CUDA_HOME, BuildExtension, CppExtension,
      ModuleNotFoundError: No module named 'torch.utils.cpp_extension'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

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

It's a different error so I think it is progress ?

I think it's a problem with pytorch since it gives a ModuleNotFoundError but I have torch installed, maybe it is a version issue ?

(base)  ~ pip show torch
Name: torch
Version: 1.12.0
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Home-page: https://pytorch.org/
Author: PyTorch Team
Author-email: packages@pytorch.org
License: BSD-3
Location: /Users/thisas/miniforge3/lib/python3.9/site-packages
Requires: typing-extensions
Required-by: timm, torchvision

I'm not sure where to go from here, maybe try building from the repo manually ?

@The-Real-Thisas
Copy link
Author

@zhijian-liu, Sorry for the delay, just wondering what I can do from here ?

@zhijian-liu
Copy link
Contributor

Sorry for the late reply. Could you double-check in your Python that you could import torch.utils.cpp_extension?

@The-Real-Thisas
Copy link
Author

Nope it gives me a ModuleNotFoundError: No module named 'torch.utils.cpp_extension' however importing from torch import nn works.

@zhijian-liu
Copy link
Contributor

Hmmm, this seems to be a PyTorch issue. Could you double-check the PyTorch version?

@The-Real-Thisas
Copy link
Author

The-Real-Thisas commented Sep 18, 2022

From pip show torch

Name: torch
Version: 1.12.0
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Home-page: https://pytorch.org/
Author: PyTorch Team
Author-email: packages@pytorch.org
License: BSD-3
Location: /Users/thisas/miniforge3/lib/python3.9/site-packages
Requires: typing-extensions
Required-by: timm, torchvision

@zhijian-liu
Copy link
Contributor

Could you maybe try downgrading PyTorch to 1.11.0?

@The-Real-Thisas
Copy link
Author

Now import torch.utils.cpp_extension works but trying to install torchsparse gives the same error.

(base)  ~/Desktop/  export CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin && pip install --upgrade git+https://github.com/mit-han-lab/torchsparse.git@v1.4.0
Collecting git+https://github.com/mit-han-lab/torchsparse.git@v1.4.0
  Cloning https://github.com/mit-han-lab/torchsparse.git (to revision v1.4.0) to /private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-req-build-gqkg3sbj
  Running command git clone --filter=blob:none --quiet https://github.com/mit-han-lab/torchsparse.git /private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-req-build-gqkg3sbj
  Running command git checkout -q 74099d10a51c71c14318bce63d6421f698b24f24
  Resolved https://github.com/mit-han-lab/torchsparse.git to commit 74099d10a51c71c14318bce63d6421f698b24f24
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: torchsparse
  Building wheel for torchsparse (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [94 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-11.0-arm64-cpython-39
      creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse
      copying torchsparse/version.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse
      copying torchsparse/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse
      copying torchsparse/tensor.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse
      copying torchsparse/operators.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse
      creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn
      copying torchsparse/nn/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn
      creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse/utils
      copying torchsparse/utils/collate.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/utils
      copying torchsparse/utils/quantize.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/utils
      copying torchsparse/utils/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/utils
      copying torchsparse/utils/utils.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/utils
      creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/utils
      copying torchsparse/nn/utils/kernel.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/utils
      copying torchsparse/nn/utils/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/utils
      copying torchsparse/nn/utils/apply.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/utils
      creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
      copying torchsparse/nn/modules/norm.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
      copying torchsparse/nn/modules/pooling.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
      copying torchsparse/nn/modules/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
      copying torchsparse/nn/modules/crop.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
      copying torchsparse/nn/modules/activation.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
      copying torchsparse/nn/modules/bev.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
      copying torchsparse/nn/modules/conv.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
      creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      copying torchsparse/nn/functional/downsample.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      copying torchsparse/nn/functional/query.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      copying torchsparse/nn/functional/devoxelize.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      copying torchsparse/nn/functional/pooling.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      copying torchsparse/nn/functional/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      copying torchsparse/nn/functional/crop.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      copying torchsparse/nn/functional/hash.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      copying torchsparse/nn/functional/activation.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      copying torchsparse/nn/functional/conv.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      copying torchsparse/nn/functional/voxelize.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      copying torchsparse/nn/functional/count.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      running build_ext
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-req-build-gqkg3sbj/setup.py", line 30, in <module>
          setup(
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 973, in run_commands
          self.run_command(cmd)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 992, in run_command
          cmd_obj.run()
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 299, in run
          self.run_command('build')
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
          self.distribution.run_command(command)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 992, in run_command
          cmd_obj.run()
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/command/build.py", line 33, in run
          super().run()
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/command/build.py", line 132, in run
          self.run_command(cmd_name)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
          self.distribution.run_command(command)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 992, in run_command
          cmd_obj.run()
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 84, in run
          _build_ext.run(self)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
          self.build_extensions()
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 396, in build_extensions
          self._check_abi()
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 767, in _check_abi
          check_compiler_abi_compatibility(compiler)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 300, in check_compiler_abi_compatibility
          if not check_compiler_ok_for_platform(compiler):
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 257, in check_compiler_ok_for_platform
          which = subprocess.check_output(['which', compiler], stderr=subprocess.STDOUT)
        File "/Users/thisas/miniforge3/lib/python3.9/subprocess.py", line 424, in check_output
          return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
        File "/Users/thisas/miniforge3/lib/python3.9/subprocess.py", line 528, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['which', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin']' returned non-zero exit status 1.
      [end of output]

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

  × Running setup.py install for torchsparse did not run successfully.
  │ exit code: 1
  ╰─> [98 lines of output]
      running install
      /Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.macosx-11.0-arm64-cpython-39
      creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse
      copying torchsparse/version.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse
      copying torchsparse/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse
      copying torchsparse/tensor.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse
      copying torchsparse/operators.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse
      creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn
      copying torchsparse/nn/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn
      creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse/utils
      copying torchsparse/utils/collate.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/utils
      copying torchsparse/utils/quantize.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/utils
      copying torchsparse/utils/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/utils
      copying torchsparse/utils/utils.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/utils
      creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/utils
      copying torchsparse/nn/utils/kernel.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/utils
      copying torchsparse/nn/utils/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/utils
      copying torchsparse/nn/utils/apply.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/utils
      creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
      copying torchsparse/nn/modules/norm.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
      copying torchsparse/nn/modules/pooling.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
      copying torchsparse/nn/modules/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
      copying torchsparse/nn/modules/crop.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
      copying torchsparse/nn/modules/activation.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
      copying torchsparse/nn/modules/bev.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
      copying torchsparse/nn/modules/conv.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
      creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      copying torchsparse/nn/functional/downsample.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      copying torchsparse/nn/functional/query.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      copying torchsparse/nn/functional/devoxelize.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      copying torchsparse/nn/functional/pooling.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      copying torchsparse/nn/functional/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      copying torchsparse/nn/functional/crop.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      copying torchsparse/nn/functional/hash.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      copying torchsparse/nn/functional/activation.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      copying torchsparse/nn/functional/conv.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      copying torchsparse/nn/functional/voxelize.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      copying torchsparse/nn/functional/count.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
      running build_ext
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-req-build-gqkg3sbj/setup.py", line 30, in <module>
          setup(
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 973, in run_commands
          self.run_command(cmd)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 992, in run_command
          cmd_obj.run()
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/command/install.py", line 68, in run
          return orig.install.run(self)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/command/install.py", line 698, in run
          self.run_command('build')
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
          self.distribution.run_command(command)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 992, in run_command
          cmd_obj.run()
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/command/build.py", line 33, in run
          super().run()
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/command/build.py", line 132, in run
          self.run_command(cmd_name)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
          self.distribution.run_command(command)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 992, in run_command
          cmd_obj.run()
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 84, in run
          _build_ext.run(self)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
          self.build_extensions()
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 396, in build_extensions
          self._check_abi()
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 767, in _check_abi
          check_compiler_abi_compatibility(compiler)
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 300, in check_compiler_abi_compatibility
          if not check_compiler_ok_for_platform(compiler):
        File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 257, in check_compiler_ok_for_platform
          which = subprocess.check_output(['which', compiler], stderr=subprocess.STDOUT)
        File "/Users/thisas/miniforge3/lib/python3.9/subprocess.py", line 424, in check_output
          return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
        File "/Users/thisas/miniforge3/lib/python3.9/subprocess.py", line 528, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['which', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin']' returned non-zero exit status 1.
      [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.
╰─> torchsparse

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

@The-Real-Thisas
Copy link
Author

Trying to run,

from torch import nn
from torchsparse import nn as spnn
import torch.utils.cpp_extension


model = nn.Sequential(
    spnn.Conv3d(in_channels, out_channels, kernel_size),
    spnn.BatchNorm(out_channels),
    spnn.ReLU(True),
)

with the conda package of conda install -c conda-forge torchsparse gives,

Traceback (most recent call last):
  File "/Users/thisas/Desktop/test.py", line 2, in <module>
    from torchsparse import nn as spnn
  File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torchsparse/nn/__init__.py", line 1, in <module>
    from .modules import *
  File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torchsparse/nn/modules/__init__.py", line 3, in <module>
    from .conv import *
  File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torchsparse/nn/modules/conv.py", line 9, in <module>
    from torchsparse.nn import functional as F
  File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torchsparse/nn/functional/__init__.py", line 2, in <module>
    from .conv import *
  File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torchsparse/nn/functional/conv.py", line 7, in <module>
    import torchsparse.backend
ImportError: dlopen(/Users/thisas/miniforge3/lib/python3.9/site-packages/torchsparse/backend.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace (__ZNK2at10TensorBase8data_ptrIlEEPT_v)```

But installs successfully. 

```log
(base)  ~/Desktop/ conda install -c conda-forge torchsparse
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /Users/thisas/miniforge3

  added / updated specs:
    - torchsparse


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    ca-certificates-2022.9.14  |       h4653dfc_0         152 KB  conda-forge
    certifi-2022.9.14          |     pyhd8ed1ab_0         156 KB  conda-forge
    conda-4.14.0               |   py39h2804cbe_0        1017 KB  conda-forge
    pytorch-1.12.1             |cpu_py39h0768760_0        38.9 MB  conda-forge
    toolz-0.12.0               |     pyhd8ed1ab_0          48 KB  conda-forge
    ------------------------------------------------------------
                                           Total:        40.2 MB

The following NEW packages will be INSTALLED:

  ninja              conda-forge/osx-arm64::ninja-1.11.0-hf86a087_0
  pytorch            conda-forge/osx-arm64::pytorch-1.12.1-cpu_py39h0768760_0
  sleef              conda-forge/osx-arm64::sleef-3.5.1-h156473d_2
  toolz              conda-forge/noarch::toolz-0.12.0-pyhd8ed1ab_0
  torchsparse        conda-forge/osx-arm64::torchsparse-1.4.0-py39h1d658c3_14_cpu
  typing_extensions  conda-forge/noarch::typing_extensions-4.3.0-pyha770c72_0

The following packages will be UPDATED:

  ca-certificates                      2022.6.15-h4653dfc_0 --> 2022.9.14-h4653dfc_0
  certifi            conda-forge/osx-arm64::certifi-2022.6~ --> conda-forge/noarch::certifi-2022.9.14-pyhd8ed1ab_0
  conda                               4.13.0-py39h2804cbe_1 --> 4.14.0-py39h2804cbe_0


Proceed ([y]/n)? y


Downloading and Extracting Packages
ca-certificates-2022 | 152 KB    | ################################################################ | 100%
pytorch-1.12.1       | 38.9 MB   | ################################################################ | 100%
conda-4.14.0         | 1017 KB   | ################################################################ | 100%
certifi-2022.9.14    | 156 KB    | ################################################################ | 100%
toolz-0.12.0         | 48 KB     | ################################################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

@zhijian-liu
Copy link
Contributor

zhijian-liu commented Oct 8, 2022

Could you please try pip install with -v to get the full error message?

@The-Real-Thisas
Copy link
Author

(base)  ~/ export CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin && pip install -v --upgrade git+https://github.com/mit-han-lab/torchsparse.git@v1.4.0
Using pip 22.1.2 from /Users/thisas/miniforge3/lib/python3.9/site-packages/pip (python 3.9)
Collecting git+https://github.com/mit-han-lab/torchsparse.git@v1.4.0
  Cloning https://github.com/mit-han-lab/torchsparse.git (to revision v1.4.0) to /private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-req-build-c80s38l1
  Running command git version
  git version 2.37.3
  Running command git clone --filter=blob:none https://github.com/mit-han-lab/torchsparse.git /private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-req-build-c80s38l1
  Cloning into '/private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-req-build-c80s38l1'...
  Updating files:  18% (16/87)
  Updating files:  19% (17/87)
  Updating files:  20% (18/87)
  Updating files:  21% (19/87)
  Updating files:  22% (20/87)
  Updating files:  24% (21/87)
  Updating files:  25% (22/87)
  Updating files:  26% (23/87)
  Updating files:  27% (24/87)
  Updating files:  28% (25/87)
  Updating files:  29% (26/87)
  Updating files:  31% (27/87)
  Updating files:  32% (28/87)
  Updating files:  33% (29/87)
  Updating files:  34% (30/87)
  Updating files:  35% (31/87)
  Updating files:  36% (32/87)
  Updating files:  37% (33/87)
  Updating files:  39% (34/87)
  Updating files:  40% (35/87)
  Updating files:  41% (36/87)
  Updating files:  42% (37/87)
  Updating files:  43% (38/87)
  Updating files:  44% (39/87)
  Updating files:  45% (40/87)
  Updating files:  47% (41/87)
  Updating files:  48% (42/87)
  Updating files:  49% (43/87)
  Updating files:  50% (44/87)
  Updating files:  51% (45/87)
  Updating files:  52% (46/87)
  Updating files:  54% (47/87)
  Updating files:  55% (48/87)
  Updating files:  56% (49/87)
  Updating files:  57% (50/87)
  Updating files:  58% (51/87)
  Updating files:  59% (52/87)
  Updating files:  60% (53/87)
  Updating files:  62% (54/87)
  Updating files:  63% (55/87)
  Updating files:  64% (56/87)
  Updating files:  65% (57/87)
  Updating files:  66% (58/87)
  Updating files:  67% (59/87)
  Updating files:  68% (60/87)
  Updating files:  70% (61/87)
  Updating files:  71% (62/87)
  Updating files:  72% (63/87)
  Updating files:  73% (64/87)
  Updating files:  74% (65/87)
  Updating files:  75% (66/87)
  Updating files:  77% (67/87)
  Updating files:  78% (68/87)
  Updating files:  79% (69/87)
  Updating files:  80% (70/87)
  Updating files:  81% (71/87)
  Updating files:  82% (72/87)
  Updating files:  83% (73/87)
  Updating files:  85% (74/87)
  Updating files:  86% (75/87)
  Updating files:  87% (76/87)
  Updating files:  88% (77/87)
  Updating files:  89% (78/87)
  Updating files:  90% (79/87)
  Updating files:  91% (80/87)
  Updating files:  93% (81/87)
  Updating files:  94% (82/87)
  Updating files:  95% (83/87)
  Updating files:  96% (84/87)
  Updating files:  97% (85/87)
  Updating files:  98% (86/87)
  Updating files: 100% (87/87)
  Updating files: 100% (87/87), done.
  Running command git show-ref v1.4.0
  74099d10a51c71c14318bce63d6421f698b24f24 refs/tags/v1.4.0
  Running command git rev-parse HEAD
  6719899f1acff9a0395ad7bdb5b82b73c39d59d4
  Running command git checkout -q 74099d10a51c71c14318bce63d6421f698b24f24
  Resolved https://github.com/mit-han-lab/torchsparse.git to commit 74099d10a51c71c14318bce63d6421f698b24f24
  Running command python setup.py egg_info
  running egg_info
  creating /private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-pip-egg-info-xoe78qdo/torchsparse.egg-info
  writing /private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-pip-egg-info-xoe78qdo/torchsparse.egg-info/PKG-INFO
  writing dependency_links to /private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-pip-egg-info-xoe78qdo/torchsparse.egg-info/dependency_links.txt
  writing top-level names to /private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-pip-egg-info-xoe78qdo/torchsparse.egg-info/top_level.txt
  writing manifest file '/private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-pip-egg-info-xoe78qdo/torchsparse.egg-info/SOURCES.txt'
  reading manifest file '/private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-pip-egg-info-xoe78qdo/torchsparse.egg-info/SOURCES.txt'
  adding license file 'LICENSE'
  writing manifest file '/private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-pip-egg-info-xoe78qdo/torchsparse.egg-info/SOURCES.txt'
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: torchsparse
  Running command git rev-parse HEAD
  74099d10a51c71c14318bce63d6421f698b24f24
  Running command python setup.py bdist_wheel
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-11.0-arm64-cpython-39
  creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse
  copying torchsparse/version.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse
  copying torchsparse/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse
  copying torchsparse/tensor.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse
  copying torchsparse/operators.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse
  creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn
  copying torchsparse/nn/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn
  creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse/utils
  copying torchsparse/utils/collate.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/utils
  copying torchsparse/utils/quantize.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/utils
  copying torchsparse/utils/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/utils
  copying torchsparse/utils/utils.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/utils
  creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/utils
  copying torchsparse/nn/utils/kernel.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/utils
  copying torchsparse/nn/utils/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/utils
  copying torchsparse/nn/utils/apply.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/utils
  creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
  copying torchsparse/nn/modules/norm.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
  copying torchsparse/nn/modules/pooling.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
  copying torchsparse/nn/modules/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
  copying torchsparse/nn/modules/crop.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
  copying torchsparse/nn/modules/activation.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
  copying torchsparse/nn/modules/bev.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
  copying torchsparse/nn/modules/conv.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
  creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  copying torchsparse/nn/functional/downsample.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  copying torchsparse/nn/functional/query.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  copying torchsparse/nn/functional/devoxelize.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  copying torchsparse/nn/functional/pooling.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  copying torchsparse/nn/functional/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  copying torchsparse/nn/functional/crop.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  copying torchsparse/nn/functional/hash.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  copying torchsparse/nn/functional/activation.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  copying torchsparse/nn/functional/conv.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  copying torchsparse/nn/functional/voxelize.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  copying torchsparse/nn/functional/count.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  running build_ext
  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "/private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-req-build-c80s38l1/setup.py", line 30, in <module>
      setup(
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/__init__.py", line 87, in setup
      return distutils.core.setup(**attrs)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup
      return run_commands(dist)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
      dist.run_commands()
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 973, in run_commands
      self.run_command(cmd)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/dist.py", line 1217, in run_command
      super().run_command(command)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 992, in run_command
      cmd_obj.run()
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 299, in run
      self.run_command('build')
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
      self.distribution.run_command(command)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/dist.py", line 1217, in run_command
      super().run_command(command)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 992, in run_command
      cmd_obj.run()
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/command/build.py", line 132, in run
      self.run_command(cmd_name)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
      self.distribution.run_command(command)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/dist.py", line 1217, in run_command
      super().run_command(command)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 992, in run_command
      cmd_obj.run()
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 84, in run
      _build_ext.run(self)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
      self.build_extensions()
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 485, in build_extensions
      compiler_name, compiler_version = self._check_abi()
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 869, in _check_abi
      _, version = get_compiler_abi_compatibility_and_version(compiler)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 336, in get_compiler_abi_compatibility_and_version
      if not check_compiler_ok_for_platform(compiler):
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 290, in check_compiler_ok_for_platform
      which = subprocess.check_output(['which', compiler], stderr=subprocess.STDOUT)
    File "/Users/thisas/miniforge3/lib/python3.9/subprocess.py", line 424, in check_output
      return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
    File "/Users/thisas/miniforge3/lib/python3.9/subprocess.py", line 528, in run
      raise CalledProcessError(retcode, process.args,
  subprocess.CalledProcessError: Command '['which', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin']' returned non-zero exit status 1.
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /Users/thisas/miniforge3/bin/python3.9 -u -c '
  exec(compile('"'"''"'"''"'"'
  # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
  #
  # - It imports setuptools before invoking setup.py, to enable projects that directly
  #   import from `distutils.core` to work with newer packaging standards.
  # - It provides a clear error message when setuptools is not installed.
  # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
  #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
  #     manifest_maker: standard file '"'"'-c'"'"' not found".
  # - It generates a shim setup.py, for handling setup.cfg-only projects.
  import os, sys, tokenize

  try:
      import setuptools
  except ImportError as error:
      print(
          "ERROR: Can not execute `setup.py` since setuptools is not available in "
          "the build environment.",
          file=sys.stderr,
      )
      sys.exit(1)

  __file__ = %r
  sys.argv[0] = __file__

  if os.path.exists(__file__):
      filename = __file__
      with tokenize.open(__file__) as f:
          setup_py_code = f.read()
  else:
      filename = "<auto-generated setuptools caller>"
      setup_py_code = "from setuptools import setup; setup()"

  exec(compile(setup_py_code, filename, "exec"))
  '"'"''"'"''"'"' % ('"'"'/private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-req-build-c80s38l1/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' bdist_wheel -d /private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-wheel-1ikqsu6a
  cwd: /private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-req-build-c80s38l1/
  Building wheel for torchsparse (setup.py) ... error
  ERROR: Failed building wheel for torchsparse
  Running setup.py clean for torchsparse
  Running command python setup.py clean
  running clean
  removing 'build/lib.macosx-11.0-arm64-cpython-39' (and everything under it)
  'build/bdist.macosx-11.0-arm64' does not exist -- can't clean it
  'build/scripts-3.9' does not exist -- can't clean it
  removing 'build'
Failed to build torchsparse
Installing collected packages: torchsparse
  Running command Running setup.py install for torchsparse
  running install
  /Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
    warnings.warn(
  running build
  running build_py
  creating build
  creating build/lib.macosx-11.0-arm64-cpython-39
  creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse
  copying torchsparse/version.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse
  copying torchsparse/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse
  copying torchsparse/tensor.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse
  copying torchsparse/operators.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse
  creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn
  copying torchsparse/nn/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn
  creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse/utils
  copying torchsparse/utils/collate.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/utils
  copying torchsparse/utils/quantize.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/utils
  copying torchsparse/utils/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/utils
  copying torchsparse/utils/utils.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/utils
  creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/utils
  copying torchsparse/nn/utils/kernel.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/utils
  copying torchsparse/nn/utils/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/utils
  copying torchsparse/nn/utils/apply.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/utils
  creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
  copying torchsparse/nn/modules/norm.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
  copying torchsparse/nn/modules/pooling.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
  copying torchsparse/nn/modules/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
  copying torchsparse/nn/modules/crop.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
  copying torchsparse/nn/modules/activation.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
  copying torchsparse/nn/modules/bev.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
  copying torchsparse/nn/modules/conv.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/modules
  creating build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  copying torchsparse/nn/functional/downsample.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  copying torchsparse/nn/functional/query.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  copying torchsparse/nn/functional/devoxelize.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  copying torchsparse/nn/functional/pooling.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  copying torchsparse/nn/functional/__init__.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  copying torchsparse/nn/functional/crop.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  copying torchsparse/nn/functional/hash.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  copying torchsparse/nn/functional/activation.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  copying torchsparse/nn/functional/conv.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  copying torchsparse/nn/functional/voxelize.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  copying torchsparse/nn/functional/count.py -> build/lib.macosx-11.0-arm64-cpython-39/torchsparse/nn/functional
  running build_ext
  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "/private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-req-build-c80s38l1/setup.py", line 30, in <module>
      setup(
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/__init__.py", line 87, in setup
      return distutils.core.setup(**attrs)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup
      return run_commands(dist)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
      dist.run_commands()
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 973, in run_commands
      self.run_command(cmd)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/dist.py", line 1217, in run_command
      super().run_command(command)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 992, in run_command
      cmd_obj.run()
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/command/install.py", line 68, in run
      return orig.install.run(self)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/command/install.py", line 698, in run
      self.run_command('build')
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
      self.distribution.run_command(command)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/dist.py", line 1217, in run_command
      super().run_command(command)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 992, in run_command
      cmd_obj.run()
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/command/build.py", line 132, in run
      self.run_command(cmd_name)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
      self.distribution.run_command(command)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/dist.py", line 1217, in run_command
      super().run_command(command)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 992, in run_command
      cmd_obj.run()
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 84, in run
      _build_ext.run(self)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
      self.build_extensions()
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 485, in build_extensions
      compiler_name, compiler_version = self._check_abi()
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 869, in _check_abi
      _, version = get_compiler_abi_compatibility_and_version(compiler)
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 336, in get_compiler_abi_compatibility_and_version
      if not check_compiler_ok_for_platform(compiler):
    File "/Users/thisas/miniforge3/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 290, in check_compiler_ok_for_platform
      which = subprocess.check_output(['which', compiler], stderr=subprocess.STDOUT)
    File "/Users/thisas/miniforge3/lib/python3.9/subprocess.py", line 424, in check_output
      return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
    File "/Users/thisas/miniforge3/lib/python3.9/subprocess.py", line 528, in run
      raise CalledProcessError(retcode, process.args,
  subprocess.CalledProcessError: Command '['which', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin']' returned non-zero exit status 1.
  error: subprocess-exited-with-error

  × Running setup.py install for torchsparse did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /Users/thisas/miniforge3/bin/python3.9 -u -c '
  exec(compile('"'"''"'"''"'"'
  # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
  #
  # - It imports setuptools before invoking setup.py, to enable projects that directly
  #   import from `distutils.core` to work with newer packaging standards.
  # - It provides a clear error message when setuptools is not installed.
  # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
  #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
  #     manifest_maker: standard file '"'"'-c'"'"' not found".
  # - It generates a shim setup.py, for handling setup.cfg-only projects.
  import os, sys, tokenize

  try:
      import setuptools
  except ImportError as error:
      print(
          "ERROR: Can not execute `setup.py` since setuptools is not available in "
          "the build environment.",
          file=sys.stderr,
      )
      sys.exit(1)

  __file__ = %r
  sys.argv[0] = __file__

  if os.path.exists(__file__):
      filename = __file__
      with tokenize.open(__file__) as f:
          setup_py_code = f.read()
  else:
      filename = "<auto-generated setuptools caller>"
      setup_py_code = "from setuptools import setup; setup()"

  exec(compile(setup_py_code, filename, "exec"))
  '"'"''"'"''"'"' % ('"'"'/private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-req-build-c80s38l1/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' install --record /private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-record-_ps4bjyr/install-record.txt --single-version-externally-managed --compile --install-headers /Users/thisas/miniforge3/include/python3.9/torchsparse
  cwd: /private/var/folders/z8/sp2w4vyj3q71z22h0hz0vxs00000gn/T/pip-req-build-c80s38l1/
  Running setup.py install for torchsparse ... error
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> torchsparse

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

@free-soellingeraj
Copy link

Did this ever get fixed?

@The-Real-Thisas
Copy link
Author

No building the latest version from source does not seem to work, conda version did build through so you can try that. https://anaconda.org/conda-forge/torchsparse

Maybe its fixed ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants