Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rasa init breaks on Windows/Mac/Ubuntu due to CompositionView in Sanic. #10585

Closed
koaning opened this issue Dec 27, 2021 · 11 comments
Closed

Rasa init breaks on Windows/Mac/Ubuntu due to CompositionView in Sanic. #10585

koaning opened this issue Dec 27, 2021 · 11 comments
Labels
area:rasa-oss 🎡 Anything related to the open source Rasa framework

Comments

@koaning
Copy link
Contributor

koaning commented Dec 27, 2021

Just got notified from my Rasa install Cron. It seems on Monday 27th Dec 2021 all of the rasa init calls break. Here's the traceback:

> python -m rasa init --no-prompt
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/rasa/__main__.py", line 14, in <module>
    from rasa.cli import (
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/rasa/cli/export.py", line 9, in <module>
    import rasa.core.utils
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/rasa/core/utils.py", line 25, in <module>
    from sanic.views import CompositionView
ImportError: cannot import name 'CompositionView' from 'sanic.views' (/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/sanic/views.py)

I can also confirm on pypi that Sanic just released a new version (v21.12.0) on the 26th.

@koaning
Copy link
Contributor Author

koaning commented Dec 27, 2021

From the release notes I can confirm that the CompositionView has indeed been deprecated.

The short term solution is to ensure Rasa does not use this version of Sanic, a longer-term solution would involve us removing the view from Rasa.

@afzalmushtaque
Copy link

pip install sanic==21.9.3 works for now...

@koaning
Copy link
Contributor Author

koaning commented Dec 27, 2021

Bit of a side-track. I've noticed that this error is also raised when I'm running the train command. The traceback is interesting though.

Traceback:
/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_featurizers/test_sparse_tfidf.py:9: in <module>
    from rasa.nlu.tokenizers.whitespace_tokenizer import WhitespaceTokenizer
/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/rasa/nlu/tokenizers/whitespace_tokenizer.py:10: in <module>
    from rasa.engine.recipes.default_recipe import DefaultV1Recipe
/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/rasa/engine/recipes/default_recipe.py:24: in <module>
    from rasa.engine.constants import (
/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/rasa/engine/constants.py:3: in <module>
    from rasa.core.channels import UserMessage
/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/rasa/core/channels/__init__.py:15: in <module>
    from rasa.core.channels.console import CmdlineInput  # noqa: F401
/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/rasa/core/channels/console.py:17: in <module>
    from rasa.core import utils
/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/rasa/core/utils.py:25: in <module>
    from sanic.views import CompositionView
E   ImportError: cannot import name 'CompositionView' from 'sanic.views' 

It seems that when we're importing the WhitespaceTokenizer we're eventually depending on sanic. That feels a bit strange, why is the machine learning pipeline depending on a web-serving framework?

@Akilankm
Copy link

I also had the same problem, using specific version of sanic did the trick for me...
pip install sanic==21.9.3

@afzalmushtaque
Copy link

Bit of a side-track. I've noticed that this error is also raised when I'm running the train command. The traceback is interesting though.

Traceback:
/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_featurizers/test_sparse_tfidf.py:9: in <module>
    from rasa.nlu.tokenizers.whitespace_tokenizer import WhitespaceTokenizer
/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/rasa/nlu/tokenizers/whitespace_tokenizer.py:10: in <module>
    from rasa.engine.recipes.default_recipe import DefaultV1Recipe
/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/rasa/engine/recipes/default_recipe.py:24: in <module>
    from rasa.engine.constants import (
/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/rasa/engine/constants.py:3: in <module>
    from rasa.core.channels import UserMessage
/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/rasa/core/channels/__init__.py:15: in <module>
    from rasa.core.channels.console import CmdlineInput  # noqa: F401
/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/rasa/core/channels/console.py:17: in <module>
    from rasa.core import utils
/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/rasa/core/utils.py:25: in <module>
    from sanic.views import CompositionView
E   ImportError: cannot import name 'CompositionView' from 'sanic.views' 

It seems that when we're importing the WhitespaceTokenizer we're eventually depending on sanic. That feels a bit strange, why is the machine learning pipeline depending on a web-serving framework?

The list_routes function probably belongs in rasa.utils rather than rasa.core.utils...

@jonra1993
Copy link

jonra1993 commented Dec 27, 2021

I have the same error. I have installed rasa 3.0.4 and tried to create a new rasa project using. For now Rasa CLI is broken due to no commands work.

poetry add "rasa[full]"
rasa init

image

@ahopkins
Copy link

Composition View was deprecated since v21.6 and removed in v21.12 as stated above.
https://sanicframework.org/en/guide/release-notes/v21.6.html#deprecation-of-compositionview

@disfeng
Copy link

disfeng commented Dec 30, 2021

pip install sanic==21.9.3 works for now...

It's work!

@koaning koaning added the area:rasa-oss 🎡 Anything related to the open source Rasa framework label Jan 3, 2022
@AbhijeetGavali
Copy link

AbhijeetGavali commented Jan 3, 2022

it's not working when I try to deploy it on heroku

Could not find a version that satisfies the requirement sanic==21.9.3 (from versions: 0.1.0, 0.1.1, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.3.0, 0.3.1, 0.4.0, 0.4.1, 0.5.0, 0.5.1, 0.5.2, 0.5.4, 0.6.0, 0.7.0, 0.8.0, 0.8.1, 0.8.2, 0.8.3, 18.12.0, 19.3.1, 19.6.0, 19.6.2, 19.6.3, 19.9.0, 19.12.0, 19.12.2, 19.12.3, 19.12.4, 19.12.5, 20.3.0, 20.6.0, 20.6.1, 20.6.2, 20.6.3, 20.9.0, 20.9.1, 20.12.0, 20.12.1, 20.12.2, 20.12.3, 20.12.4)
ERROR: No matching distribution found for sanic==21.9.3
The command '/bin/sh -c apt-get update && apt-get install -y python3 python3-pip && python3 -m pip install --no-cache --upgrade pip && pip3 install --no-cache rasa && pip install sanic==21.9.3' returned a non-zero code: 1

what should I suppose to do?

@ahopkins
Copy link

ahopkins commented Jan 3, 2022

Looks like there already is a PR to fix this: #10590

@m-vdb
Copy link
Collaborator

m-vdb commented Mar 14, 2022

This is now fixed in Rasa 3.0.9 🎉

@m-vdb m-vdb closed this as completed Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:rasa-oss 🎡 Anything related to the open source Rasa framework
Projects
None yet
Development

No branches or pull requests

8 participants