[SOLVED] Upgrade from 6.2.5 to 6.3.1 ImportError: cannot import name DependencyWarning


#1

The upgrade script was successful, but I get an Internal Server Error 500 on access in browser.

Running Seafile with Docker (Hypriot v1.8.0) on RPI3B+ and the following packages

FROM sdhibit/rpi-baseimage    
RUN apt-get update && apt-get install -y \
        python2.7 \
        python-setuptools \
        python-simplejson \
        python-imaging \
        python-memcache \
        python-mysqldb \
        python-requests \
        python-urllib3 \
        libpython2.7 \
     && rm -rf /var/lib/apt/lists/*

I tried to update the packages python-urllib3 and python-requests, but already using the latest.

Here are the logs, any ideas?

seahub.log

2018-07-07 13:24:29,667 [ERROR] django.request:135 handle_uncaught_exception Internal Server Error: /
Traceback (most recent call last):
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/Django-1.11.13-py2.7.egg/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/Django-1.11.13-py2.7.egg/django/core/handlers/base.py", line 244, in _legacy_get_response
    response = middleware_method(request)
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/Django-1.11.13-py2.7.egg/django/middleware/locale.py", line 24, in process_request
    i18n_patterns_used, prefixed_default_language = is_language_prefix_patterns_used(urlconf)
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/Django-1.11.13-py2.7.egg/django/utils/lru_cache.py", line 100, in wrapper
    result = user_function(*args, **kwds)
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/Django-1.11.13-py2.7.egg/django/conf/urls/i18n.py", line 29, in is_language_prefix_patterns_used
    for url_pattern in get_resolver(urlconf).url_patterns:
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/Django-1.11.13-py2.7.egg/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/Django-1.11.13-py2.7.egg/django/urls/resolvers.py", line 405, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/Django-1.11.13-py2.7.egg/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/Django-1.11.13-py2.7.egg/django/urls/resolvers.py", line 398, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/seafile/seafile-server-6.3.1/seahub/seahub/utils/rooturl.py", line 41, in <module>
    url(r'^%s' % settings.SITE_ROOT[1:], include(settings.SITE_ROOT_URLCONF)),
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/Django-1.11.13-py2.7.egg/django/conf/urls/__init__.py", line 50, in include
    urlconf_module = import_module(urlconf_module)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/seafile/seafile-server-6.3.1/seahub/seahub/urls.py", line 12, in <module>
    from seahub.views.file import view_history_file, view_trash_file,\
  File "/home/seafile/seafile-server-6.3.1/seahub/seahub/views/file.py", line 43, in <module>
    from seahub.wopi.utils import get_wopi_dict
  File "/home/seafile/seafile-server-6.3.1/seahub/seahub/wopi/utils.py", line 7, in <module>
    import requests
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/requests-2.18.4-py2.7.egg/requests/__init__.py", line 90, in <module>
    from urllib3.exceptions import DependencyWarning
ImportError: cannot import name DependencyWarning

gunicorn_error.log

[2018-07-07 13:24:29 +0000] [86] [ERROR] Error handling request /
Traceback (most recent call last):
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/gunicorn-19.8.1-py2.7.egg/gunicorn/workers/sync.py", line 135, in handle
    self.handle_request(listener, req, client, addr)
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/gunicorn-19.8.1-py2.7.egg/gunicorn/workers/sync.py", line 176, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/Django-1.11.13-py2.7.egg/django/core/handlers/wsgi.py", line 157, in __call__
    response = self.get_response(request)
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/Django-1.11.13-py2.7.egg/django/core/handlers/base.py", line 124, in get_response
    response = self._middleware_chain(request)
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/Django-1.11.13-py2.7.egg/django/core/handlers/exception.py", line 43, in inner
    response = response_for_exception(request, exc)
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/Django-1.11.13-py2.7.egg/django/core/handlers/exception.py", line 93, in response_for_exception
    response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/Django-1.11.13-py2.7.egg/django/core/handlers/exception.py", line 142, in handle_uncaught_exception
    callback, param_dict = resolver.resolve_error_handler(500)
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/Django-1.11.13-py2.7.egg/django/urls/resolvers.py", line 418, in resolve_error_handler
    callback = getattr(self.urlconf_module, 'handler%s' % view_type, None)
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/Django-1.11.13-py2.7.egg/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/Django-1.11.13-py2.7.egg/django/urls/resolvers.py", line 398, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/seafile/seafile-server-6.3.1/seahub/seahub/utils/rooturl.py", line 41, in <module>
    url(r'^%s' % settings.SITE_ROOT[1:], include(settings.SITE_ROOT_URLCONF)),
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/Django-1.11.13-py2.7.egg/django/conf/urls/__init__.py", line 50, in include
    urlconf_module = import_module(urlconf_module)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/seafile/seafile-server-6.3.1/seahub/seahub/urls.py", line 12, in <module>
    from seahub.views.file import view_history_file, view_trash_file,\
  File "/home/seafile/seafile-server-6.3.1/seahub/seahub/views/file.py", line 43, in <module>
    from seahub.wopi.utils import get_wopi_dict
  File "/home/seafile/seafile-server-6.3.1/seahub/seahub/wopi/utils.py", line 7, in <module>
    import requests
  File "/home/seafile/seafile-server-6.3.1/seahub/thirdpart/requests-2.18.4-py2.7.egg/requests/__init__.py", line 90, in <module>
    from urllib3.exceptions import DependencyWarning
ImportError: cannot import name DependencyWarning

Internal Server Error after upgrade from 6.2.5 to 6.3.2
#2

exact same problem here.


#3

I fixed it with:

apt-get remove python-pip
easy_install pip
sudo pip install --upgrade urllib3

Stop Seafile
rm -rf /<tmp_dir>/seahub_cache/
Start Seafile

…worked for me :blush:

I use Debian 8. Found some part of the solution here https://stackoverflow.com/questions/27341064/how-do-i-fix-importerror-cannot-import-name-incompleteread, here https://stackoverflow.com/questions/44927351/importerror-cannot-import-name-dependencywarning and here https://github.com/nickoala/telepot/issues/80#issuecomment-269206431


Upgrade from 6.2.2 to 6.3.1 - Can't access via browser
#4

Thx for your input, this solved the problem.

Installing collected packages: urllib3
  Found existing installation: urllib3 1.9.1
    Uninstalling urllib3-1.9.1:
      Successfully uninstalled urllib3-1.9.1
Successfully installed urllib3-1.23

I additionally had to apt-get install openssl to make the urllib3 upgrade work.

But I still struggle with the update as two more problems came to light. But that should not be part of this thread.


Seafile Server 6.3.1 for Raspberry Pi is ready! 05.07.2018
#5

For all people out there who have mulitple python instances running (like me with 2.7 which is needed by seafile/seahub & 3.4 for other things) a little hint:

I needed to upgrade urllib3 & chardet special for python 2.7. That worked like this:

seafile@XXXX:~/seafile-server-latest$ sudo python2.7 -m pip uninstall urllib3
Uninstalling urllib3-1.9.1:
  /usr/lib/python2.7/dist-packages/urllib3
  /usr/lib/python2.7/dist-packages/urllib3-1.9.1.egg-info
Proceed (y/n)? y
  Successfully uninstalled urllib3-1.9.1
seafile@XXXX:~/seafile-server-latest$ sudo python2.7 -m pip install urllib3
Collecting urllib3
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/bd/c9/6fdd990019071a4a32a5e7cb78a1d92c53851ef4f56f62a3486e6a7d8ffb/urllib3-1.23-py2.py3-none-any.whl
Installing collected packages: urllib3
Successfully installed urllib3-1.23
seafile@XXXX:~/seafile-server-latest$ sudo python2.7 -m pip uninstall chardet
Uninstalling chardet-2.3.0:
  Would remove:
    /usr/lib/python2.7/dist-packages/chardet
    /usr/lib/python2.7/dist-packages/chardet-2.3.0.egg-info
Proceed (y/n)? y
  Successfully uninstalled chardet-2.3.0
seafile@XXXX:~/seafile-server-latest$ sudo python2.7 -m pip install chardet
Collecting chardet
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Installing collected packages: chardet
Successfully installed chardet-3.0.4

After that and a reboot everything went well.


Seafile Server 6.3.1 for Raspberry Pi is ready! 05.07.2018