7

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!

godhar
  • 1,128
  • 1
  • 14
  • 34

2 Answers2

3

I got this error today. I'm on Ubuntu, python 3.8.10 (pyenv managed). So seeing an error with mac_os in the message felt weird. On further debugging, found that the reason behind the issue was that some other package had installed virtualenv as a dependency in my local venv. We need to get rid of it.

And the culprit package was pre-commit. Uninstalled it from local venv for now. Installing rest of the packages works without any error.

Ravi Ojha
  • 722
  • 1
  • 6
  • 15
-1

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"