No module named 'captcha' after Upgrade to 7.1.x

Hi, after upgrading my seafile I got the following error when starting seahub:

Traceback (most recent call last):                                                                                                                              
  File "/opt/seafile/seafile-server-7.1.5/seahub/manage.py", line 10, in <module>                                                                               
    execute_from_command_line(sys.argv)                                                                                                                         
  File "/opt/seafile/seafile-server-7.1.5/seahub/thirdpart/django/core/management/__init__.py", line 364, in execute_from_command_line 
    utility.execute() 
  File "/opt/seafile/seafile-server-7.1.5/seahub/thirdpart/django/core/management/__init__.py", line 338, in execute                                            
    django.setup()                                                                                                                                              
  File "/opt/seafile/seafile-server-7.1.5/seahub/thirdpart/django/__init__.py", line 27, in setup                                                               
    apps.populate(settings.INSTALLED_APPS)                                                                                                                      
  File "/opt/seafile/seafile-server-7.1.5/seahub/thirdpart/django/apps/registry.py", line 85, in populate                                                       
    app_config = AppConfig.create(entry)                                                                                                                        
  File "/opt/seafile/seafile-server-7.1.5/seahub/thirdpart/django/apps/config.py", line 94, in create                                                           
    module = import_module(entry)                                                                                                                               
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module                                                                                   
    return _bootstrap._gcd_import(name[level:], package, level)                                                                                                 
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import                                                                                               
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load                                                                                             
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked                                                                                    
ModuleNotFoundError: No module named 'captcha' 

When I check my python3 installed modules, captcha is in the list of installed modules so I dont understand why this module is not found here.

My List of Modules:

Package                Version
---------------------- ---------------
acme                   1.6.0
aggdraw                1.3.12
asgiref                3.3.1
asn1crypto             1.4.0
attrs                  20.3.0
captcha                0.3
certbot                1.7.0
certbot-apache         1.6.0
certifi                2020.4.5.1
chardet                3.0.4
command-not-found      0.3
ConfigArgParse         0.13.0
configobj              5.0.6
cryptography           3.0
cycler                 0.10.0
dbus-python            1.2.16
decorator              4.4.2
distro                 1.5.0
distro-info            0.23ubuntu1
Django                 3.1.6
django-pylibmc         0.6.1
django-ranged-response 0.2.0
django-recaptcha       2.0.6
django-simple-captcha  0.5.13
docopt                 0.6.2
future                 0.18.2
idna                   2.10
imageio                2.9.0
iotop                  0.6
Jinja2                 2.11.3
josepy                 1.2.0
kiwisolver             1.3.1
language-selector      0.1
MarkupSafe             1.1.1
matplotlib             3.3.4
mock                   4.0.2
netifaces              0.10.4
networkx               2.5
numpy                  1.20.0
parsedatetime          2.4
pbr                    5.4.5
Pillow                 8.1.0
pip                    20.1.1
psd-tools              1.9.17
pyasn1                 0.4.8
PyGObject              3.38.0
pylibmc                1.6.1
pymacaroons            0.13.0
PyNaCl                 1.4.0
pyOpenSSL              19.1.0
pyparsing              2.4.7
pyRFC3339              1.1
python-apt             2.1.3+ubuntu1.3
python-augeas          0.5.0
python-dateutil        2.8.1
python3-ldap           0.9.8.4
pytz                   2020.1
PyWavelets             1.1.1
PyYAML                 5.3.1
requests               2.23.0
requests-toolbelt      0.8.0
requests-unixsocket    0.2.0
scikit-image           0.18.1
scipy                  1.6.0
setuptools             53.0.0
six                    1.15.0
SQLAlchemy             1.3.23
sqlparse               0.4.1
ssh-import-id          5.10
tifffile               2021.2.1
ubuntu-advantage-tools 24.4
ufw                    0.36
unattended-upgrades    0.1
urllib3                1.25.9
wheel                  0.34.2
zope.component         4.3.0
zope.event             4.4
zope.hookable          5.0.1
zope.interface         4.7.1

Others had same issue. Just search for “captcha”. Here the answer from that thread:

Short answer: I re-installed the pip3 module using pip3 install --ignore-installed django-simple-captcha and then restarted the seafile and seahub services - my problem was resolved.

1 Like

Thank you for the answer. I also did find the other threads before and tried the other solutions, but none did work. I just have trouble understanding the error as the captcha module is clearly installed.

Ah I just found the issue. I installed the python modules as my linux user, but I run seafile as the “seafile” user. When I ran the pip install with the seafile user, it worked.