KeyError: 'No metadata except PKG-INFO is available'


I’m encountering below error when installing using certbot-auto on Amazon Linux for Nginx. Previously I was able to install on another instance without this error. Anyone has an idea on this?

#./certbot-auto --nginx
Error: couldn't get currently installed version for /opt/ 
An unexpected error occurred:
KeyError: 'No metadata except PKG-INFO is available'
Please see the logfile '/tmp/tmpJEWQLs' for more details.

# more /tmp/tmpJEWQLs
2018-07-31 08:46:19,613:DEBUG:certbot.log:Exiting abnormally:
Traceback (most recent call last):
  File "/opt/", line 11, in <module>
  File "/opt/", line 1338, in main
    plugins = plugins_disco.PluginsRegistry.find_all()
  File "/opt/", line 206, in find_all
    plugin_ep = PluginEntryPoint(entry_point)
  File "/opt/", line 52, in __init__
    self.plugin_cls = entry_point.load()
  File "/opt/", line 2320, in load
    self.require(*args, **kwargs)
  File "/opt/", line 2343, in require
    items = working_set.resolve(reqs, env, installer, extras=self.extras)
  File "/opt/", line 785, in resolve
    new_requirements = dist.requires(req.extras)[::-1]
  File "/opt/", line 2610, in requires
    dm = self._dep_map
  File "/opt/", line 2874, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "/opt/", line 2883, in _compute_dependencies
    for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
  File "/opt/", line 2865, in _parsed_pkg_info
    metadata = self.get_metadata(self.PKG_INFO)
  File "/opt/", line 1791, in get_metadata
    raise KeyError("No metadata except PKG-INFO is available")
KeyError: 'No metadata except PKG-INFO is available'
2018-07-31 08:46:19,613:ERROR:certbot.log:An unexpected error occurred:

I was getting the same issues with an Amazon Linux instance that was orginaly setup with cert-bot and worked fine. I tried to fix some other issues by follwing another post and this is the result I came too

In the end I had to do the following

rm -rf /opt/*

It will probably fail on this one but setups a clean virtual enviroment
./certbot-auto --debug

cd /opt/

mv site-packages site-packages.sav

ln -s dist-packages/ site-packages

Your now ready to run certbot-auto again

./certbot-auto --debug

Wow this works well. Thanks a lot!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.