title: Keyring apparently not installed correctly with pip macos
body: <p>I want to use the Python package keyring to avoid exposing passwords in my Python scripts. According to what I've read, all you need to do is pip install keyring and then start storing and retrieving credentials. I've done this on both my Mac laptop (Big Sur) and a CentOS 7 box. On my Mac, pip list shows that version 23.1.0 of keyring is installed, and the command line utility is available. However, when I try to set a password using the command line or in python using keyring.set_password(...) I get the following error:</p>
  <p>File &quot;/lib/python3.7/site-packages/keyring/backends/macOS/<strong>init</strong>.py&quot;, line 38, in set_password
  api.set_generic_password(self.keychain, service, username, password)
  NameError: name 'api' is not defined</p>
  <p>Line 12 of the <strong>init</strong>.py is a simple import of the api module:</p>
  <pre><code>    from . import api
  </code></pre>
  <p>and then line 38, where the error is reported, tries to set the password:</p>
  <pre><code>    api.set_generic_password(self.keychain, service, username, password)
  </code></pre>
  <p>Why am I getting this error? I read somewhere that you shouldn't install keyring in a venv with pip but I'm not certain why not. Any help is appreciated.</p>