Failed to run sentry upgrade

I’m trying to install sentry on ubuntu server 18.04, following https://docs.sentry.io/server/installation/python/

But I get

sentry.runner.importer.ConfigurationError: SyntaxError: invalid syntax (, line 16)

when I run

SENTRY_CONF=/etc/sentry sentry upgrade

I googled but didn’t find anything useful. help please.

If I had to guess you’re running Python 3 and you need Python 2.7.x

No, I’m using Python2.7.15rc1.

I add

import platform
print platform.python_version()

to bin/sentry and run

SENTRY_CONF=/etc/sentry sentry upgrade

again.

(sentry) root@inf1:/www/sentry# SENTRY_CONF=/etc/sentry sentry upgrade
2.7.15rc1
Traceback (most recent call last):
File “/www/sentry/bin/sentry”, line 13, in
sys.exit(main())
File “/www/sentry/local/lib/python2.7/site-packages/sentry/runner/init.py”, line 162, in main
cli(prog_name=get_prog(), obj={}, max_content_width=100)
File “/www/sentry/local/lib/python2.7/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/www/sentry/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/www/sentry/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/www/sentry/local/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/www/sentry/local/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/www/sentry/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/www/sentry/local/lib/python2.7/site-packages/sentry/runner/decorators.py”, line 35, in inner
configure()
File “/www/sentry/local/lib/python2.7/site-packages/sentry/runner/init.py”, line 125, in configure
configure(ctx, py, yaml, skip_service_validation)
File “/www/sentry/local/lib/python2.7/site-packages/sentry/runner/settings.py”, line 152, in configure
skip_service_validation=skip_service_validation
File “/www/sentry/local/lib/python2.7/site-packages/sentry/runner/initializer.py”, line 266, in initialize_app
bootstrap_options(settings, config[‘options’])
File “/www/sentry/local/lib/python2.7/site-packages/sentry/runner/initializer.py”, line 139, in bootstrap_options
from sentry.options import load_defaults
File “/www/sentry/local/lib/python2.7/site-packages/sentry/options/init.py”, line 10, in
from .store import OptionsStore
File “/www/sentry/local/lib/python2.7/site-packages/sentry/options/store.py”, line 19, in
from sentry.db.models.query import create_or_update
File “/www/sentry/local/lib/python2.7/site-packages/sentry/db/models/init.py”, line 11, in
from .base import * # NOQA
File “/www/sentry/local/lib/python2.7/site-packages/sentry/db/models/base.py”, line 15, in
from bitfield.types import BitHandler
File “/www/sentry/local/lib/python2.7/site-packages/bitfield/init.py”, line 7, in
from bitfield.models import Bit, BitHandler, CompositeBitField, BitField # NOQA
File “/www/sentry/local/lib/python2.7/site-packages/bitfield/models.py”, line 5, in
from django.db.models import signals
File “/www/sentry/local/lib/python2.7/site-packages/django/db/models/init.py”, line 5, in
from django.db.models.query import Q
File “/www/sentry/local/lib/python2.7/site-packages/django/db/models/query.py”, line 17, in
from django.db.models.deletion import Collector
File “/www/sentry/local/lib/python2.7/site-packages/django/db/models/deletion.py”, line 4, in
from django.db.models import signals, sql
File “/www/sentry/local/lib/python2.7/site-packages/django/db/models/sql/init.py”, line 4, in
from django.db.models.sql.subqueries import *
File “/www/sentry/local/lib/python2.7/site-packages/django/db/models/sql/subqueries.py”, line 12, in
from django.db.models.sql.query import Query
File “/www/sentry/local/lib/python2.7/site-packages/django/db/models/sql/query.py”, line 22, in
from django.db.models.sql import aggregates as base_aggregates_module
File “/www/sentry/local/lib/python2.7/site-packages/django/db/models/sql/aggregates.py”, line 9, in
ordinal_aggregate_field = IntegerField()
File “/www/sentry/local/lib/python2.7/site-packages/django/db/models/fields/init.py”, line 116, in init
self.db_tablespace = db_tablespace or settings.DEFAULT_INDEX_TABLESPACE
File “/www/sentry/local/lib/python2.7/site-packages/django/conf/init.py”, line 54, in getattr
self._setup(name)
File “/www/sentry/local/lib/python2.7/site-packages/django/conf/init.py”, line 49, in _setup
self._wrapped = Settings(settings_module)
File “/www/sentry/local/lib/python2.7/site-packages/django/conf/init.py”, line 128, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
File “/www/sentry/local/lib/python2.7/site-packages/django/utils/importlib.py”, line 40, in import_module
import(name)
File “/www/sentry/local/lib/python2.7/site-packages/sentry/runner/importer.py”, line 52, in load_module
reraise_as(ConfigurationError(msg))
File “/www/sentry/local/lib/python2.7/site-packages/sentry/utils/settings.py”, line 48, in reraise_as
six.reraise(new_type, new_exception, e_traceback)
File “/www/sentry/local/lib/python2.7/site-packages/sentry/runner/importer.py”, line 44, in load_module
mod = self.load_module(fullname)
File “/www/sentry/local/lib/python2.7/site-packages/sentry/runner/importer.py”, line 77, in load_module
load_settings(self.config_path, settings=settings_mod, silent=True)
File “/www/sentry/local/lib/python2.7/site-packages/sentry/runner/importer.py”, line 91, in load_settings
six.exec
(source_file.read(), conf.dict)
File “/www/sentry/local/lib/python2.7/site-packages/six.py”, line 699, in exec

exec(“”“exec code in globs, locs”“”)
File “”, line 1, in
sentry.runner.importer.ConfigurationError: SyntaxError: invalid syntax (, line 16)

Can you share your config? Around line 16? It’s literally telling you there’s a python syntax error on line 16.

OMG, it’s true there’s an error in /etc/sentry/sentry.conf.py on line 16. I thought it’s caused by third party library.

Thanks so much and sorry for my carelessness.