ImportError после установки djangocms-blog: невозможно импортировать имя 'python_2_unicode_compatible' из 'django .utils .encoding' - PullRequest
2 голосов
/ 09 мая 2020

Я сейчас установил django-cms и djangocms-blog. Когда я запускаю migrate, выдается следующая ошибка. Некоторые ресурсы предлагают установить six, что, однако, уже удовлетворено в моем venv.

Я использую последние версии Python, pip и django.

Это руководства, которые я затем следует настроить djangocms и djangocms-blog .

Любое решение для этого?

Requirement already satisfied: webencodings in c:\users\jonas\appdata\local\prog
rams\python\python38-32\lib\site-packages (from html5lib>=0.999999999->djangocms
-text-ckeditor>=3.5->djangocms-blog) (0.5.1)
Requirement already satisfied: asgiref~=3.2 in c:\users\jonas\appdata\local\prog
rams\python\python38-32\lib\site-packages (from django>=1.1->django-taggit-templ
atetags->djangocms-blog) (3.2.3)
Requirement already satisfied: sqlparse>=0.2.2 in c:\users\jonas\appdata\local\p
rograms\python\python38-32\lib\site-packages (from django>=1.1->django-taggit-te
mplatetags->djangocms-blog) (0.3.0)
Collecting django-js-asset
  Downloading django_js_asset-1.2.2-py2.py3-none-any.whl (5.8 kB)
Building wheels for collected packages: djangocms-text-ckeditor, django-taggit-t
emplatetags, django-filer, easy-thumbnails, django-sekizai, django-treebeard, dj
ango-classy-tags, djangocms-admin-style, django-appdata
  Building wheel for djangocms-text-ckeditor (setup.py) ... done
  Created wheel for djangocms-text-ckeditor: filename=djangocms_text_ckeditor-3.
9.0-py3-none-any.whl size=2009460 sha256=7f2a93b1858ad9c776ea9d286bf96924070a8d7
03ffb5d4510f3b74d39ca57d2
  Stored in directory: c:\users\jonas\appdata\local\pip\cache\wheels\0c\7b\1e\e3
908562c925cdc1dbcd7c4bd2447f8a11f6716a7d99f3c04b
  Building wheel for django-taggit-templatetags (setup.py) ... done
  Created wheel for django-taggit-templatetags: filename=django_taggit_templatet
ags-0.2.5-py3-none-any.whl size=7824 sha256=798816cf8c5154b3cd9d133dd906c8e40945
53de30f114a76fe8829d08a7c66c
  Stored in directory: c:\users\jonas\appdata\local\pip\cache\wheels\82\a4\66\54
1f4c683657632200e1e8ea3a89698e88ede94c1232365f00
  Building wheel for django-filer (setup.py) ... done
  Created wheel for django-filer: filename=django_filer-1.7.1-py3-none-any.whl s
ize=1572351 sha256=89983e63dedf4ecef67b3c0f929f9cf53281cd232a8afa72e9c97e2b3d9e3
d34
  Stored in directory: c:\users\jonas\appdata\local\pip\cache\wheels\01\26\cd\d8
64a98a0a882ae18c7c0551af158f82193a7e5daa88a86572
  Building wheel for easy-thumbnails (setup.py) ... done
  Created wheel for easy-thumbnails: filename=easy_thumbnails-2.7-py2.py3-none-a
ny.whl size=65532 sha256=b0c81ae967ea8073bba11192946e3e2a4af3928c5be5010445c6cf6
d21f37964
  Stored in directory: c:\users\jonas\appdata\local\pip\cache\wheels\e4\3f\d4\3c
7af17dfe56f754d3fe9a3c610aaeff28eaad840778039d1f
  Building wheel for django-sekizai (setup.py) ... done
  Created wheel for django-sekizai: filename=django_sekizai-1.1.0-py3-none-any.w
hl size=8501 sha256=895b43796abbfb5a8f4525140a3f96616b0a97ae46f1d17d1ef58ad5acdb
c671
  Stored in directory: c:\users\jonas\appdata\local\pip\cache\wheels\5f\a4\f3\ba
2e3b26fd0c6da68f23e2adfc90a52cd04e3c0a877fe7b295
  Building wheel for django-treebeard (setup.py) ... done
  Created wheel for django-treebeard: filename=django_treebeard-4.3.1-py2.py3-no
ne-any.whl size=104160 sha256=96537f1f9de03bb552d47ddb90ebfaf6016d6b771f3e12605d
d706f8a67880ed
  Stored in directory: c:\users\jonas\appdata\local\pip\cache\wheels\76\63\57\ba
77f284b71e8aa5afd08c85f1968bcfdc8106f12837ce32eb
  Building wheel for django-classy-tags (setup.py) ... done
  Created wheel for django-classy-tags: filename=django_classy_tags-1.0.0-py3-no
ne-any.whl size=14275 sha256=0b6b349b241b4a668360c2de1fbf931de6110451365ceaf0ef1
33a52298c8eb8
  Stored in directory: c:\users\jonas\appdata\local\pip\cache\wheels\64\40\96\8c
0ee90f1bf065766a881f22ee8bc54afeb3323989569d4c90
  Building wheel for djangocms-admin-style (setup.py) ... done
  Created wheel for djangocms-admin-style: filename=djangocms_admin_style-1.5.0-
py3-none-any.whl size=400280 sha256=791618cc13eb3d1347d84c54a12dce88323f656aa64a
2451712ce3c74f32bd34
  Stored in directory: c:\users\jonas\appdata\local\pip\cache\wheels\c6\55\98\79
73149944c17dbb19598c419fb47139e1f8984bc66bd40731
  Building wheel for django-appdata (setup.py) ... done
  Created wheel for django-appdata: filename=django_appdata-0.2.2-py3-none-any.w
hl size=12418 sha256=42dd18e970075a3f0c33737b5955ad464922c155ed70f5b1eb76d7ddb41
b17a7
  Stored in directory: c:\users\jonas\appdata\local\pip\cache\wheels\4e\fa\87\57
d4ab1d1df54f32b3f74bb567a632f76662b81a270d4eb82a
Successfully built djangocms-text-ckeditor django-taggit-templatetags django-fil
er easy-thumbnails django-sekizai django-treebeard django-classy-tags djangocms-
admin-style django-appdata

// First error

ERROR: django-appdata 0.2.2 has requirement Django<3.0,>=1.8, but you'll have dj
ango 3.0.6 which is incompatible.


Installing collected packages: django-formtools, django-classy-tags, django-seki
zai, django-treebeard, djangocms-admin-style, django-cms, html5lib, djangocms-te
xt-ckeditor, django-taggit, django-templatetag-sugar, django-taggit-templatetags
, django-js-asset, django-mptt, django-polymorphic, easy-thumbnails, Unidecode,
django-filer, django-meta, djangocms-apphook-setup, lxml, django-sortedm2m, djan
go-appdata, aldryn-apphooks-config, django-taggit-autosuggest, django-parler, dj
angocms-blog
Successfully installed Unidecode-1.1.1 aldryn-apphooks-config-0.5.3 django-appda
ta-0.2.2 django-classy-tags-1.0.0 django-cms-3.7.2 django-filer-1.7.1 django-for
mtools-2.2 django-js-asset-1.2.2 django-meta-1.6.1 django-mptt-0.11.0 django-par
ler-2.0.1 django-polymorphic-2.1.2 django-sekizai-1.1.0 django-sortedm2m-3.0.0 d
jango-taggit-1.2.0 django-taggit-autosuggest-0.3.8 django-taggit-templatetags-0.
2.5 django-templatetag-sugar-1.0 django-treebeard-4.3.1 djangocms-admin-style-1.
5.0 djangocms-apphook-setup-0.4.1 djangocms-blog-1.1.0 djangocms-text-ckeditor-3
.9.0 easy-thumbnails-2.7 html5lib-1.0.1 lxml-4.5.0

C:\Users\Jonas\Desktop\CFD\CFD>python manage.py migrate
Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\Jonas\AppData\Local\Programs\Python\Python38-32\lib\site-packag
es\django\core\management\__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "C:\Users\Jonas\AppData\Local\Programs\Python\Python38-32\lib\site-packag
es\django\core\management\__init__.py", line 377, in execute
    django.setup()
  File "C:\Users\Jonas\AppData\Local\Programs\Python\Python38-32\lib\site-packag
es\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\Jonas\AppData\Local\Programs\Python\Python38-32\lib\site-packag
es\django\apps\registry.py", line 114, in populate
    app_config.import_models()
  File "C:\Users\Jonas\AppData\Local\Programs\Python\Python38-32\lib\site-packag
es\django\apps\config.py", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "C:\Users\Jonas\AppData\Local\Programs\Python\Python38-32\lib\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 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\Jonas\AppData\Local\Programs\Python\Python38-32\lib\site-packag
es\aldryn_apphooks_config\models.py", line 5, in <module>
    from django.utils.encoding import python_2_unicode_compatible

// Second error

ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils
.encoding' (C:\Users\Jonas\AppData\Local\Programs\Python\Python38-32\lib\site-pa
ckages\django\utils\encoding.py)

C:\Users\Jonas\Desktop\CFD\CFD>python -m pip install six
Requirement already satisfied: six in c:\users\jonas\appdata\local\programs\pyth
on\python38-32\lib\site-packages (1.14.0)


Ответы [ 2 ]

3 голосов
/ 09 мая 2020

python_2_unicode_compatible был удален из Django в версии 3.0: https://docs.djangoproject.com/en/3.0/releases/3.0/#removed -private- python -2-compatibility-apis

Похоже, вам нужно обновить один ваших пакетов, которые его используют. Из трассировки это будет aldryn_apphooks_config. Я не уверен, откуда это взялось, для этого потребуются дополнительные подробности. Я бы посоветовал проверить ваш файл требований и попытаться обновить пакеты, пока он не заработает, но вам, возможно, придется удалить некоторые.

1 голос
/ 17 мая 2020

В этом случае это была устаревшая зависимость, которая была решена владельцем после моего запроса:

https://github.com/nephila/djangocms-blog/issues

...