module 'virtualenv.create.via_global_ref.builtin.cpython.mac_os' has no attribute 'CPython2macOsArmFramework

Viewed 444

I am trying to install python packages to a venv using poetry - on BigSur macos.

I have pyenv on stable python.

pyenv which python
/Users/josh/.pyenv/versions/3.8.6/bin/python

When I exec.

poetry shell && poetry install

I get this error but do not know what to do with it.

  AttributeError

  module 'virtualenv.create.via_global_ref.builtin.cpython.mac_os' has no attribute 
'CPython2macOsArmFramework'

  at ~/.pyenv/versions/3.8.2/lib/python3.8/importlib/metadata.py:79 in load
       75│         """
       76│         match = self.pattern.match(self.value)
       77│         module = import_module(match.group('module'))
       78│         attrs = filter(None, (match.group('attr') or '').split('.'))
       79│         return functools.reduce(getattr, attrs, module)
       80│ 
       81│     @property
       82│     def extras(self):
       83│         match = self.pattern.match(self.value)

Any ideas of what to troubleshoot welcome!

1 Answers

I faced this issue after upgrading python from 3.9.5 to 3.9.12

I resolved it by switching from the online installer, which is deprecated, to installing through pip

Before:

export POETRY_VERSION=1.1.4
curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python

After:

export POETRY_VERSION=1.1.4
pip install "poetry==$POETRY_VERSION"
Related