I have a strange problem. I am using a program developed in python 2.7 (not by me). The software use matplotlib and I installed it fine. But somehow I still get this error. Anyone has any idea what to check?
Traceback (most recent call last):
File "C:\Daten\R&D\Labor\pyLogger_RS485\GUI_MasterLogger.py", line 460, in <module>
mainwindow = MainWindow()
File "C:\Daten\R&D\Labor\pyLogger_RS485\GUI_MasterLogger.py", line 26, in __init__
self.initUI()
File "C:\Daten\R&D\Labor\pyLogger_RS485\GUI_MasterLogger.py", line 56, in initUI
self.ui = uic.loadUi('uiGUI_TCCO2_MasterLogger.ui')
File "C:\Python27\lib\site-packages\PyQt4\uic\__init__.py", line 238, in loadUi
return DynamicUILoader(package).loadUi(uifile, baseinstance, resource_suffix)
File "C:\Python27\lib\site-packages\PyQt4\uic\Loader\loader.py", line 71, in loadUi
return self.parse(filename, resource_suffix, basedir)
File "C:\Python27\lib\site-packages\PyQt4\uic\uiparser.py", line 951, in parse
actor(elem)
File "C:\Python27\lib\site-packages\PyQt4\uic\uiparser.py", line 790, in createUserInterface
self.traverseWidgetTree(elem)
File "C:\Python27\lib\site-packages\PyQt4\uic\uiparser.py", line 768, in traverseWidgetTree
handler(self, child)
File "C:\Python27\lib\site-packages\PyQt4\uic\uiparser.py", line 242, in createWidget
self.traverseWidgetTree(elem)
File "C:\Python27\lib\site-packages\PyQt4\uic\uiparser.py", line 768, in traverseWidgetTree
handler(self, child)
File "C:\Python27\lib\site-packages\PyQt4\uic\uiparser.py", line 242, in createWidget
self.traverseWidgetTree(elem)
File "C:\Python27\lib\site-packages\PyQt4\uic\uiparser.py", line 768, in traverseWidgetTree
handler(self, child)
File "C:\Python27\lib\site-packages\PyQt4\uic\uiparser.py", line 242, in createWidget
self.traverseWidgetTree(elem)
File "C:\Python27\lib\site-packages\PyQt4\uic\uiparser.py", line 768, in traverseWidgetTree
handler(self, child)
File "C:\Python27\lib\site-packages\PyQt4\uic\uiparser.py", line 233, in createWidget
self.stack.push(self.setupObject(widget_class, parent, elem))
File "C:\Python27\lib\site-packages\PyQt4\uic\uiparser.py", line 194, in setupObject
obj = self.factory.createQObject(clsname, name, args, is_attribute)
File "C:\Python27\lib\site-packages\PyQt4\uic\objcreator.py", line 106, in createQObject
factory = self.findQObjectType(classname)
File "C:\Python27\lib\site-packages\PyQt4\uic\objcreator.py", line 131, in findQObjectType
w = module.search(classname)
File "C:\Python27\lib\site-packages\PyQt4\uic\Loader\qobjectcreator.py", line 107, in search
module = __import__(mname, {}, {}, (cls,))
ImportError: No module named matplotlibwidget
Thanks in advance,
Umberto
Related
I get this strange error on Python2.7. It works fine with Python3:
Traceback (most recent call last):
File "/home/guettli/descript/projects/descript_jugendhaus/.tox/py27-django14/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
main()
File "/home/guettli/descript/projects/descript_jugendhaus/.tox/py27-django14/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/guettli/descript/projects/descript_jugendhaus/.tox/py27-django14/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 133, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "/tmp/pip-build-env-sy2MSY/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 156, in prepare_metadata_for_build_wheel
self.run_setup()
File "/tmp/pip-build-env-sy2MSY/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 243, in run_setup
self).run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-sy2MSY/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 142, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 195, in <module>
distclass=BinaryDistribution,
File "/tmp/pip-build-env-sy2MSY/overlay/lib/python2.7/site-packages/setuptools/__init__.py", line 162, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/tmp/pip-build-env-sy2MSY/overlay/lib/python2.7/site-packages/setuptools/command/dist_info.py", line 31, in run
egg_info.run()
File "/tmp/pip-build-env-sy2MSY/overlay/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 296, in run
self.find_sources()
File "/tmp/pip-build-env-sy2MSY/overlay/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 303, in find_sources
mm.run()
File "/tmp/pip-build-env-sy2MSY/overlay/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 534, in run
self.add_defaults()
File "/tmp/pip-build-env-sy2MSY/overlay/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 570, in add_defaults
sdist.add_defaults(self)
File "/tmp/pip-build-env-sy2MSY/overlay/lib/python2.7/site-packages/setuptools/command/py36compat.py", line 36, in add_defaults
self._add_defaults_ext()
File "/tmp/pip-build-env-sy2MSY/overlay/lib/python2.7/site-packages/setuptools/command/py36compat.py", line 118, in _add_defaults_ext
if self.distribution.has_ext_modules():
File "setup.py", line 109, in has_ext_modules
return super().has_ext_modules() or 'SETUPPY_ALLOW_PURE' not in os.environ
TypeError: super() takes at least 1 argument (0 given)
What could be the root-cause?
I found a solution.
If I disable the python-hunter library it works.
I guess python-hunter is not compatible with Python2.7 any more.
That's fine for my use case. I this case I can remove the library (although it is a great tracing library).
I don't know if this is relevant, but the supercomputer operators conducted an upgrade of Booster module yesterday. After that my tensorflow scripts, which were working perfectly fine before that, raise the following error:
2018-06-30 02:21:11.787262: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Traceback (most recent call last):
File "/homeb/eusmi01/eusmi0100/Programs/consscortk/bin/deep-ScaffOpt.py", line 524, in <module>
serial_RF=False))
File "/homeb/eusmi01/eusmi0100/Programs/consscortk/bin/deep-ScaffOpt.py", line 189, in train_MLP
MLP = deepMetaPredictor().combinePredictors_datatypes(datasets, mat, serial_RF=serial_RF, META_ZCUTOFF=datasets.args.META_ZCUTOFF)
File "/homeb/eusmi01/eusmi0100/Programs/consscortk/lib/deepMetaPredictor.py", line 169, in combinePredictors_datatypes
mlp.fit(datasets.x_crossval['lhl'], datasets.y_crossval['lhl'])
File "/homeb/eusmi01/eusmi0100/Programs/consscortk/lib/ANN_functions.py", line 324, in fit
_, c, p = self.sess.run([self.optimizer, self.cost, self.pred], feed_dict={self.x: batch_x, self.y: batch_y})
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 900, in run
run_metadata_ptr)
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1135, in _run
feed_dict_tensor, options, run_metadata)
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1316, in _do_run
run_metadata)
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1335, in _do_call
raise type(e)(node_def, op, message)
InvalidArgumentError: Expected size[0] in [0, 150], but got 300
[[Node: Slice = Slice[Index=DT_INT32, T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_Placeholder_1_0_1, Slice/begin, gradients/sub_grad/Shape_1)]]
Caused by op u'Slice', defined at:
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/scoop/_control.py", line 127, in runFuture
future.resultValue = future.callable(*future.args, **future.kargs)
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/runpy.py", line 252, in run_path
return _run_module_code(code, init_globals, run_name, path_name)
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/runpy.py", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/homeb/eusmi01/eusmi0100/Programs/consscortk/bin/deep-ScaffOpt.py", line 524, in <module>
serial_RF=False))
File "/homeb/eusmi01/eusmi0100/Programs/consscortk/bin/deep-ScaffOpt.py", line 189, in train_MLP
MLP = deepMetaPredictor().combinePredictors_datatypes(datasets, mat, serial_RF=serial_RF, META_ZCUTOFF=datasets.args.META_ZCUTOFF)
File "/homeb/eusmi01/eusmi0100/Programs/consscortk/lib/deepMetaPredictor.py", line 167, in combinePredictors_datatypes
random_state=datasets.random_state)
File "/homeb/eusmi01/eusmi0100/Programs/consscortk/lib/ANN_functions.py", line 235, in __init__
self.cost = tf_group_RMSE(self.y, self.pred, matrices.assaysize_vec, matrices.group_matrix) \
File "/homeb/eusmi01/eusmi0100/Programs/consscortk/lib/ConsScoreTK_Statistics.py", line 1261, in tf_group_RMSE
Y = tf.slice(Y, [0], [b_molnum])
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 650, in slice
return gen_array_ops._slice(input_, begin, size, name=name)
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/ops/gen_array_ops.py", line 7093, in _slice
"Slice", input=input, begin=begin, size=size, name=name)
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
op_def=op_def)
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1718, in __init__
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
InvalidArgumentError (see above for traceback): Expected size[0] in [0, 150], but got 300
[[Node: Slice = Slice[Index=DT_INT32, T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_Placeholder_1_0_1, Slice/begin, gradients/sub_grad/Shape_1)]]
Traceback (most recent call last):
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/scoop/bootstrap/__main__.py", line 302, in <module>
b.main()
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/scoop/bootstrap/__main__.py", line 92, in main
self.run()
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/scoop/bootstrap/__main__.py", line 290, in run
futures_startup()
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/scoop/bootstrap/__main__.py", line 271, in futures_startup
run_name="__main__"
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/scoop/futures.py", line 64, in _startup
result = _controller.switch(rootFuture, *args, **kargs)
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/scoop/_control.py", line 253, in runController
raise future.exceptionValue
tensorflow.python.framework.errors_impl.InvalidArgumentError: Expected size[0] in [0, 150], but got 300
[[Node: Slice = Slice[Index=DT_INT32, T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_Placeholder_1_0_1, Slice/begin, gradients/sub_grad/Shape_1)]]
Caused by op u'Slice', defined at:
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/scoop/_control.py", line 127, in runFuture
future.resultValue = future.callable(*future.args, **future.kargs)
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/runpy.py", line 252, in run_path
return _run_module_code(code, init_globals, run_name, path_name)
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/runpy.py", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/homeb/eusmi01/eusmi0100/Programs/consscortk/bin/deep-ScaffOpt.py", line 524, in <module>
serial_RF=False))
File "/homeb/eusmi01/eusmi0100/Programs/consscortk/bin/deep-ScaffOpt.py", line 189, in train_MLP
MLP = deepMetaPredictor().combinePredictors_datatypes(datasets, mat, serial_RF=serial_RF, META_ZCUTOFF=datasets.args.META_ZCUTOFF)
File "/homeb/eusmi01/eusmi0100/Programs/consscortk/lib/deepMetaPredictor.py", line 167, in combinePredictors_datatypes
random_state=datasets.random_state)
File "/homeb/eusmi01/eusmi0100/Programs/consscortk/lib/ANN_functions.py", line 235, in __init__
self.cost = tf_group_RMSE(self.y, self.pred, matrices.assaysize_vec, matrices.group_matrix) \
File "/homeb/eusmi01/eusmi0100/Programs/consscortk/lib/ConsScoreTK_Statistics.py", line 1261, in tf_group_RMSE
Y = tf.slice(Y, [0], [b_molnum])
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 650, in slice
return gen_array_ops._slice(input_, begin, size, name=name)
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/ops/gen_array_ops.py", line 7093, in _slice
"Slice", input=input, begin=begin, size=size, name=name)
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
op_def=op_def)
File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1718, in __init__
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
InvalidArgumentError (see above for traceback): Expected size[0] in [0, 150], but got 300
[[Node: Slice = Slice[Index=DT_INT32, T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_Placeholder_1_0_1, Slice/begin, gradients/sub_grad/Shape_1)]]
The version of Tensorflow that I use is 1.8.0. For the record, the same code works perfectly fine on my laptop where I have 1.4.0-dev version installed. Could anyone enlighten me about the source of the error?
I installed pytest-bdd at /home/marlu/.local using python setup.py install --user, since I don't have admin privileges. Both python2.7 and pytest are located at /usr/bin/. When I check if pytest-bdd is working correctly by running py.test --version I get an error, could anyone tell me why? Thanks!
Error output:
Traceback (most recent call last):
File "/usr/bin/py.test", line 9, in <module>
load_entry_point('pytest==2.7.0', 'console_scripts', 'py.test-2.7')()
File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 32, in main
config = _prepareconfig(args, plugins)
File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 85, in _prepareconfig
pluginmanager=pluginmanager, args=args)
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 521, in __call__
return self._docall(self.methods, kwargs)
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 528, in _docall
firstresult=self.firstresult).execute()
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 393, in execute
return wrapped_call(method(*args), self.execute)
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 109, in wrapped_call
wrap_controller.send(call_outcome)
File "/usr/lib/python2.7/site-packages/_pytest/helpconfig.py", line 28, in pytest_cmdline_parse
config = outcome.get_result()
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 138, in get_result
py.builtin._reraise(*ex)
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 123, in __init__
self.result = func()
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 394, in execute
res = method(*args)
File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 636, in pytest_cmdline_parse
self.parse(args)
File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 746, in parse
self._preparse(args)
File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 713, in _preparse
self.pluginmanager.consider_setuptools_entrypoints()
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 282, in consider_setuptools_entrypoints
self.register(plugin, name=name)
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 189, in register
reg(plugin, name) # may call addhooks
File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 604, in _register_plugin
{'pluginmanager': self.pluginmanager})
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 360, in call_plugin
kwargs=kwargs, firstresult=True).execute()
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 394, in execute
res = method(*args)
File "/home/marlu/.local/lib/python2.7/site-packages/pytest_bdd-2.17.0-py2.7.egg/pytest_bdd/plugin.py", line 15, in pytest_addhooks
from pytest_bdd import hooks
File "/home/marlu/.local/lib/python2.7/site-packages/pytest_bdd-2.17.0-py2.7.egg/pytest_bdd/hooks.py", line 38, in <module>
#pytest.hookspec(firstresult=True)
AttributeError: 'module' object has no attribute 'hookspec'
#pytest.hookspec was introduced in pytest 2.8, so you'd need to upgrade pytest, or downgrade pytest-bdd to 2.16.1. (Whoops, I was the one who broke 2.7 compatibility)
I am trying to install scrapy 0.24 in freebsd (MariaDB) system but when I try to run it I have an "keyError: 'z'" which I don't know what it means... I tried to debug it with no success.
File "/usr/local/bin/scrapy", line 9, in <module>
load_entry_point('Scrapy==0.24.4', 'console_scripts', 'scrapy')()
File "/usr/local/lib/python2.7/site-packages/scrapy/cmdline.py", line 143, in execute
_run_print_help(parser, _run_command, cmd, args, opts)
File "/usr/local/lib/python2.7/site-packages/scrapy/cmdline.py", line 89, in _run_print_help
func(*a, **kw)
File "/usr/local/lib/python2.7/site-packages/scrapy/cmdline.py", line 150, in _run_command
cmd.run(args, opts)
File "/usr/local/lib/python2.7/site-packages/scrapy/commands/crawl.py", line 60, in run
self.crawler_process.start()
File "/usr/local/lib/python2.7/site-packages/scrapy/crawler.py", line 92, in start
if self.start_crawling():
File "/usr/local/lib/python2.7/site-packages/scrapy/crawler.py", line 124, in start_crawling
return self._start_crawler() is not None
File "/usr/local/lib/python2.7/site-packages/scrapy/crawler.py", line 139, in _start_crawler
crawler.configure()
File "/usr/local/lib/python2.7/site-packages/scrapy/crawler.py", line 47, in configure
self.engine = ExecutionEngine(self, self._spider_closed)
File "/usr/local/lib/python2.7/site-packages/scrapy/core/engine.py", line 65, in __init__
self.scraper = Scraper(crawler)
File "/usr/local/lib/python2.7/site-packages/scrapy/core/scraper.py", line 66, in __init__
self.itemproc = itemproc_cls.from_crawler(crawler)
File "/usr/local/lib/python2.7/site-packages/scrapy/middleware.py", line 50, in from_crawler
return cls.from_settings(crawler.settings, crawler)
File "/usr/local/lib/python2.7/site-packages/scrapy/middleware.py", line 31, in from_settings
mw = mwcls.from_crawler(crawler)
File "/usr/local/lib/python2.7/site-packages/scrapy/contrib/pipeline/media.py", line 29, in from_crawler
pipe = cls.from_settings(crawler.settings)
File "/usr/local/lib/python2.7/site-packages/scrapy/contrib/pipeline/images.py", line 52, in from_settings
return cls(store_uri)
File "/usr/local/lib/python2.7/site-packages/scrapy/contrib/pipeline/files.py", line 150, in __init__
self.store = self._get_store(store_uri)
File "/usr/local/lib/python2.7/site-packages/scrapy/contrib/pipeline/files.py", line 170, in _get_store
store_cls = self.STORE_SCHEMES[scheme]
KeyError: 'z'
I'll try to install also scrapy 0.22 in freebsd just in case that could be the problem
Thanks a lot!!
I am using the flask-sqlalchemy extension with alembic for migrations. When I try to add a new migration file and upgrade the schema to the latest one, I get the following error:
AttributeError: 'int' object has no attribute '_compiler_dispatch'
The content of the migration file:
revision = 'ec2c2d40eb1'
down_revision = '28dda873b826'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.alter_column(
'users',
'wiki_permission',
new_column_name='wiki_group',
nullable=False,
existing_nullable=False,
type_=sa.Integer(),
existing_type=sa.Integer(),
server_default=1,
existing_server_default=1 # Line of error - 27
)
def downgrade():
op.alter_column(
'users',
'wiki_group',
new_column_name='wiki_permission',
nullable=False,
existing_nullable=False,
type_=sa.Integer(),
existing_type=sa.Integer(),
server_default=1,
existing_server_default=1
)
Thanks for taking time to help me.
Edit:
The complete error message :
INFO [alembic.migration] Context impl MySQLImpl.
INFO [alembic.migration] Will assume non-transactional DDL.
INFO [alembic.migration] Running upgrade 28dda873b826 -> ec2c2d40eb1, users change column wiki_permission to wiki_group
Traceback (most recent call last):
File "/home/kevin/Code/python/flask/terminus/venv/bin/alembic", line 9, in <module>
load_entry_point('alembic==0.6.5', 'console_scripts', 'alembic')()
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/config.py", line 298, in main
CommandLine(prog=prog).main(argv=argv)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/config.py", line 293, in main
self.run_cmd(cfg, options)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/config.py", line 279, in run_cmd
**dict((k, getattr(options, k)) for k in kwarg)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/command.py", line 125, in upgrade
script.run_env()
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/script.py", line 203, in run_env
util.load_python_file(self.dir, 'env.py')
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/util.py", line 212, in load_python_file
module = load_module_py(module_id, path)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/compat.py", line 58, in load_module_py
mod = imp.load_source(module_id, path, fp)
File "alembic/env.py", line 77, in <module>
run_migrations_online()
File "alembic/env.py", line 70, in run_migrations_online
context.run_migrations()
File "<string>", line 7, in run_migrations
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/environment.py", line 688, in run_migrations
self.get_context().run_migrations(**kw)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/migration.py", line 258, in run_migrations
change(**kw)
File "alembic/versions/ec2c2d40eb1_users_change_column_wiki_permission_to_.py", line 27, in upgrade
existing_server_default=1,
File "<string>", line 7, in alter_column
File "<string>", line 1, in <lambda>
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/util.py", line 329, in go
return fn(*arg, **kw)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/operations.py", line 317, in alter_column
existing_autoincrement=existing_autoincrement
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/ddl/mysql.py", line 44, in alter_column
else existing_autoincrement
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/ddl/impl.py", line 76, in _exec
conn.execute(construct, *multiparams, **params)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 720, in execute
return meth(self, multiparams, params)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 67, in _execute_on_connection
return connection._execute_ddl(self, multiparams, params)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 768, in _execute_ddl
compiled = ddl.compile(dialect=dialect)
File "<string>", line 1, in <lambda>
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 468, in compile
return self._compiler(dialect, bind=bind, **kw)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 25, in _compiler
return dialect.ddl_compiler(dialect, self, **kw)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 197, in __init__
self.string = self.process(self.statement, **compile_kwargs)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 220, in process
return obj._compiler_dispatch(self, **kwargs)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/ext/compiler.py", line 410, in <lambda>
lambda *arg, **kw: existing(*arg, **kw))
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/ext/compiler.py", line 448, in __call__
return fn(element, compiler, **kw)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/ddl/mysql.py", line 171, in _mysql_change_column
autoincrement=element.autoincrement
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/ddl/mysql.py", line 190, in _mysql_colspec
spec += " DEFAULT %s" % _render_value(compiler, server_default)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/ddl/mysql.py", line 179, in _render_value
return compiler.sql_compiler.process(expr)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 220, in process
return obj._compiler_dispatch(self, **kwargs)
AttributeError: 'int' object has no attribute '_compiler_dispatch'
Alright, I just went through this same issue. I'm not using flask-sqlalchemy, just straight alembic, but it should be identical.
Second, it worked for me with sa.Integer with no parentheses, so I would recommend that.
The alembic docs say:
When producing MySQL-compatible migration files, it is recommended that the existing_type, existing_server_default, and existing_nullable parameters be present, if not being altered.
Since it seems you are not altering these columns, the docs suggest they should be present. So:
Remove nullable, type_, and server_default. They are not being altered.
Keep existing_nullable, existing_type, and existing_server_default.