Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 251
godhar Avatar asked Sep 13 '25 17:09

godhar


1 Answers

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.

like image 99
Ravi Ojha Avatar answered Sep 16 '25 01:09

Ravi Ojha