Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

InvalidTemplateLibrary issue#1827

AnsweredbyEliahKagan
mikikop-sivan asked this question inQ&A
Discussion options

Hi
I have this issue when i runserver of my django project

Exception in thread django-main-thread:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/threading.py", line 926, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.7/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.7/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 118, in inner_run
self.check(display_num_errors=True)
File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 423, in check
databases=databases,
File "/usr/local/lib/python3.7/site-packages/django/core/checks/registry.py", line 76, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/usr/local/lib/python3.7/site-packages/django/core/checks/urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "/usr/local/lib/python3.7/site-packages/django/core/checks/urls.py", line 23, in check_resolver
return check_method()
File "/usr/local/lib/python3.7/site-packages/django/urls/resolvers.py", line 416, in check
for pattern in self.url_patterns:
File "/usr/local/lib/python3.7/site-packages/django/utils/functional.py", line 48, inget
res = instance.dict[self.name] = self.func(instance)
File "/usr/local/lib/python3.7/site-packages/django/urls/resolvers.py", line 602, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python3.7/site-packages/django/utils/functional.py", line 48, inget
res = instance.dict[self.name] = self.func(instance)
File "/usr/local/lib/python3.7/site-packages/django/urls/resolvers.py", line 595, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/local/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "", line 728, in exec_module
File "", line 219, in _call_with_frames_removed
File "/code/moovcare_server/urls.py", line 29, in
from templatetags.version import send_command, export_to_csv, import_from_csv, read_only_admin, send_to_medeol
File "/code/templatetags/version.py", line 11, in
import git
File "/usr/local/lib/python3.7/site-packages/git/init.py", line 38, in
from git.exc import * #@nomove @IgnorePep8
File "/usr/local/lib/python3.7/site-packages/git/exc.py", line 9, in
from git.compat import UnicodeMixin, safe_decode, string_types
File "/usr/local/lib/python3.7/site-packages/git/compat.py", line 21, in
from gitdb.utils.encoding import (
ImportError: cannot import name 'string_types' from 'gitdb.utils.encoding' (/usr/local/lib/python3.7/site-packages/gitdb/utils/encoding.py)

Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/django/template/utils.py", line 66, ingetitem
return self._engines[alias]
KeyError: 'django'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/django/template/library.py", line 317, in import_library
module = import_module(name)
File "/usr/local/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "", line 728, in exec_module
File "", line 219, in _call_with_frames_removed
File "/code/templatetags/version.py", line 11, in
import git
File "/usr/local/lib/python3.7/site-packages/git/init.py", line 38, in
from git.exc import * #@nomove @IgnorePep8
File "/usr/local/lib/python3.7/site-packages/git/exc.py", line 9, in
from git.compat import UnicodeMixin, safe_decode, string_types
File "/usr/local/lib/python3.7/site-packages/git/compat.py", line 21, in
from gitdb.utils.encoding import (
ImportError: cannot import name 'string_types' from 'gitdb.utils.encoding' (/usr/local/lib/python3.7/site-packages/gitdb/utils/encoding.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "manage.py", line 22, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.7/site-packages/django/core/management/init.py", line 419, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.7/site-packages/django/core/management/init.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 61, in execute
super().execute(*args, **options)
File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 96, in handle
self.run(**options)
File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 103, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "/usr/local/lib/python3.7/site-packages/django/utils/autoreload.py", line 638, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/django/utils/autoreload.py", line 623, in start_django
reloader.run(django_main_thread)
File "/usr/local/lib/python3.7/site-packages/django/utils/autoreload.py", line 328, in run
autoreload_started.send(sender=self)
File "/usr/local/lib/python3.7/site-packages/django/dispatch/dispatcher.py", line 182, in send
for receiver in self._live_receivers(sender)
File "/usr/local/lib/python3.7/site-packages/django/dispatch/dispatcher.py", line 182, in
for receiver in self._live_receivers(sender)
File "/usr/local/lib/python3.7/site-packages/django/template/autoreload.py", line 44, in watch_for_template_changes
for directory in get_template_directories():
File "/usr/local/lib/python3.7/site-packages/django/template/autoreload.py", line 17, in get_template_directories
for backend in engines.all():
File "/usr/local/lib/python3.7/site-packages/django/template/utils.py", line 90, in all
return [self[alias] for alias in self]
File "/usr/local/lib/python3.7/site-packages/django/template/utils.py", line 90, in
return [self[alias] for alias in self]
File "/usr/local/lib/python3.7/site-packages/django/template/utils.py", line 81, ingetitem
engine = engine_cls(params)
File "/usr/local/lib/python3.7/site-packages/django/template/backends/django.py", line 27, ininit
self.engine = Engine(self.dirs, self.app_dirs, **options)
File "/usr/local/lib/python3.7/site-packages/django/template/engine.py", line 51, ininit
self.template_libraries = self.get_template_libraries(libraries)
File "/usr/local/lib/python3.7/site-packages/django/template/engine.py", line 93, in get_template_libraries
loaded[name] = import_library(path)
File "/usr/local/lib/python3.7/site-packages/django/template/library.py", line 321, in import_library
"trying to load '%s': %s" % (name, e)
django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'templatetags.version': cannot import name 'string_types' from 'gitdb.utils.encoding' (/usr/local/lib/python3.7/site-packages/gitdb/utils/encoding.py)

i have the following requirements.txt:

amqp>=2.5.0,<3.0
asgiref==3.5.2
Babel==2.6.0
backcall==0.1.0
billiard>=3.5.0.2,<3.6.0
boto3==1.33.13
botocore==1.33.13
cached-property==1.5.2
cachetools==3.1.1
celery==4.2.1
certifi==2019.6.16
cffi==1.15.1
chardet==3.0.4
charset-normalizer==3.3.2
click==8.1.7
click-didyoumean==0.3.0
click-plugins==1.1.1
click-repl==0.3.0
cm-text-sdk-python==2.0.1
coreapi==2.3.3
coreschema==0.0.4
cryptography==38.0.4
cssselect==1.0.3
cssutils==1.0.2
decorator==4.4.0
defusedxml==0.7.1
diff-match-patch==20230430
Django==3.2.15
django-anymail==8.2
django-appconf==1.0.3
django-auto-prefetching==0.2.12
django-ckeditor==5.6.1
django-cors-middleware==1.5.0
django-countries==7.2
django-csp==3.6
django-debug-toolbar==3.5.0
django-djet2==1.0.13
django-filter==2.0.0
django-imagekit==4.0.2
django-import-export==3.2.0
django-js-asset==2.0.0
django-jsonfield==1.4.1
django-link-shortener==0.3
django-mailjet==0.3.1
django-modeltranslation==0.16.2
django-multiselectfield==0.1.8
django-nexmo==2.0.0a1
django-otp==1.0.2
django-phonenumber-field==2.0.1
django-postman==4.3
django-queryinspect==1.1.0
django-ratelimit==4.0.0
django-rest-passwordreset==1.1.0
django-simple-history==3.3.0
django-simple-mail==2.3.3
django-timezone-field==4.1.2
djangorestframework==3.11.0
djangorestframework-jwt==1.11.0
docutils==0.15.2
drf-yasg==1.17.1
et-xmlfile==1.1.0
flake8==3.5.0
gitdb2==2.0.5
GitPython==2.1.11
gunicorn==19.9.0
html2text==2018.1.9
idna==2.7
importlib-metadata==6.7.0
inflection==0.5.1
ipdb==0.13.9
ipython==7.19.0
ipython-genutils==0.2.0
itypes==1.1.0
jedi==0.14.1
Jinja2==2.10.1
jmespath==0.10.0
kombu==4.6.3
lml==0.1.0
lxml==4.9.1
mailjet-rest==1.3.0
Markdown==2.6.11
markdown-it-py==2.2.0
MarkupPy==1.14
MarkupSafe==1.1.1
mccabe==0.6.1
mdurl==0.1.2
nexmo==2.4.0
odfpy==1.4.1
openpyxl==3.0.10
packaging==21.3
parso==0.5.1
pexpect==4.7.0
phonenumbers==8.10.2
pickleshare==0.7.5
pilkit==2.0
Pillow==9.2.0
premailer==3.5.0
prompt-toolkit==3.0.41
psycopg2-binary==2.9.3
ptyprocess==0.6.0
pycodestyle==2.3.1
pycparser==2.21
pyexcel-io==0.6.6
pyexcel-xls==0.5.9
pyexcel-xlsx==0.5.8
pyflakes==1.6.0
Pygments==2.14.0
PyJWT==1.6.4
pyparsing==3.0.9
python-dateutil==2.8.2
pytz==2023.3.post1
PyYAML==6.0
qrcode==6.1
raven==6.10.0
redis==3.1.0
requests==2.31.0
rich==13.3.2
ruamel.yaml==0.17.21
ruamel.yaml.clib==0.2.7
s3transfer==0.8.2
six==1.16.0
smmap2==2.0.5
sqlparse==0.3.0
tablib==3.4.0
toml==0.10.2
traitlets==4.3.2
typing_extensions==4.4.0
ua-parser==0.16.1
uritemplate==3.0.0
urllib3>=1.25.4,<1.27
user-agents==2.2.0
vine>=1.1.3,<5.0.0a1
watchtower==3.0.1
wcwidth==0.1.7
xlrd==2.0.1
xlwt==1.3.0
zipp==3.15.0

someone for help?

You must be logged in to vote

This is bug#897 (fixed inbcf9f1c). The solution is to upgrade GitPython to version2.1.15 or higher.

If at all possible, amuch higher version should be used. The current version of GitPython, as of this writing, is 3.1.42. Over time, bugs have been fixed, includingsecurity vulnerabilities. Especially if you are developing a web application, it is a good idea to use patched versions of all dependencies (this is not limited to GitPython).

The best way to update may depend on the details of your project and what is causing such old versions to be specified in the first place. It looks like yourrequirements.txt is generated by runningpip freeze. If so, getting later versions comes down …

Replies: 1 comment

Comment options

This is bug#897 (fixed inbcf9f1c). The solution is to upgrade GitPython to version2.1.15 or higher.

If at all possible, amuch higher version should be used. The current version of GitPython, as of this writing, is 3.1.42. Over time, bugs have been fixed, includingsecurity vulnerabilities. Especially if you are developing a web application, it is a good idea to use patched versions of all dependencies (this is not limited to GitPython).

The best way to update may depend on the details of your project and what is causing such old versions to be specified in the first place. It looks like yourrequirements.txt is generated by runningpip freeze. If so, getting later versions comes down to how you are installing packages before running a command likepip freeze >requirements.txt. Maybe you are installing from arequirements.in file that contains unnecessary constraints, but this is just a guess. Or mayberequirements.txt is copied from an older project that has not been updated.


In case they are of interest, here are some references related to#897 itself:

However, it will most likely not be necessary to deal with any of those details. Upgrading to 2.1.15 or (preferably) higher should be sufficient.

You must be logged in to vote
0 replies
Answer selected byByron
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@mikikop-sivan@EliahKagan

[8]ページ先頭

©2009-2025 Movatter.jp