[Python] chromadb 패키지 설치 테스트 및 오류 해결 방법




Python 환경에서 Chroma DB를 테스트하기 위하여 Python 패키지 설치를 진행한 내용 및 발생한 오류를 정리 합니다.


결론

Python 버전은 무조건 3.10 버전에서 하셔야 합니다.

Python 3.10 버전에서 처음부터 진행하시면 아래 오류 Case는 발생하지 않을 것입니다.

https://docs.trychroma.com/troubleshooting#sqlite


테스트 환경

  • Windows 10
  • Python 3.8 (실패)
  • Python 3.12 (실패)
  • Python 3.10 (성공)

설치 방법

pip install chromadb

설치 및 사용 시, 오류 Case

Case 1) RuntimeError: Your system has an unsupported version of sqlite3. 오류

  • chromadb 패키지 설치 (Python 3.8)
pip install chromadb

chromadb 패키지 설치에는 이슈 없음

  • 테스트 코드
import chromadb

chroma_client = chromadb.Client()
  • 테스트 코드 실행 시, 오류 발생
RuntimeError: Your system has an unsupported version of sqlite3. Chroma requires sqlite3 >= 3.35.0.
Please visit https://docs.trychroma.com/troubleshooting#sqlite to learn how to upgrade.
  • https://docs.trychroma.com/troubleshooting 사이트에서 오류 확인

해결 방법

Python 3.10 버전에서 설치해야 합니다.


Case 2) error: subprocess-exited-with-error 에러

  • chromadb 패키지 설치 (Python 3.12)
pip install chromadb
  • 패키지 설치 시, 오류 발생
...
error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ?─> [30 lines of output]
      Traceback (most recent call last):
        File "D:\python_test_anaconda\new_firewall_mgmt_qa\venv_312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "D:\python_test_anaconda\new_firewall_mgmt_qa\venv_312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "D:\python_test_anaconda\new_firewall_mgmt_qa\venv_312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\7040_64bit\AppData\Local\Temp\pip-build-env-h91i3ok5\overlay\Lib\site-packages\setuptools\build_meta.py", line 355, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\7040_64bit\AppData\Local\Temp\pip-build-env-h91i3ok5\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in _get_build_requires
          self.run_setup()
        File "C:\Users\7040_64bit\AppData\Local\Temp\pip-build-env-h91i3ok5\overlay\Lib\site-packages\setuptools\build_meta.py", line 507, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "C:\Users\7040_64bit\AppData\Local\Temp\pip-build-env-h91i3ok5\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 90, in <module>
        File "C:\Users\7040_64bit\AppData\Local\Temp\pip-install-l7_69h25\zstandard_cd5b5a3f02a54e2ca4473fd6c9cd074f\setup_zstd.py", line 66, in get_c_extension
          compiler.initialize()
        File "C:\Users\7040_64bit\AppData\Local\Temp\pip-build-env-h91i3ok5\overlay\Lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 253, in initialize
          vc_env = _get_vc_env(plat_spec)
                   ^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\7040_64bit\AppData\Local\Temp\pip-build-env-h91i3ok5\overlay\Lib\site-packages\setuptools\msvc.py", line 233, in msvc14_get_vc_env
          return _msvc14_get_vc_env(plat_spec)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\7040_64bit\AppData\Local\Temp\pip-build-env-h91i3ok5\overlay\Lib\site-packages\setuptools\msvc.py", line 190, in _msvc14_get_vc_env
          raise distutils.errors.DistutilsPlatformError("Unable to find vcvarsall.bat")
      distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

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

× Getting requirements to build 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.
...

해결 방법

에러 메시지에 나온 것과 같이 Microsoft C++ Build Tool을 설치 합니다.

distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

Microsoft C++ Build Tools 다운로드

  • Microsoft C++ Build Tools 다운로드

Microsoft C++ Build Tools 실행 및 설치

  • C++를 사용한 데스크톱 개발 체크 및 설치 진행
  • PC 재부팅이 필요

Case 3) ERROR: Cannot install … chromadb==x.x.x … because these package versions have conflicting dependencies. 오류

Collecting chromadb
  Using cached chromadb-0.1.0-py3-none-any.whl (34 kB)
ERROR: Cannot install chromadb==0.1.0, chromadb==0.2.0, chromadb==0.3.0, chromadb==0.3.1, chromadb==0.3.2, chromadb==0.3.25, chromadb==0.3.26, chromadb==0.3.27, chromadb==0.3.29, chromadb==0.4.0, chromadb==0.4.1, chromadb==0.4.10, chromadb==0.4.11, chromadb==0.4.12, chromadb==0.4.13, chromadb==0.4.14, chromadb==0.4.2, chromadb==0.4.3, chromadb==0.4.4, chromadb==0.4.5, chromadb==0.4.6, 
chromadb==0.4.7, chromadb==0.4.8 and chromadb==0.4.9 because these package versions have conflicting dependencies.

The conflict is caused by:
    chromadb 0.4.14 depends on pulsar-client>=3.1.0
    chromadb 0.4.13 depends on pulsar-client>=3.1.0
    chromadb 0.4.12 depends on pulsar-client>=3.1.0
    chromadb 0.4.11 depends on pulsar-client>=3.1.0
    chromadb 0.4.10 depends on pulsar-client>=3.1.0
    chromadb 0.4.9 depends on pulsar-client>=3.1.0
    chromadb 0.4.8 depends on pulsar-client>=3.1.0
    chromadb 0.4.7 depends on pulsar-client>=3.1.0
    chromadb 0.4.6 depends on pulsar-client>=3.1.0
    chromadb 0.4.5 depends on pulsar-client>=3.1.0
    chromadb 0.4.4 depends on pulsar-client>=3.1.0
    chromadb 0.4.3 depends on pulsar-client>=3.1.0
    chromadb 0.4.2 depends on pulsar-client>=3.1.0
    chromadb 0.4.1 depends on pulsar-client>=3.1.0
    chromadb 0.4.0 depends on pulsar-client>=3.1.0
    chromadb 0.3.29 depends on pulsar-client>=3.1.0
    chromadb 0.3.27 depends on pulsar-client>=3.1.0
    chromadb 0.3.26 depends on pulsar-client>=3.1.0
    chromadb 0.3.25 depends on onnxruntime>=1.14.1
    chromadb 0.3.2 depends on numpy~=1.21.6
    chromadb 0.3.1 depends on numpy~=1.21.6
    chromadb 0.3.0 depends on numpy~=1.21.6
    chromadb 0.2.0 depends on numpy~=1.21.6
    chromadb 0.1.0 depends on numpy~=1.21.6

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

해결 방법

Python 3.10 버전에서 설치해야 합니다.


마치며

결론적으로 가이드 문서(https://docs.trychroma.com/troubleshooting)를 잘 확인해야 했고 Python은 3.10 버전에서만 정상 동작하는 것으로 확인됩니다.


참고 문서

https://github.com/chroma-core/chroma/issues/163





1 thought on “[Python] chromadb 패키지 설치 테스트 및 오류 해결 방법”

Leave a Comment