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

[Bug]: application cannot start. from towhee import AutoPipes crashes #2674

Closed
1 task done
dove-young opened this issue Nov 20, 2023 · 4 comments
Closed
1 task done
Assignees
Labels
kind/bug Issues or changes related a bug needs-triage Issues needs triage stale

Comments

@dove-young
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

application cannot start. from towhee import AutoPipes crashes

 python towhee-test.py
Traceback (most recent call last):
  File "/root/jupyter/instana-slack-app-dev/towhee-test.py", line 1, in <module>
    from towhee import AutoPipes
  File "/root/jupyter/virtualenv/slack-dev-3.10/lib/python3.10/site-packages/towhee/__init__.py", line 20, in <module>
    from towhee.runtime import register, pipe, ops, accelerate, AutoConfig, AutoPipes
  File "/root/jupyter/virtualenv/slack-dev-3.10/lib/python3.10/site-packages/towhee/runtime/__init__.py", line 17, in <module>
    from .pipeline import Pipeline as pipe
  File "/root/jupyter/virtualenv/slack-dev-3.10/lib/python3.10/site-packages/towhee/runtime/pipeline.py", line 18, in <module>
    from towhee.runtime.check_utils import TupleForm
  File "/root/jupyter/virtualenv/slack-dev-3.10/lib/python3.10/site-packages/towhee/runtime/check_utils.py", line 36, in <module>
    class TupleForm(BaseModel):
  File "/root/jupyter/virtualenv/slack-dev-3.10/lib/python3.10/site-packages/towhee/runtime/check_utils.py", line 38, in TupleForm
    schema_data: Optional[Tuple[constr(regex='^[a-z][a-z0-9_]*$'), ...]]
TypeError: constr() got an unexpected keyword argument 'regex'

Expected Behavior

application runs

Steps To Reproduce

1. in Python 3.10 env
2. `pip install towhee pydantic_core`
3. run a python script with `from towhee import AutoPipes`
4. see error


pip list | grep pydantic
pydantic                 1.10.13
pydantic_core            2.14.4


### Environment

```markdown
- Towhee version(e.g. v0.1.3 or 8b23a93): 1.1.2
- OS(Ubuntu or CentOS): RHEL 8
- CPU/Memory: 8 CPU 32G Memory
- GPU:
- Others: Python 3.10

Anything else?

And actually after install with pip install towhee towhee.models, it does not run.

Traceback (most recent call last):
  File "/root/jupyter/instana-slack-app-dev/towhee-test.py", line 1, in <module>
    from towhee import AutoPipes
  File "/root/jupyter/virtualenv/slack-dev-3.10-bug/lib/python3.10/site-packages/towhee/__init__.py", line 20, in <module>
    from towhee.runtime import register, pipe, ops, accelerate, AutoConfig, AutoPipes
  File "/root/jupyter/virtualenv/slack-dev-3.10-bug/lib/python3.10/site-packages/towhee/runtime/__init__.py", line 17, in <module>
    from .pipeline import Pipeline as pipe
  File "/root/jupyter/virtualenv/slack-dev-3.10-bug/lib/python3.10/site-packages/towhee/runtime/pipeline.py", line 18, in <module>
    from towhee.runtime.check_utils import TupleForm
  File "/root/jupyter/virtualenv/slack-dev-3.10-bug/lib/python3.10/site-packages/towhee/runtime/check_utils.py", line 16, in <module>
    from pydantic import BaseModel, constr, validator
  File "/root/jupyter/pydantic/pydantic/__init__.py", line 370, in __getattr__
    module = import_module(module_name, package=package)
  File "/opt/python-3.10.12/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/root/jupyter/pydantic/pydantic/main.py", line 11, in <module>
    import pydantic_core

after install pydantic_core

pip install pydantic_core
Collecting pydantic_core
  Using cached pydantic_core-2.14.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.5 kB)
Requirement already satisfied: typing-extensions!=4.7.0,>=4.6.0 in ./slack-dev-3.10-bug/lib/python3.10/site-packages (from pydantic_core) (4.8.0)
Using cached pydantic_core-2.14.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB)
Installing collected packages: pydantic_core
Successfully installed pydantic_core-2.14.4

it failed at

Traceback (most recent call last):
  File "/root/jupyter/instana-slack-app-dev/towhee-test.py", line 1, in <module>
    from towhee import AutoPipes
  File "/root/jupyter/virtualenv/slack-dev-3.10-bug/lib/python3.10/site-packages/towhee/__init__.py", line 20, in <module>
    from towhee.runtime import register, pipe, ops, accelerate, AutoConfig, AutoPipes
  File "/root/jupyter/virtualenv/slack-dev-3.10-bug/lib/python3.10/site-packages/towhee/runtime/__init__.py", line 17, in <module>
    from .pipeline import Pipeline as pipe
  File "/root/jupyter/virtualenv/slack-dev-3.10-bug/lib/python3.10/site-packages/towhee/runtime/pipeline.py", line 18, in <module>
    from towhee.runtime.check_utils import TupleForm
  File "/root/jupyter/virtualenv/slack-dev-3.10-bug/lib/python3.10/site-packages/towhee/runtime/check_utils.py", line 16, in <module>
    from pydantic import BaseModel, constr, validator
  File "/root/jupyter/pydantic/pydantic/__init__.py", line 370, in __getattr__
    module = import_module(module_name, package=package)
  File "/opt/python-3.10.12/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/root/jupyter/pydantic/pydantic/types.py", line 28, in <module>
    import annotated_types
ModuleNotFoundError: No module named 'annotated_types'

after installed 'annotated_types', it failed at the TypeError: constr() got an unexpected keyword argument 'regex' error.

@dove-young dove-young added kind/bug Issues or changes related a bug needs-triage Issues needs triage labels Nov 20, 2023
@dove-young
Copy link
Author

dove-young commented Nov 20, 2023

In latest version of pydantic, the param regex is removed.

grep -A 10 'def constr' /root/jupyter/virtualenv/slack-dev-3.10/lib/python3.10/site-packages/pydantic/types.py
def constr(
    *,
    strip_whitespace: bool | None = None,
    to_upper: bool | None = None,
    to_lower: bool | None = None,
    strict: bool | None = None,
    min_length: int | None = None,
    max_length: int | None = None,
    pattern: str | None = None,
) -> type[str]:
    """
pydantic                 2.5.1
pydantic_core            2.14.3

@dove-young
Copy link
Author

Here is a PR for this issue #2675

@junjiejiangjjj
Copy link
Contributor

#2678

Copy link

stale bot commented Jan 2, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Rotten issues close after 30d of inactivity. Close the stale issues and pull requests after 7 days of inactivity. Reopen the issue with /reopen.

@stale stale bot added the stale label Jan 2, 2024
@stale stale bot closed this as completed Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Issues or changes related a bug needs-triage Issues needs triage stale
Projects
None yet
Development

No branches or pull requests

3 participants