nephila / djangocms-installer

Console wizard to bootstrap django CMS projects

Home Page:https://djangocms-installer.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

subprocess.CalledProcessError, I can't install on python 3.6

Ruizhijian opened this issue · comments

(venv) MichaeldeMacBook-Pro:untitled1 michael$ djangocms mysite
Creating the project
Please wait while I install dependencies
If I am stuck for a long time, please check for connectivity / PyPi issues
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Dependencies installed
Creating the project
The installation has failed.


Check documentation at https://djangocms-installer.readthedocs.io


Traceback (most recent call last):
File "/Users/michael/PycharmProjects/untitled1/venv/bin/djangocms", line 11, in
sys.exit(execute())
File "/Users/michael/PycharmProjects/untitled1/venv/lib/python3.7/site-packages/djangocms_installer/main.py", line 44, in execute
django.setup_database(config_data)
File "/Users/michael/PycharmProjects/untitled1/venv/lib/python3.7/site-packages/djangocms_installer/django/init.py", line 407, in setup_database
command, env=env, stderr=subprocess.STDOUT
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 376, in check_output
**kwargs).stdout
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 468, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/Users/michael/PycharmProjects/untitled1/venv/bin/python', '-W', 'ignore', 'manage.py', 'migrate']' returned non-zero exit status 1.
(venv) MichaeldeMacBook-Pro:untitled1 michael$

But python2.7 is fine

Thanks @Ruizhijian for reporting, could you run with --verbose argument to get more information about what went wrong?

I don't know about him, but I'm getting the same problem, and using verbose adds this dump before the one pasted above:

(Omitted pip spam)
Successfully installed Django-2.1.9 Pillow-6.0.0 Unidecode-1.0.23 django-classy-tags-0.9.0 django-cms-3.6.0 django-filer-1.5.0 django-formtools-2.1 django-js-asset-1.2.2 django-mptt-0.10.0 django-polymorphic-2.0.3 django-sekizai-1.0.0 django-treebeard-4.3 djangocms-admin-style-1.2.9 djangocms-attributes-field-1.1.0 djangocms-column-1.9.0 djangocms-file-2.3.0 djangocms-googlemap-1.3.0 djangocms-link-2.4.0 djangocms-picture-2.0.8 djangocms-snippet-2.1.0 djangocms-style-2.2.0 djangocms-text-ckeditor-3.7.0 djangocms-video-2.0.5 easy-thumbnails-2.6 html5lib-1.0.1 psycopg2-2.8.3 webencodings-0.5.1
Dependencies installed
Creating the project
Project creation command: /Users/desimone/venv-dcms/bin/python /Users/desimone/venv-dcms/bin/django-admin.py startproject mainwebsite /Users/desimone/project_dir
Database setup commands: /Users/desimone/venv-dcms/bin/python -W ignore manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, cms, contenttypes, djangocms_column, djangocms_file, djangocms_googlemap, djangocms_link, djangocms_picture, djangocms_snippet, djangocms_style, djangocms_text_ckeditor, djangocms_video, easy_thumbnails, filer, menus, sessions, sites
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying admin.0003_logentry_add_action_flag_choices... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying sites.0001_initial... OK
Applying cms.0001_initial... OK
Applying cms.0002_auto_20140816_1918... OK
Applying cms.0003_auto_20140926_2347... OK
Applying cms.0004_auto_20140924_1038... OK
Applying cms.0005_auto_20140924_1039... OK
Applying cms.0006_auto_20140924_1110... OK
Applying cms.0007_auto_20141028_1559... OK
Applying cms.0008_auto_20150208_2149... OK
Applying cms.0008_auto_20150121_0059... OK
Applying cms.0009_merge... OK
Applying cms.0010_migrate_use_structure... OK
Applying cms.0011_auto_20150419_1006... OK
Applying cms.0012_auto_20150607_2207... OK
Applying cms.0013_urlconfrevision... OK
Applying cms.0014_auto_20160404_1908... OK
Applying cms.0015_auto_20160421_0000... OK
Applying cms.0016_auto_20160608_1535... OK
Applying cms.0017_pagetype... OK
Applying cms.0018_create_pagenode... OK
Applying cms.0019_set_pagenode...Traceback (most recent call last):
File "manage.py", line 15, in
execute_from_command_line(sys.argv)
File "/Users/desimone/venv-dcms/lib/python3.6/site-packages/django/core/management/init.py", line 381, in execute_from_command_line
utility.execute()
File "/Users/desimone/venv-dcms/lib/python3.6/site-packages/django/core/management/init.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/desimone/venv-dcms/lib/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/desimone/venv-dcms/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute
output = self.handle(*args, **options)
File "/Users/desimone/venv-dcms/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
res = handle_func(*args, **kwargs)
File "/Users/desimone/venv-dcms/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 203, in handle
fake_initial=fake_initial,
File "/Users/desimone/venv-dcms/lib/python3.6/site-packages/django/db/migrations/executor.py", line 117, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/Users/desimone/venv-dcms/lib/python3.6/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/Users/desimone/venv-dcms/lib/python3.6/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
state = migration.apply(state, schema_editor)
File "/Users/desimone/venv-dcms/lib/python3.6/site-packages/cms/migrations/0019_set_pagenode.py", line 68, in apply
connection.introspection.get_table_description(connection.cursor(), 'cms_page')
File "/Users/desimone/venv-dcms/lib/python3.6/site-packages/django/db/backends/postgresql/introspection.py", line 69, in get_table_description
for line in cursor.description
File "/Users/desimone/venv-dcms/lib/python3.6/site-packages/django/db/backends/postgresql/introspection.py", line 69, in
for line in cursor.description
TypeError: sequence index must be integer, not 'slice'
The installation has failed.

Not sure if this is for here or upstream.

@greyhare I think that it's related to this django-cms/django-cms#6666

I think I will release a patch version which will pin psycopg2<2.8 that fixes the issues

psycopg2 pinned to < 2.8 in 1.1.1

@greyhare could you check if this fixes your issue

It coughs up this warning now:

/Users/desimone/venv-dcms/lib/python3.6/site-packages/psycopg2/init.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: http://initd.org/psycopg/docs/install.html#binary-install-from-pypi.

But the installer runs successfully. Now on to the next thing: http://127.0.0.1:8000/en/ gets a 404:

Using the URLconf defined in mainwebsite.urls, Django tried these URL patterns, in this order:

^media/(?P<path>.*)$
^static\/(?P<path>.*)$
^sitemap\.xml$
en/ ^admin/
en/ ^ ^cms_login/$ [name='cms_login']
en/ ^ ^cms_wizard/
en/ ^ ^(?P<slug>[0-9A-Za-z-_.//]+)/$ [name='pages-details-by-slug']
en/ ^ ^$ [name='pages-root']

The current path, /en/, didn't match any of these.

Seems like it should match option 8, but anyway.

@greyhare the warning is something we can't remove: according to my psycopg2 made a lot of mess with psycopg2 / psycopg2-binary packages and the former is now the recommended for production, but in version 2.7.7 which we are forced to use, it spits out that nonsense (see http://initd.org/psycopg/docs/install.html#change-in-binary-packages-between-psycopg-2-7-and-2-8)

I can't reproduce the 404: I get the django cms login screen:
image
(project setup with djangocms abcde)

I've narrowed down the problem to --starting-page yes, whether it's in the config file or the command line, breaks it. Diffing output trees...

@greyhare ouch. Thanks for the detail. I see what has gone wrong, I will prepare a patch soon

No significant difference in the generated code. Looking at the diffs in the generated databases.

What was it? I'm still reading dumps. is_home is False for all the pages it seems, but I don't know if that's Bad.

The problem is that in django CMS 3.5+ we must call page.set_as_homepage in starting_page.py

OK, let me know when it's patched.

Looks like there's two home pages, too:

COPY public.cms_page (id, created_by, changed_by, creation_date, changed_date, publication_date, publication_end_date, in_navigation, soft_root, reverse_id, navigation_extenders, template, login_required, limit_visibility_in_menu, is_home, application_urls, application_namespace, publisher_is_draft, languages, xframe_options, publisher_public_id, is_page_type, node_id) FROM stdin;
2 admin admin 2019-06-29 19:17:11.947465-05 2019-06-29 19:17:11.947475-05 2019-06-29 19:17:11.94732-05 \N f f \N \N feature.html f \N f \N \N f en 0 1 f 1
1 script admin 2019-06-29 19:17:11.85293-05 2019-06-29 19:17:11.85296-05 2019-06-29 19:17:11.94732-05 \N f f \N \N feature.html f \N f \N \N t en 0 2 f 1
\.

Definitely looks like there's two pages:

COPY public.cms_page (id, created_by, changed_by, creation_date, changed_date, publication_date, publication_end_date, in_navigation, soft_root, reverse_id, navigation_extenders, template, login_required, limit_visibility_in_menu, is_home, application_urls, application_namespace, publisher_is_draft, languages, xframe_options, publisher_public_id, is_page_type, node_id) FROM stdin;
2 admin admin 2019-06-29 19:17:11.947465-05 2019-06-29 19:17:11.947475-05 2019-06-29 19:17:11.94732-05 \N f f \N \N feature.html f \N f \N \N f en 0 1 f 1
1 script admin 2019-06-29 19:17:11.85293-05 2019-06-29 19:17:11.85296-05 2019-06-29 19:17:11.94732-05 \N f f \N \N feature.html f \N f \N \N t en 0 2 f 1
\.

All other differences are migration timestamps and auto-increment counts.

django CMS always keep a live and draft version of the same page, hence the two records you see in the database

Pasted the wrong table the second time. Here's the right one:

COPY public.cms_page (id, created_by, changed_by, creation_date, changed_date, publication_date, publication_end_date, in_navigation, soft_root, reverse_id, navigation_extenders, template, login_required, limit_visibility_in_menu, is_home, application_urls, application_namespace, publisher_is_draft, languages, xframe_options, publisher_public_id, is_page_type, node_id) FROM stdin;
2 admin admin 2019-06-29 19:17:11.947465-05 2019-06-29 19:17:11.947475-05 2019-06-29 19:17:11.94732-05 \N f f \N \N feature.html f \N f \N \N f en 0 1 f 1
1 script admin 2019-06-29 19:17:11.85293-05 2019-06-29 19:17:11.85296-05 2019-06-29 19:17:11.94732-05 \N f f \N \N feature.html f \N f \N \N t en 0 2 f 1
\.

OK, I see it: publisher_is_draft changes.

You can shut the warning up by modifying your manage.py:

import os
import sys
import warnings

if __name__ == '__main__':
    warnings.filterwarnings(
        'ignore', r'The psycopg2.*release 2\.8', UserWarning, 'psycopg2')
    # ... rest of code ...

@greyhare I opened the PR for the starting page issue, could you test it in your environment?

regarding the psycopg2 warning, I don't think we should ship such a filtering: it would be too opinionated given the scope of this tool
Hopefully the incompatibility between pyscopg2 and django will be solved and we will be able to remove the version pinning

I'm not recommending shipping withthe filter. I'm recommending putting the filter where people searching for the warning in conjunction with this project will find it, so they can make a decision themselves. manage.py is not complex code, and people usually have changes of their own anyway. Let them make the call.

Ah ok, I guess we can add a note in the readme