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] swarms_models not found #660

Closed
evelynmitchell opened this issue Dec 4, 2024 · 5 comments
Closed

[BUG] swarms_models not found #660

evelynmitchell opened this issue Dec 4, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@evelynmitchell
Copy link
Contributor

evelynmitchell commented Dec 4, 2024

Describe the bug

ModuleNotFoundError                       Traceback (most recent call last)
[<ipython-input-4-14444884eff9>](https://localhost:8080/#) in <cell line: 1>()
----> 1 from swarms import Agent
      2 
      3 agent = Agent(
      4     agent_name="Stock-Analysis-Agent",
      5     model_name="gpt-4o-mini",

6 frames
[/usr/local/lib/python3.10/dist-packages/swarms/__init__.py](https://localhost:8080/#) in <module>
     11 
     12 # Import telemetry functions with error handling
---> 13 from swarms.telemetry.bootup import bootup  # noqa: E402, F403
     14 from swarms.telemetry.sentry_active import (  # noqa: E402
     15     activate_sentry,

[/usr/local/lib/python3.10/dist-packages/swarms/telemetry/bootup.py](https://localhost:8080/#) in <module>
      4 from concurrent.futures import ThreadPoolExecutor
      5 
----> 6 from swarms.telemetry.auto_upgrade_swarms import auto_update
      7 from swarms.utils.disable_logging import disable_logging
      8 

[/usr/local/lib/python3.10/dist-packages/swarms/telemetry/auto_upgrade_swarms.py](https://localhost:8080/#) in <module>
      2 import subprocess
      3 
----> 4 from swarms.utils.loguru_logger import initialize_logger
      5 from swarms.telemetry.check_update import check_for_update
      6 

[/usr/local/lib/python3.10/dist-packages/swarms/utils/__init__.py](https://localhost:8080/#) in <module>
     14 )
     15 from swarms.utils.markdown_message import display_markdown_message
---> 16 from swarms.tools.prebuilt.math_eval import math_eval
     17 from swarms.utils.parse_code import extract_code_from_markdown
     18 from swarms.utils.pdf_to_text import pdf_to_text

[/usr/local/lib/python3.10/dist-packages/swarms/tools/__init__.py](https://localhost:8080/#) in <module>
     23 from swarms.tools.openai_tool_creator_decorator import tool
     24 from swarms.tools.base_tool import BaseTool
---> 25 from swarms.tools.prebuilt import *  # noqa: F403
     26 from swarms.tools.cohere_func_call_schema import (
     27     CohereFuncSchema,

[/usr/local/lib/python3.10/dist-packages/swarms/tools/prebuilt/__init__.py](https://localhost:8080/#) in <module>
      1 from swarms.tools.prebuilt.math_eval import math_eval
----> 2 from swarms.tools.prebuilt.code_executor import CodeExecutor
      3 
      4 __all__ = [
      5     "math_eval",

[/usr/local/lib/python3.10/dist-packages/swarms/tools/prebuilt/code_executor.py](https://localhost:8080/#) in <module>
      2 import subprocess
      3 from loguru import logger
----> 4 from swarm_models.tiktoken_wrapper import TikTokenizer
      5 
      6 

ModuleNotFoundError: No module named 'swarm_models'

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------```

<!-- POLAR PLEDGE BADGE START -->
## Upvote & Fund

- We're using [Polar.sh](https://polar.sh/kyegomez) so you can upvote and help fund this issue.
- We receive the funding once the issue is completed & confirmed by you.
- Thank you in advance for helping prioritize & fund our backlog.

<a href="https://polar.sh/kyegomez/swarms/issues/660">
<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://polar.sh/api/github/kyegomez/swarms/issues/660/pledge.svg?darkmode=1">
  <img alt="Fund with Polar" src="https://polar.sh/api/github/kyegomez/swarms/issues/660/pledge.svg">
</picture>
</a>
<!-- POLAR PLEDGE BADGE END -->
@evelynmitchell evelynmitchell added the bug Something isn't working label Dec 4, 2024
@evelynmitchell
Copy link
Contributor Author

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
[<ipython-input-5-14444884eff9>](https://localhost:8080/#) in <cell line: 1>()
----> 1 from swarms import Agent
      2 
      3 agent = Agent(
      4     agent_name="Stock-Analysis-Agent",
      5     model_name="gpt-4o-mini",

16 frames
[/usr/local/lib/python3.10/dist-packages/swarms/__init__.py](https://localhost:8080/#) in <module>
     11 
     12 # Import telemetry functions with error handling
---> 13 from swarms.telemetry.bootup import bootup  # noqa: E402, F403
     14 from swarms.telemetry.sentry_active import (  # noqa: E402
     15     activate_sentry,

[/usr/local/lib/python3.10/dist-packages/swarms/telemetry/bootup.py](https://localhost:8080/#) in <module>
      4 from concurrent.futures import ThreadPoolExecutor
      5 
----> 6 from swarms.telemetry.auto_upgrade_swarms import auto_update
      7 from swarms.utils.disable_logging import disable_logging
      8 

[/usr/local/lib/python3.10/dist-packages/swarms/telemetry/auto_upgrade_swarms.py](https://localhost:8080/#) in <module>
      2 import subprocess
      3 
----> 4 from swarms.utils.loguru_logger import initialize_logger
      5 from swarms.telemetry.check_update import check_for_update
      6 

[/usr/local/lib/python3.10/dist-packages/swarms/utils/__init__.py](https://localhost:8080/#) in <module>
     14 )
     15 from swarms.utils.markdown_message import display_markdown_message
---> 16 from swarms.tools.prebuilt.math_eval import math_eval
     17 from swarms.utils.parse_code import extract_code_from_markdown
     18 from swarms.utils.pdf_to_text import pdf_to_text

[/usr/local/lib/python3.10/dist-packages/swarms/tools/__init__.py](https://localhost:8080/#) in <module>
     23 from swarms.tools.openai_tool_creator_decorator import tool
     24 from swarms.tools.base_tool import BaseTool
---> 25 from swarms.tools.prebuilt import *  # noqa: F403
     26 from swarms.tools.cohere_func_call_schema import (
     27     CohereFuncSchema,

[/usr/local/lib/python3.10/dist-packages/swarms/tools/prebuilt/__init__.py](https://localhost:8080/#) in <module>
      1 from swarms.tools.prebuilt.math_eval import math_eval
----> 2 from swarms.tools.prebuilt.code_executor import CodeExecutor
      3 
      4 __all__ = [
      5     "math_eval",

[/usr/local/lib/python3.10/dist-packages/swarms/tools/prebuilt/code_executor.py](https://localhost:8080/#) in <module>
      2 import subprocess
      3 from loguru import logger
----> 4 from swarm_models.tiktoken_wrapper import TikTokenizer
      5 
      6 

[/usr/local/lib/python3.10/dist-packages/swarm_models/__init__.py](https://localhost:8080/#) in <module>
     40 from swarm_models.utils import *  # NOQA
     41 # from swarm_models.together_llm import TogetherLLM
---> 42 from swarm_models.lite_llm_model import LiteLLM
     43 from swarm_models.tiktoken_wrapper import TikTokenizer
     44 

[/usr/local/lib/python3.10/dist-packages/swarm_models/lite_llm_model.py](https://localhost:8080/#) in <module>
----> 1 from litellm import completion, acompletion
      2 from loguru import logger
      3 
      4 
      5 class LiteLLM:

[/usr/local/lib/python3.10/dist-packages/litellm/__init__.py](https://localhost:8080/#) in <module>
     24 )
     25 from litellm.types.guardrails import GuardrailItem
---> 26 from litellm.proxy._types import (
     27     KeyManagementSystem,
     28     KeyManagementSettings,

[/usr/local/lib/python3.10/dist-packages/litellm/proxy/_types.py](https://localhost:8080/#) in <module>
     13 
     14 from litellm.types.integrations.slack_alerting import AlertType
---> 15 from litellm.types.router import RouterErrors, UpdateRouterConfig
     16 from litellm.types.utils import (
     17     EmbeddingResponse,

[/usr/local/lib/python3.10/dist-packages/litellm/types/router.py](https://localhost:8080/#) in <module>
     13 
     14 from ..exceptions import RateLimitError
---> 15 from .completion import CompletionRequest
     16 from .embedding import EmbeddingRequest
     17 from .utils import ModelResponse

[/usr/local/lib/python3.10/dist-packages/litellm/types/completion.py](https://localhost:8080/#) in <module>
      1 from typing import Iterable, List, Optional, Union
      2 
----> 3 from pydantic import BaseModel, ConfigDict, validator
      4 from typing_extensions import Literal, Required, TypedDict
      5 

[/usr/local/lib/python3.10/dist-packages/pydantic/__init__.py](https://localhost:8080/#) in __getattr__(attr_name)
    402             f'Importing {attr_name} from `pydantic` is deprecated. This feature is either no longer supported, or is not public.',
    403             DeprecationWarning,
--> 404             stacklevel=2,
    405         )
    406 

[/usr/lib/python3.10/importlib/__init__.py](https://localhost:8080/#) in import_module(name, package)
    124                 break
    125             level += 1
--> 126     return _bootstrap._gcd_import(name[level:], package, level)
    127 
    128 

[/usr/local/lib/python3.10/dist-packages/pydantic/deprecated/class_validators.py](https://localhost:8080/#) in <module>
     10 from typing_extensions import Literal, Protocol, TypeAlias, deprecated
     11 
---> 12 from .._internal import _decorators, _decorators_v1
     13 from ..errors import PydanticUserError
     14 from ..warnings import PydanticDeprecatedSince20

[/usr/local/lib/python3.10/dist-packages/pydantic/_internal/_decorators_v1.py](https://localhost:8080/#) in <module>
     10 
     11 from ..errors import PydanticUserError
---> 12 from ._utils import can_be_positional
     13 
     14 

ImportError: cannot import name 'can_be_positional' from 'pydantic._internal._utils' (/usr/local/lib/python3.10/dist-packages/pydantic/_internal/_utils.py)

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

This looks now to be a pydantic version mismatch in litellm.

@evelynmitchell
Copy link
Contributor Author

The version of swarms is 6.5.1
pydantic==2.10.3
pydantic_core==2.27.1

@evelynmitchell
Copy link
Contributor Author

In swarms 6.5.6 the pydantic error is still occurring, but is now being triggered in swarms code

It looks like the error is coming out of

----> 5 from pydantic import BaseModel, Field, validator

in swarms/artifacts/main_artifact.py

leading to

    402             f'Importing {attr_name} from `pydantic` is deprecated. This feature is either no longer supported, or is not public.'
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
[<ipython-input-7-14444884eff9>](https://localhost:8080/#) in <cell line: 1>()
----> 1 from swarms import Agent
      2 
      3 agent = Agent(
      4     agent_name="Stock-Analysis-Agent",
      5     model_name="gpt-4o-mini",

10 frames
[/usr/local/lib/python3.10/dist-packages/swarms/__init__.py](https://localhost:8080/#) in <module>
     35 run_telemetry()
     36 
---> 37 from swarms.agents import *  # noqa: E402, F403
     38 from swarms.artifacts import *  # noqa: E402, F403
     39 from swarms.prompts import *  # noqa: E402, F403

[/usr/local/lib/python3.10/dist-packages/swarms/agents/__init__.py](https://localhost:8080/#) in <module>
     12 )
     13 from swarms.agents.tool_agent import ToolAgent
---> 14 from swarms.agents.create_agents_from_yaml import (
     15     create_agents_from_yaml,
     16 )

[/usr/local/lib/python3.10/dist-packages/swarms/agents/create_agents_from_yaml.py](https://localhost:8080/#) in <module>
     15 )
     16 from swarms.utils.loguru_logger import initialize_logger
---> 17 from swarms.structs.agent import Agent
     18 from swarms.structs.swarm_router import SwarmRouter
     19 from swarms.utils.litellm import LiteLLM

[/usr/local/lib/python3.10/dist-packages/swarms/structs/__init__.py](https://localhost:8080/#) in <module>
----> 1 from swarms.structs.agent import Agent
      2 from swarms.structs.agents_available import showcase_available_agents
      3 from swarms.structs.auto_swarm import AutoSwarm, AutoSwarmRouter
      4 from swarms.structs.base_structure import BaseStructure
      5 from swarms.structs.base_swarm import BaseSwarm

[/usr/local/lib/python3.10/dist-packages/swarms/structs/agent.py](https://localhost:8080/#) in <module>
     47 from swarms.utils.file_processing import create_file_in_folder
     48 from swarms.utils.pdf_to_text import pdf_to_text
---> 49 from swarms.artifacts.main_artifact import Artifact
     50 from swarms.utils.loguru_logger import initialize_logger
     51 from swarms.utils.wrapper_clusterop import (

[/usr/local/lib/python3.10/dist-packages/swarms/artifacts/__init__.py](https://localhost:8080/#) in <module>
----> 1 from swarms.artifacts.main_artifact import Artifact
      2 
      3 __all__ = [
      4     "Artifact",
      5 ]

[/usr/local/lib/python3.10/dist-packages/swarms/artifacts/main_artifact.py](https://localhost:8080/#) in <module>
      3 import json
      4 from typing import List, Union, Dict, Any
----> 5 from pydantic import BaseModel, Field, validator
      6 from datetime import datetime
      7 from swarms.utils.file_processing import create_file_in_folder

[/usr/local/lib/python3.10/dist-packages/pydantic/__init__.py](https://localhost:8080/#) in __getattr__(attr_name)
    402             f'Importing {attr_name} from `pydantic` is deprecated. This feature is either no longer supported, or is not public.',
    403             DeprecationWarning,
--> 404             stacklevel=2,
    405         )
    406 

[/usr/lib/python3.10/importlib/__init__.py](https://localhost:8080/#) in import_module(name, package)
    124                 break
    125             level += 1
--> 126     return _bootstrap._gcd_import(name[level:], package, level)
    127 
    128 

[/usr/local/lib/python3.10/dist-packages/pydantic/deprecated/class_validators.py](https://localhost:8080/#) in <module>
     10 from typing_extensions import Literal, Protocol, TypeAlias, deprecated
     11 
---> 12 from .._internal import _decorators, _decorators_v1
     13 from ..errors import PydanticUserError
     14 from ..warnings import PydanticDeprecatedSince20

[/usr/local/lib/python3.10/dist-packages/pydantic/_internal/_decorators_v1.py](https://localhost:8080/#) in <module>
     10 
     11 from ..errors import PydanticUserError
---> 12 from ._utils import can_be_positional
     13 
     14 

ImportError: cannot import name 'can_be_positional' from 'pydantic._internal._utils' (/usr/local/lib/python3.10/dist-packages/pydantic/_internal/_utils.py)

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------
time: 23.5 s (started: 2024-12-05 15:53:26 +00:00)

@evelynmitchell
Copy link
Contributor Author

Testing with 6.5.7

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
[<ipython-input-7-14444884eff9>](https://localhost:8080/#) in <cell line: 1>()
----> 1 from swarms import Agent
      2 
      3 agent = Agent(
      4     agent_name="Stock-Analysis-Agent",
      5     model_name="gpt-4o-mini",

10 frames
[/usr/local/lib/python3.10/dist-packages/swarms/__init__.py](https://localhost:8080/#) in <module>
     35 run_telemetry()
     36 
---> 37 from swarms.agents import *  # noqa: E402, F403
     38 from swarms.artifacts import *  # noqa: E402, F403
     39 from swarms.prompts import *  # noqa: E402, F403

[/usr/local/lib/python3.10/dist-packages/swarms/agents/__init__.py](https://localhost:8080/#) in <module>
     12 )
     13 from swarms.agents.tool_agent import ToolAgent
---> 14 from swarms.agents.create_agents_from_yaml import (
     15     create_agents_from_yaml,
     16 )

[/usr/local/lib/python3.10/dist-packages/swarms/agents/create_agents_from_yaml.py](https://localhost:8080/#) in <module>
     15 )
     16 from swarms.utils.loguru_logger import initialize_logger
---> 17 from swarms.structs.agent import Agent
     18 from swarms.structs.swarm_router import SwarmRouter
     19 from swarms.utils.litellm import LiteLLM

[/usr/local/lib/python3.10/dist-packages/swarms/structs/__init__.py](https://localhost:8080/#) in <module>
----> 1 from swarms.structs.agent import Agent
      2 from swarms.structs.agents_available import showcase_available_agents
      3 from swarms.structs.auto_swarm import AutoSwarm, AutoSwarmRouter
      4 from swarms.structs.base_structure import BaseStructure
      5 from swarms.structs.base_swarm import BaseSwarm

[/usr/local/lib/python3.10/dist-packages/swarms/structs/agent.py](https://localhost:8080/#) in <module>
     47 from swarms.utils.file_processing import create_file_in_folder
     48 from swarms.utils.pdf_to_text import pdf_to_text
---> 49 from swarms.artifacts.main_artifact import Artifact
     50 from swarms.utils.loguru_logger import initialize_logger
     51 from swarms.utils.wrapper_clusterop import (

[/usr/local/lib/python3.10/dist-packages/swarms/artifacts/__init__.py](https://localhost:8080/#) in <module>
----> 1 from swarms.artifacts.main_artifact import Artifact
      2 
      3 __all__ = [
      4     "Artifact",
      5 ]

[/usr/local/lib/python3.10/dist-packages/swarms/artifacts/main_artifact.py](https://localhost:8080/#) in <module>
      3 import json
      4 from typing import List, Union, Dict, Any
----> 5 from pydantic import BaseModel, Field, validator
      6 from datetime import datetime
      7 from swarms.utils.file_processing import create_file_in_folder

[/usr/local/lib/python3.10/dist-packages/pydantic/__init__.py](https://localhost:8080/#) in __getattr__(attr_name)
    402             f'Importing {attr_name} from `pydantic` is deprecated. This feature is either no longer supported, or is not public.',
    403             DeprecationWarning,
--> 404             stacklevel=2,
    405         )
    406 

[/usr/lib/python3.10/importlib/__init__.py](https://localhost:8080/#) in import_module(name, package)
    124                 break
    125             level += 1
--> 126     return _bootstrap._gcd_import(name[level:], package, level)
    127 
    128 

[/usr/local/lib/python3.10/dist-packages/pydantic/deprecated/class_validators.py](https://localhost:8080/#) in <module>
     10 from typing_extensions import Literal, Protocol, TypeAlias, deprecated
     11 
---> 12 from .._internal import _decorators, _decorators_v1
     13 from ..errors import PydanticUserError
     14 from ..warnings import PydanticDeprecatedSince20

[/usr/local/lib/python3.10/dist-packages/pydantic/_internal/_decorators_v1.py](https://localhost:8080/#) in <module>
     10 
     11 from ..errors import PydanticUserError
---> 12 from ._utils import can_be_positional
     13 
     14 

ImportError: cannot import name 'can_be_positional' from 'pydantic._internal._utils' (/usr/local/lib/python3.10/dist-packages/pydantic/_internal/_utils.py)

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

@evelynmitchell
Copy link
Contributor Author

This has been fixed in 6.5.9
Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants