언어/Python

poetry에 tensorflow 추가하기

dig04214 2025. 4. 8. 17:51

Windows 11에서 poetry add tensorflow로 tensorflow를 peotry 환경에 추가하려고 시도하면

  - Installing tensorflow-io-gcs-filesystem (0.37.1): Failed

    | Unable to find installation candidates for tensorflow-io-gcs-filesystem (0.37.1)
    |
    | This is likely not a Poetry issue.
    |
    |   - 16 candidate(s) were identified for the package
    |   - 16 wheel(s) were skipped as your project's environment does not support the identified abi tags
    |
    | Solutions:
    | Make sure the lockfile is up-to-date. You can try one of the following;
    |
    |     1. Regenerate lockfile: poetry lock --no-cache --regenerate
    |     2. Update package     : poetry update --no-cache tensorflow-io-gcs-filesystem
    |
    | If neither works, please first check to verify that the tensorflow-io-gcs-filesystem has published wheels available from your configured source that are compatible with your environment- ie. operating system, architecture (x86_64, arm64 etc.), python interpreter.
    |
    | You can also run your poetry command with -v to see more information.

이렇게 tensorflow-io-gcs-filesystem 관련 에러가 발생한다

 

tensorflow를 pip로 설치하면 에러없이 설치되는 환경인데도, poetry에서는 tensorflow-io-gcs-filesystem 관련 에러가 발생한다.

해결책은 

https://github.com/tensorflow/tensorflow/issues/62899#issuecomment-1935052936

 

TensorFlow 2.15 cannot be imported after Poetry install on Windows · Issue #62899 · tensorflow/tensorflow

Issue type Bug Have you reproduced the bug with TensorFlow Nightly? No Source binary TensorFlow version 2.15.0 Custom code No OS platform and distribution Windows Mobile device No response Python v...

github.com

위 링크처럼 poetry add tensorflow-io-gcs-filesystem==0.31.0 로 이전버전을 추가하면 해결된다.

 

참고: python 버전 관련 에러가 발생하는 경우 requires-python 범위를 확 줄이자.(3.11버전인 경우 requires-python = ">=3.11, <3.12")