django-plotly-dash
django-plotly-dash copied to clipboard
Getting exception on demo
Hi there,
I tried to run the demo by following the instructions, but get the following error:
Exception inside application: __init__() takes 1 positional argument but 2 were given
Traceback (most recent call last):
File "/Users/oege/projects/django-plotly-dash/env/lib/python3.8/site-packages/channels/routing.py", line 71, in __call__
return await application(scope, receive, send)
File "/Users/oege/projects/django-plotly-dash/env/lib/python3.8/site-packages/channels/sessions.py", line 47, in __call__
return await self.inner(dict(scope, cookies=cookies), receive, send)
File "/Users/oege/projects/django-plotly-dash/env/lib/python3.8/site-packages/channels/sessions.py", line 254, in __call__
return await self.inner(wrapper.scope, receive, wrapper.send)
File "/Users/oege/projects/django-plotly-dash/env/lib/python3.8/site-packages/channels/auth.py", line 181, in __call__
return await super().__call__(scope, receive, send)
File "/Users/oege/projects/django-plotly-dash/env/lib/python3.8/site-packages/channels/middleware.py", line 26, in __call__
return await self.inner(scope, receive, send)
File "/Users/oege/projects/django-plotly-dash/env/lib/python3.8/site-packages/channels/routing.py", line 150, in __call__
return await application(
File "/Users/oege/projects/django-plotly-dash/env/lib/python3.8/site-packages/asgiref/compatibility.py", line 33, in new_application
instance = application(scope)
TypeError: __init__() takes 1 positional argument but 2 were given
I did make the venv
with python -m venv env
instead of using virtualenv
and am using python3.8
instead of python3.6
. But don't think that should have caused the error?
The first thing to check is if there has been a change in one of the underlying packages that is not backwards compatible. Are you able to share the versions used of the packages (eg the output of pip freeze
in this virtual environment).
sure:
(also this is on a mac with python 3.8.5)
appdirs==1.4.4
appnope==0.1.0
argon2-cffi==20.1.0
async-generator==1.10
attrs==20.2.0
backcall==0.2.0
bleach==3.2.1
cffi==1.14.3
click==7.1.2
dash==1.17.0
dash-core-components==1.13.0
dash-html-components==1.1.1
dash-renderer==1.8.3
decorator==4.4.2
defusedxml==0.6.0
dill==0.3.3
distlib==0.3.1
Django==3.1.3
-e git+https://github.com/GibbsConsulting/django-plotly-dash.git@5f2ec2345bef39e5f045964fd9ddefb8c596cc13#egg=django_plotly_dash
dpd-components==0.1.0
entrypoints==0.3
filelock==3.0.12
Flask==1.1.2
ipykernel==5.3.4
ipython==7.18.1
ipython-genutils==0.2.0
ipywidgets==7.5.1
itsdangerous==2.0.0a1
jedi==0.17.2
Jinja2==2.11.2
jsonschema==3.2.0
jupyter==1.0.0
jupyter-client==6.1.7
jupyter-console==6.2.0
jupyter-core==4.6.3
jupyterlab-pygments==0.1.2
MarkupSafe==1.1.1
mistune==0.8.4
nbclient==0.5.0
nbconvert==6.0.7
nbformat==5.0.8
nest-asyncio==1.4.1
notebook==6.1.4
packaging==20.4
pandocfilters==1.4.2
parso==0.7.1
pexpect==4.8.0
pickleshare==0.7.5
pip-tools==5.3.1
plotly==4.12.0
prometheus-client==0.8.0
prompt-toolkit==3.0.8
ptyprocess==0.6.0
pycparser==2.20
Pygments==2.7.1
pyparsing==2.4.7
pyrsistent==0.17.3
python-dateutil==2.8.1
pytz==2020.4
pyzmq==19.0.2
qtconsole==4.7.7
QtPy==1.9.0
Send2Trash==1.5.0
six==1.15.0
sqlparse==0.4.1
terminado==0.9.1
testpath==0.4.4
tornado==6.0.4
traitlets==5.0.5
virtualenv==20.1.0
wcwidth==0.2.5
webencodings==0.5.1
Werkzeug==1.0.1
widgetsnbextension==3.5.1
Hi there,
exactly the same for me:
- Traceback
HTTP GET / 500 [0.07, 127.0.0.1:63774]
Exception inside application: __init__() takes 1 positional argument but 2 were given
Traceback (most recent call last):
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\channels\staticfiles.py", line 44, in __call__
return await self.application(scope, receive, send)
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\channels\routing.py", line 71, in __call__
return await application(scope, receive, send)
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\channels\sessions.py", line 47, in __call__
return await self.inner(dict(scope, cookies=cookies), receive, send)
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\channels\sessions.py", line 254, in __call__
return await self.inner(wrapper.scope, receive, wrapper.send)
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\channels\auth.py", line 181, in __call__
return await super().__call__(scope, receive, send)
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\channels\middleware.py", line 26, in __call__
return await self.inner(scope, receive, send)
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\channels\routing.py", line 150, in __call__
return await application(
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\asgiref\compatibility.py", line 33, in new_application
instance = application(scope)
TypeError: __init__() takes 1 positional argument but 2 were given
- Environment Python 3.8.2 Windows 10
-- pip freeze
asgiref==3.3.1
attrs==20.3.0
autobahn==20.7.1
Automat==20.2.0
beautifulsoup4==4.9.3
Brotli==1.0.9
cffi==1.14.3
channels==3.0.2
click==7.1.2
constantly==15.1.0
cryptography==3.2.1
daphne==3.0.1
dash==1.17.0
dash-bootstrap-components==0.10.7
dash-core-components==1.13.0
dash-html-components==1.1.1
dash-renderer==1.8.3
dash-table==4.11.0
Django==3.1.3
django-bootstrap4==2.3.1
django-plotly-dash==1.4.2
dpd-components==0.1.0
dpd-static-support==0.0.5
Flask==1.1.2
Flask-Compress==1.8.0
future==0.18.2
hyperlink==20.0.1
idna==2.10
incremental==17.5.0
itsdangerous==1.1.0
Jinja2==2.11.2
MarkupSafe==1.1.1
numpy==1.19.4
pandas==1.1.4
plotly==4.12.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
PyHamcrest==2.0.2
pyOpenSSL==19.1.0
python-dateutil==2.8.1
pytz==2020.4
retrying==1.3.3
service-identity==18.1.0
six==1.15.0
soupsieve==2.0.1
sqlparse==0.4.1
Twisted @ file:///D:/projekte/11_github/django_test/Twisted-20.3.0-cp38-cp38-win_amd64.whl
txaio==20.4.1
Werkzeug==1.0.1
zope.interface==5.2.0
@oegedijk @squeezer44 this looks like it is happening due to a change in an underlying package. #290 is probably the same issue and has a workaround - ie dont use the channels package or the asynchronous features it provides. Another workaround would be to use an earlier version.
I uninstalled the moduls channels and reran manage.py runserver
.
Problem: The entire package didn't run and I don't know which dependency is related to the module channels. Could be it's related to bootstrap.
What do you suggest how to go ahead?
Traceback
Exception in thread django-main-thread:
Traceback (most recent call last):
File "E:\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "E:\Python\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\core\management\commands\runserver.py", line 110, in inner_run
autoreload.raise_last_exception()
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\utils\autoreload.py", line 76, in raise_last_exception
raise _exception[1]
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\core\management\__init__.py", line 357, in execute
autoreload.check_errors(django.setup)()
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\apps\config.py", line 90, in create
module = import_module(entry)
File "E:\Python\Python38\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 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'channels'
Traceback (most recent call last):
File "D:\projekte\11_github\django_test\demo\manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\core\management\__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\core\management\base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\core\management\commands\runserver.py", line 61, in execute
super().execute(*args, **options)
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\core\management\base.py", line 371, in execute
output = self.handle(*args, **options)
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\core\management\commands\runserver.py", line 96, in handle
self.run(**options)
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\core\management\commands\runserver.py", line 103, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\utils\autoreload.py", line 614, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\utils\autoreload.py", line 599, in start_django
reloader.run(django_main_thread)
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\utils\autoreload.py", line 314, in run
self.run_loop()
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\utils\autoreload.py", line 320, in run_loop
next(ticker)
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\utils\autoreload.py", line 360, in tick
for filepath, mtime in self.snapshot_files():
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\utils\autoreload.py", line 376, in snapshot_files
for file in self.watched_files():
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\utils\autoreload.py", line 274, in watched_files
yield from iter_all_python_module_files()
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\utils\autoreload.py", line 105, in iter_all_python_module_files
return iter_modules_and_files(modules, frozenset(_error_files))
File "D:\projekte\11_github\django_test\venv_django\lib\site-packages\django\utils\autoreload.py", line 141, in iter_modules_and_files
resolved_path = path.resolve(strict=True).absolute()
File "E:\Python\Python38\lib\pathlib.py", line 1172, in resolve
s = self._flavour.resolve(self, strict=strict)
File "E:\Python\Python38\lib\pathlib.py", line 200, in resolve
return self._ext_to_normal(_getfinalpathname(s))
@squeezer44 Same problem, but channels package even was not installed with ./make_env (i also replased virtualenv with venv)
@oegedijk @squeezer44 @DanInSpace104 v1.5.0 just released, should solve this problem by requiring channels < 3.0
@GibbsConsulting Thx a lot for v 1.5.0. - my previous error (https://github.com/GibbsConsulting/django-plotly-dash/issues/289#issuecomment-731409785) disappeared.
I've just cloned this repo and covered your requirements.txt in my venv:
dash>=1.11
dash-core-components
dash-html-components
dash-renderer
plotly
dpd-components
dash-bootstrap-components
channels<3.0
Django>=2.2
Flask>=1.0.2
After that I ran \demo>manage.py runserver
and noticed those 3 Python modules were missed inside my local venv:
ModuleNotFoundError: No module named 'bootstrap4'
ModuleNotFoundError: No module named 'dpd_static_support'
ModuleNotFoundError: No module named 'pandas'
Maybe it seems to be a good idea to add them in your requirements.txt.
After I installed them in my venv and ran \demo>manage.py runserver
this error occured in your dash_wrapper :
File "D:\projekte\11_github\wurst\venv_wurst\lib\site-packages\django_plotly_dash\dash_wrapper.py", line 193, in __init__
from bootstrap4.bootstrap import css_url
ModuleNotFoundError: No module named 'bootstrap4.bootstrap'
@squeezer44 good to hear that this resolves the issue.
As for the requirements, they are for using the package itself - to install and run the demo application you need to follow the instructions here which will amongst other things pull in the packages in dev_requirements.txt
@GibbsConsulting Thank's a lot!
@GibbsConsulting Thx a lot for v 1.5.0. - my previous error (#289 (comment)) disappeared.
I've just cloned this repo and covered your requirements.txt in my venv:
dash>=1.11 dash-core-components dash-html-components dash-renderer plotly dpd-components dash-bootstrap-components channels<3.0 Django>=2.2 Flask>=1.0.2
After that I ran
\demo>manage.py runserver
and noticed those 3 Python modules were missed inside my local venv:ModuleNotFoundError: No module named 'bootstrap4' ModuleNotFoundError: No module named 'dpd_static_support' ModuleNotFoundError: No module named 'pandas'
Maybe it seems to be a good idea to add them in your requirements.txt.
After I installed them in my venv and ran
\demo>manage.py runserver
this error occured in your dash_wrapper :File "D:\projekte\11_github\wurst\venv_wurst\lib\site-packages\django_plotly_dash\dash_wrapper.py", line 193, in __init__ from bootstrap4.bootstrap import css_url ModuleNotFoundError: No module named 'bootstrap4.bootstrap'
I too am getting this error after installing 'bootstrap4', 'dpd_static_support' and 'pandas' upon running manage.py runserver
:
File "D:\projekte\11_github\wurst\venv_wurst\lib\site-packages\django_plotly_dash\dash_wrapper.py", line 193, in __init__
from bootstrap4.bootstrap import css_url
ModuleNotFoundError: No module named 'bootstrap4.bootstrap'
@dalmouiee as per above, did you follow the installation instructions?
@GibbsConsulting, I was attempting to make a virtual environment using venv
rather than virtualenv
. That was the issue, thanks for your help, and great repo by the way!