본문 바로가기
Tools

[intellij] python 프로젝트 생성 시 AttributeError: module 'virtualenv.create.via_global_ref.builtin.cpython.mac_os' has no attribute 'CPython2macOsArmFramework' 오류

by hs_seo 2024. 2. 7.

갑자기 인텔리 j 에서 파이썬 프로젝트를 생성할 때 venv 를 선택하면 다음과 같은 오류가 발생하였습니다.

 

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/logan/Library/Application Support/JetBrains/IntelliJIdea2023.3/plugins/python/helpers/virtualenv-20.24.5.pyz/__main__.py", line 163, in <module>
  File "/Users/logan/Library/Application Support/JetBrains/IntelliJIdea2023.3/plugins/python/helpers/virtualenv-20.24.5.pyz/__main__.py", line 159, in run
  File "/Users/logan/Library/Application Support/JetBrains/IntelliJIdea2023.3/plugins/python/helpers/virtualenv-20.24.5.pyz/virtualenv/__main__.py", line 18, in run
  File "/Users/logan/Library/Application Support/JetBrains/IntelliJIdea2023.3/plugins/python/helpers/virtualenv-20.24.5.pyz/virtualenv/run/__init__.py", line 31, in cli_run
  File "/Users/logan/Library/Application Support/JetBrains/IntelliJIdea2023.3/plugins/python/helpers/virtualenv-20.24.5.pyz/virtualenv/run/__init__.py", line 49, in session_via_cli
  File "/Users/logan/Library/Application Support/JetBrains/IntelliJIdea2023.3/plugins/python/helpers/virtualenv-20.24.5.pyz/virtualenv/run/__init__.py", line 82, in build_parser
  File "/Users/logan/Library/Application Support/JetBrains/IntelliJIdea2023.3/plugins/python/helpers/virtualenv-20.24.5.pyz/virtualenv/run/plugin/creators.py", line 24, in __init__
  File "/Users/logan/Library/Application Support/JetBrains/IntelliJIdea2023.3/plugins/python/helpers/virtualenv-20.24.5.pyz/virtualenv/run/plugin/creators.py", line 31, in for_interpreter
  File "/Users/logan/Library/Application Support/JetBrains/IntelliJIdea2023.3/plugins/python/helpers/virtualenv-20.24.5.pyz/virtualenv/run/plugin/base.py", line 45, in options
  File "/Users/logan/Library/Application Support/JetBrains/IntelliJIdea2023.3/plugins/python/helpers/virtualenv-20.24.5.pyz/virtualenv/run/plugin/base.py", line 24, in entry_points_for
  File "/Users/logan/Library/Application Support/JetBrains/IntelliJIdea2023.3/plugins/python/helpers/virtualenv-20.24.5.pyz/virtualenv/run/plugin/base.py", line 24, in <genexpr>
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/metadata.py", line 79, in load
    return functools.reduce(getattr, attrs, module)
AttributeError: module 'virtualenv.create.via_global_ref.builtin.cpython.mac_os' has no attribute 'CPython2macOsArmFramework'

 

비슷한 오류가 지라 이슈로 등록되어 있는 것으로 봐서 버그인 것으로 보입니다.

 

https://youtrack.jetbrains.com/issue/PY-63116/Cannot-create-virtual-environment-from-Python-3.8-if-virtualenv20.24.5-is-installed

 

Cannot create virtual environment from Python 3.8 if `virtualenv>=20.24.5` is installed : PY-63116

Probably caused by https://github.com/pypa/virtualenv/pull/2640 1. Create a 3.8 virtual environment (tested with 3.8.18) 2. Install "virtualenvᐳ=20.24.5" 3. Try to create a virtual environment using the environment from step 1 as a base (bad practice but

youtrack.jetbrains.com

 

해결 방법

인텔리 j에서 사용하는 venv 파일에 오류가 있어서 그런것으로 인텔리 j가 사용하는 virtualenv-20.24.5.pyz 파일을 교체 해주면 됩니다.

오류가 발생하는 위치((/Users/logan/Library/Application Support/JetBrains/IntelliJIdea2023.3/plugins/python/helpers/)로 가면 virtualenv 파일이 2개 있는데 저는 20.13.0 버전 파일을 20.24.5 버전으로 교체해주니 잘 동작하였습니다.

 

 

20.24.5버전 파일을 삭제하고, 20.13.0 버전파일의 이름을 20.24.5로 변경해 주었습니다.

반응형