Recently, my certbot installation through pip/virtualenv has stopped working. It claims to not be able to find a specific module, even though pip can see the module in question. Is there a way that I can force the package to "see" the module in a directory it doesn't necessarily expect?
I'm in a unique situation with a shared hosting environment, so I don't really have the ability to edit system files, or install new system packages. This means I cannot use the recommended methods to install certbot, due to lack of permissions. For years, in this same environment, I have successfully used the pip-installed certbot to generate certificates for my services. Recently, for some unknown reason, it stopped working.
Here is the error message, run in the virtualenv that certbot was installed to:
$ source ~/virtualenv3/bin/activate
(virtualenv3) $ certbot
Traceback (most recent call last):
File "/home/USERNAME/virtualenv3/bin/certbot", line 5, in <module>
from certbot.main import main
File "/home/USERNAME/virtualenv3/lib/python3.7/site-packages/certbot/main.py", line 2, in <module>
from certbot._internal import main as internal_main
File "/home/USERNAME/virtualenv3/lib/python3.7/site-packages/certbot/_internal/main.py", line 11, in <module>
import zope.component
File "/home/USERNAME/virtualenv3/lib/python3.7/site-packages/zope/component/__init__.py", line 25, in <module>
from zope.interface import Interface
ModuleNotFoundError: No module named 'zope.interface'
But, the thing is, the module in question already exists. It's just in a system directory.
(virtualenv3) $ pip install zope.interface
Requirement already satisfied: zope.interface in /usr/lib/python3.7/site-packages (5.1.0)
Requirement already satisfied: setuptools in ./virtualenv3/lib/python3.7/site-packages (from zope.interface) (49.1.0)
(virtualenv3) $ pip list zope.interface
zope.interface 5.1.0
(virtualenv3) $ pip show zope.interface
Name: zope.interface
Version: 5.1.0
Summary: Interfaces for Python
Home-page: https://github.com/zopefoundation/zope.interface
Author: Zope Foundation and Contributors
Author-email: zope-dev@zope.org
License: ZPL 2.1
Location: /usr/lib/python3.7/site-packages
Requires: setuptools
Required-by: zope.proxy, zope.component, certbot
There is what seems to be a similar problem reported officially for certbot, but it's not exactly the same issue, and since the package is actually on the server, I felt like this was probably a personal problem rather than the same. I tried some of the recommended fixes:
pip install pip -U
pip install virtualenv -U
pip install zope.interface -U
pip install certbot -U
Didn't help. So, I can't install the package in pip, because it says it's already satisfied. But the certbot package itself can't see it. How do I tell the package where the zope.interface module is actually located?