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

Can‘t install GroundingDINO #295

Open
Leestronger opened this issue Jun 7, 2023 · 16 comments
Open

Can‘t install GroundingDINO #295

Leestronger opened this issue Jun 7, 2023 · 16 comments

Comments

@Leestronger
Copy link

`Installing collected packages: groundingdino
Running setup.py develop for groundingdino
error: subprocess-exited-with-error

× python setup.py develop did not run successfully.
│ exit code: 1
╰─> [103 lines of output]
    fatal: not a git repository (or any of the parent directories): .git
    Building wheel groundingdino-0.1.0
    Compiling with CUDA
    running develop
    running egg_info
    writing groundingdino.egg-info\PKG-INFO
    writing dependency_links to groundingdino.egg-info\dependency_links.txt
    writing requirements to groundingdino.egg-info\requires.txt
    writing top-level names to groundingdino.egg-info\top_level.txt
    reading manifest file 'groundingdino.egg-info\SOURCES.txt'
    adding license file 'LICENSE'
    writing manifest file 'groundingdino.egg-info\SOURCES.txt'
    running build_ext
    building 'groundingdino._C' extension
    Emitting ninja build file D:\code\python\acupoint_detection\Grounded-Segment-Anything-main\GroundingDINO\build\temp.win-amd64-cpython-38\Release\build.ninja...
    Compiling objects...
    Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
    C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\command\develop.py:40: EasyInstallDeprecationWarning: easy_install command is deprecated.
    !!

            ********************************************************************************
            Please avoid running ``setup.py`` and ``easy_install``.
            Instead, use pypa/build, pypa/installer, pypa/build or
            other standards-based tools.

            See https://github.com/pypa/setuptools/issues/917 for details.
            ********************************************************************************

    !!
      easy_install.initialize_options(self)
    C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\_distutils\cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
    !!

            ********************************************************************************
            Please avoid running ``setup.py`` directly.
            Instead, use pypa/build, pypa/installer, pypa/build or
            other standards-based tools.

            See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
            ********************************************************************************

    !!
      self.initialize_options()
    C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\torch\utils\cpp_extension.py:346: UserWarning: Error checking compiler version for cl: [WinError 2] 系统找不到指定的文件。
      warnings.warn(f'Error checking compiler version for {compiler}: {error}')
    ninja: error: Stat(D:/code/python/acupoint_detection/Grounded-Segment-Anything-main/GroundingDINO/build/temp.win-amd64-cpython-38/Release/code/python/acupoint_detection/Grounded-Segment-Anything-main/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cpu.obj): Filename longer than 260 characters
    Traceback (most recent call last):
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\torch\utils\cpp_extension.py", line 1808, in _run_ninja_build
        subprocess.run(
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\subprocess.py", line 512, in run
        raise CalledProcessError(retcode, process.args,
    subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
      File "<string>", line 2, in <module>
      File "<pip-setuptools-caller>", line 34, in <module>
      File "D:\code\python\acupoint_detection\Grounded-Segment-Anything-main\GroundingDINO\setup.py", line 200, in <module>
        setup(
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\__init__.py", line 107, in setup
        return distutils.core.setup(**attrs)
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
        return run_commands(dist)
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
        dist.run_commands()
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
        self.run_command(cmd)
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\dist.py", line 1244, in run_command
        super().run_command(command)
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
        cmd_obj.run()
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\command\develop.py", line 34, in run
        self.install_for_development()
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\command\develop.py", line 115, in install_for_development
        self.run_command('build_ext')
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
        self.distribution.run_command(command)
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\dist.py", line 1244, in run_command
        super().run_command(command)
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
        cmd_obj.run()
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\command\build_ext.py", line 84, in run
        _build_ext.run(self)
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 345, in run
        self.build_extensions()
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\torch\utils\cpp_extension.py", line 765, in build_extensions
        build_ext.build_extensions(self)
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 467, in build_extensions
        self._build_extensions_serial()
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 493, in _build_extensions_serial
        self.build_extension(ext)
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\command\build_ext.py", line 246, in build_extension
        _build_ext.build_extension(self, ext)
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 548, in build_extension
        objects = self.compiler.compile(
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\torch\utils\cpp_extension.py", line 738, in win_wrap_ninja_compile
        _write_ninja_file_and_compile_objects(
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\torch\utils\cpp_extension.py", line 1487, in _write_ninja_file_and_compile_objects
        _run_ninja_build(
      File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\torch\utils\cpp_extension.py", line 1824, in _run_ninja_build
        raise RuntimeError(message) from e
    RuntimeError: Error compiling objects for extension
    [end of output]

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

error: subprocess-exited-with-error

× python setup.py develop did not run successfully.
│ exit code: 1
╰─> [103 lines of output]
fatal: not a git repository (or any of the parent directories): .git
Building wheel groundingdino-0.1.0
Compiling with CUDA
running develop
running egg_info
writing groundingdino.egg-info\PKG-INFO
writing dependency_links to groundingdino.egg-info\dependency_links.txt
writing requirements to groundingdino.egg-info\requires.txt
writing top-level names to groundingdino.egg-info\top_level.txt
reading manifest file 'groundingdino.egg-info\SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'groundingdino.egg-info\SOURCES.txt'
running build_ext
building 'groundingdino._C' extension
Emitting ninja build file D:\code\python\acupoint_detection\Grounded-Segment-Anything-main\GroundingDINO\build\temp.win-amd64-cpython-38\Release\build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\command\develop.py:40: EasyInstallDeprecationWarning: easy_install command is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` and ``easy_install``.
        Instead, use pypa/build, pypa/installer, pypa/build or
        other standards-based tools.

        See https://github.com/pypa/setuptools/issues/917 for details.
        ********************************************************************************

!!
  easy_install.initialize_options(self)
C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\_distutils\cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer, pypa/build or
        other standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
  self.initialize_options()
C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\torch\utils\cpp_extension.py:346: UserWarning: Error checking compiler version for cl: [WinError 2] 系统找不到指定的文件。
  warnings.warn(f'Error checking compiler version for {compiler}: {error}')
ninja: error: Stat(D:/code/python/acupoint_detection/Grounded-Segment-Anything-main/GroundingDINO/build/temp.win-amd64-cpython-38/Release/code/python/acupoint_detection/Grounded-Segment-Anything-main/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cpu.obj): Filename longer than 260 characters
Traceback (most recent call last):
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\torch\utils\cpp_extension.py", line 1808, in _run_ninja_build
    subprocess.run(
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "<pip-setuptools-caller>", line 34, in <module>
  File "D:\code\python\acupoint_detection\Grounded-Segment-Anything-main\GroundingDINO\setup.py", line 200, in <module>
    setup(
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\__init__.py", line 107, in setup
    return distutils.core.setup(**attrs)
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
    return run_commands(dist)
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
    dist.run_commands()
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
    self.run_command(cmd)
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\dist.py", line 1244, in run_command
    super().run_command(command)
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
    cmd_obj.run()
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\command\develop.py", line 34, in run
    self.install_for_development()
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\command\develop.py", line 115, in install_for_development
    self.run_command('build_ext')
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
    self.distribution.run_command(command)
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\dist.py", line 1244, in run_command
    super().run_command(command)
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
    cmd_obj.run()
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\command\build_ext.py", line 84, in run
    _build_ext.run(self)
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 345, in run
    self.build_extensions()
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\torch\utils\cpp_extension.py", line 765, in build_extensions
    build_ext.build_extensions(self)
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 467, in build_extensions
    self._build_extensions_serial()
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 493, in _build_extensions_serial
    self.build_extension(ext)
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\command\build_ext.py", line 246, in build_extension
    _build_ext.build_extension(self, ext)
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 548, in build_extension
    objects = self.compiler.compile(
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\torch\utils\cpp_extension.py", line 738, in win_wrap_ninja_compile
    _write_ninja_file_and_compile_objects(
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\torch\utils\cpp_extension.py", line 1487, in _write_ninja_file_and_compile_objects
    _run_ninja_build(
  File "C:\Users\lynnd\Anaconda3\envs\ground_seg\lib\site-packages\torch\utils\cpp_extension.py", line 1824, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.`

@lilyuam
Copy link

lilyuam commented Jun 7, 2023

Try running this:

which c++
export CXX=g++

@Leestronger
Copy link
Author

Leestronger commented Jun 8, 2023

i use windows and my c++ is
(ground_seg) PS D:\code\python\acupoint_detection\Grounded-Segment-Anything-main> which c++ /c/msys64/ucrt64/bin/c++

@LiaoZihZrong
Copy link

try to use C++9 and G++9

@jdiazram
Copy link

jdiazram commented Jun 8, 2023

I have the same problem...were you able to solve this problem? I am using Ubuntu 22.04

@Leestronger
Copy link
Author

try to use C++9 and G++9

(ground_seg) PS D:\code\python\acupoint_detection\Grounded-Segment-Anything-main> g++ -v
Using built-in specs.
COLLECT_GCC=C:\msys64\ucrt64\bin\g++.exe
COLLECT_LTO_WRAPPER=C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-13.1.0/configure --prefix=/ucrt64 --with-local-prefix=/ucrt64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/ucrt64/include --libexecdir=/ucrt64/lib --enable-bootstrap --enable-checking=release --with-arch=nocona --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts --enable-libstdcxx-time --disable-libstdcxx-pch --enable-lto --enable-libgomp --disable-libssp --disable-multilib --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/ucrt64 --with-mpfr=/ucrt64 --with-mpc=/ucrt64 --with-isl=/ucrt64 --with-pkgversion='Rev5, Built by MSYS2 project' --with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as --with-gnu-ld --disable-libstdcxx-debug --with-boot-ldflags=-static-libstdc++ --with-stage1-ldflags=-static-libstdc++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.1.0 (Rev5, Built by MSYS2 project)

It seem that my g++ version is higher than G++9

@Leestronger
Copy link
Author

I have the same problem...were you able to solve this problem? I am using Ubuntu 22.04

I meet this question in windows,and I try it again in ubuntu 22.04,this bug doesn't appear again,but when I run python grounded_sam_demo.py I meet new bug:
‘’‘
/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/torch/functional.py:478: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:2894.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
final text_encoder_type: bert-base-uncased
('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
Traceback (most recent call last):
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/urllib3/connectionpool.py", line 714, in urlopen
httplib_response = self._make_request(
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/urllib3/connectionpool.py", line 403, in _make_request
self._validate_conn(conn)
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1053, in validate_conn
conn.connect()
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/urllib3/connection.py", line 419, in connect
self.sock = ssl_wrap_socket(
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/urllib3/util/ssl
.py", line 449, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/urllib3/util/ssl
.py", line 493, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "/home/lia/anaconda3/envs/sam/lib/python3.8/ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "/home/lia/anaconda3/envs/sam/lib/python3.8/ssl.py", line 1040, in _create
self.do_handshake()
File "/home/lia/anaconda3/envs/sam/lib/python3.8/ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/urllib3/connectionpool.py", line 798, in urlopen
retries = retries.increment(
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/urllib3/util/retry.py", line 550, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/urllib3/packages/six.py", line 769, in reraise
raise value.with_traceback(tb)
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/urllib3/connectionpool.py", line 714, in urlopen
httplib_response = self._make_request(
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/urllib3/connectionpool.py", line 403, in _make_request
self._validate_conn(conn)
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1053, in validate_conn
conn.connect()
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/urllib3/connection.py", line 419, in connect
self.sock = ssl_wrap_socket(
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/urllib3/util/ssl
.py", line 449, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/urllib3/util/ssl
.py", line 493, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "/home/lia/anaconda3/envs/sam/lib/python3.8/ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "/home/lia/anaconda3/envs/sam/lib/python3.8/ssl.py", line 1040, in _create
self.do_handshake()
File "/home/lia/anaconda3/envs/sam/lib/python3.8/ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/transformers/modeling_utils.py", line 1329, in from_pretrained
resolved_archive_file = cached_path(
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/transformers/file_utils.py", line 1776, in cached_path
output_path = get_from_cache(
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/transformers/file_utils.py", line 2040, in get_from_cache
http_get(url_to_download, temp_file, proxies=proxies, resume_size=resume_size, headers=headers)
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/transformers/file_utils.py", line 1886, in http_get
r = requests.get(url, stream=True, proxies=proxies, headers=headers)
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params, **kwargs)
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/requests/adapters.py", line 501, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "grounded_sam_demo.py", line 169, in
model = load_model(config_file, grounded_checkpoint, device=device)
File "grounded_sam_demo.py", line 42, in load_model
model = build_model(args)
File "/home/lia/projects/Grounded-Segment-Anything-main/GroundingDINO/groundingdino/models/init.py", line 17, in build_model
model = build_func(args)
File "/home/lia/projects/Grounded-Segment-Anything-main/GroundingDINO/groundingdino/models/GroundingDINO/groundingdino.py", line 372, in build_groundingdino
model = GroundingDINO(
File "/home/lia/projects/Grounded-Segment-Anything-main/GroundingDINO/groundingdino/models/GroundingDINO/groundingdino.py", line 108, in init
self.bert = get_tokenlizer.get_pretrained_language_model(text_encoder_type)
File "/home/lia/projects/Grounded-Segment-Anything-main/GroundingDINO/groundingdino/util/get_tokenlizer.py", line 23, in get_pretrained_language_model
return BertModel.from_pretrained(text_encoder_type)
File "/home/lia/anaconda3/envs/sam/lib/python3.8/site-packages/transformers/modeling_utils.py", line 1351, in from_pretrained
raise EnvironmentError(msg)
OSError: Can't load weights for 'bert-base-uncased'. Make sure that:

  • 'bert-base-uncased' is a correct model identifier listed on 'https://huggingface.co/models'
    (make sure 'bert-base-uncased' is not a path to a local directory with something else, in that case)

  • or 'bert-base-uncased' is the correct path to a directory containing a file named one of pytorch_model.bin, tf_model.h5, model.ckpt
    ‘’‘

@LiaoZihZrong
Copy link

try to use C++9 and G++9

(ground_seg) PS D:\code\python\acupoint_detection\Grounded-Segment-Anything-main> g++ -v
Using built-in specs.
COLLECT_GCC=C:\msys64\ucrt64\bin\g++.exe
COLLECT_LTO_WRAPPER=C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-13.1.0/configure --prefix=/ucrt64 --with-local-prefix=/ucrt64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/ucrt64/include --libexecdir=/ucrt64/lib --enable-bootstrap --enable-checking=release --with-arch=nocona --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts --enable-libstdcxx-time --disable-libstdcxx-pch --enable-lto --enable-libgomp --disable-libssp --disable-multilib --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/ucrt64 --with-mpfr=/ucrt64 --with-mpc=/ucrt64 --with-isl=/ucrt64 --with-pkgversion='Rev5, Built by MSYS2 project' --with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as --with-gnu-ld --disable-libstdcxx-debug --with-boot-ldflags=-static-libstdc++ --with-stage1-ldflags=-static-libstdc++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.1.0 (Rev5, Built by MSYS2 project)

It seem that my g++ version is higher than G++9

use 9.4.0, must 9.4.0

@superyoman
Copy link

请问如何解决

@yiningsutd
Copy link

Hey, I met this issue but fixed it successfully.
Here are some steps I tried that may help:

  1. the previous g++ version is 11.4.0, I re-install the required version 9.4.0;
  2. export correct path export CUDA_HOME=/path/to/cuda-11.3/ follow README.md, and check torch and cuda versions are matched;
  3. pip install --no-build-isolation -e GroundingDINO

@Zhangzhixiang-laugh
Copy link

Hey, I met this issue but fixed it successfully. Here are some steps I tried that may help:

  1. the previous g++ version is 11.4.0, I re-install the required version 9.4.0;
  2. export correct path export CUDA_HOME=/path/to/cuda-11.3/ follow README.md, and check torch and cuda versions are matched;
  3. pip install --no-build-isolation -e GroundingDINO

How to install the required version 9.4.0, I can't get this version, but only the version 9.5. And it seems not working.

@Cadodo97
Copy link

i use windows and my c++ is (ground_seg) PS D:\code\python\acupoint_detection\Grounded-Segment-Anything-main> which c++ /c/msys64/ucrt64/bin/c++

Hi @Leestronger I have your same problem, but if I run which c++, I get:
"which" is not recognized as an internal or external command, an executable program or a batch file.

  1. Any suggestion?
  2. Which are your torch, CUDA and Visual Studio version? @yiningsutd @Zhangzhixiang-laugh

@Zhangzhixiang-laugh
Copy link

Zhangzhixiang-laugh commented Nov 3, 2024

i use windows and my c++ is (ground_seg) PS D:\code\python\acupoint_detection\Grounded-Segment-Anything-main> which c++ /c/msys64/ucrt64/bin/c++

Hi @Leestronger I have your same problem, but if I run which c++, I get: "which" is not recognized as an internal or external command, an executable program or a batch file.

  1. Any suggestion?
  2. Which are your torch, CUDA and Visual Studio version? @yiningsutd @Zhangzhixiang-laugh

windows 10, wsl2:
torch=2.3.1
cuda=12.1
cudnn=8.9
g++=9.4.0
gcc=9.4.0
This configuration might work well even with higher versions of g++ and gcc (e.g. 11.x), and that may be also appropriate for you.

@Cadodo97
Copy link

Cadodo97 commented Nov 3, 2024

@Zhangzhixiang-laugh thanks for your answer, I'm working on windows 11.
Do you think is mandatory cudnn to run Grounded-Segment-Anything?

@Zhangzhixiang-laugh
Copy link

Zhangzhixiang-laugh commented Nov 5, 2024

@Zhangzhixiang-laugh thanks for your answer, I'm working on windows 11. Do you think is mandatory cudnn to run Grounded-Segment-Anything?

I don't remember the exact relationship, but it looks like it will involve cuda-level operations. wsl2 will fit you.

@shoutOutYangJie
Copy link

G++的版本调整为9.4.0就能安装成功了

@juxingyiwan
Copy link

conda安装9.3.0的gcc也可以

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

11 participants