Skip to content

Commit

Permalink
Update setup.py to ease the installation of agentscope (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavdGao authored Sep 6, 2024
1 parent fb0678f commit bfaf9ed
Show file tree
Hide file tree
Showing 14 changed files with 252 additions and 161 deletions.
36 changes: 27 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Start building LLM-empowered multi-agent applications in an easier way.

[![](https://img.shields.io/badge/cs.MA-2402.14034-B31C1C?logo=arxiv&logoColor=B31C1C)](https://arxiv.org/abs/2402.14034)
[![](https://img.shields.io/badge/python-3.9+-blue)](https://pypi.org/project/agentscope/)
[![](https://img.shields.io/badge/pypi-v0.0.6a2-blue?logo=pypi)](https://pypi.org/project/agentscope/)
[![](https://img.shields.io/badge/pypi-v0.1.0-blue?logo=pypi)](https://pypi.org/project/agentscope/)
[![](https://img.shields.io/badge/Docs-English%7C%E4%B8%AD%E6%96%87-blue?logo=markdown)](https://modelscope.github.io/agentscope/#welcome-to-agentscope-tutorial-hub)
[![](https://img.shields.io/badge/Docs-API_Reference-blue?logo=markdown)](https://modelscope.github.io/agentscope/)
[![](https://img.shields.io/badge/ModelScope-Demos-4e29ff.svg?logo=data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjI0IDEyMS4zMyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KCTxwYXRoIGQ9Im0wIDQ3Ljg0aDI1LjY1djI1LjY1aC0yNS42NXoiIGZpbGw9IiM2MjRhZmYiIC8+Cgk8cGF0aCBkPSJtOTkuMTQgNzMuNDloMjUuNjV2MjUuNjVoLTI1LjY1eiIgZmlsbD0iIzYyNGFmZiIgLz4KCTxwYXRoIGQ9Im0xNzYuMDkgOTkuMTRoLTI1LjY1djIyLjE5aDQ3Ljg0di00Ny44NGgtMjIuMTl6IiBmaWxsPSIjNjI0YWZmIiAvPgoJPHBhdGggZD0ibTEyNC43OSA0Ny44NGgyNS42NXYyNS42NWgtMjUuNjV6IiBmaWxsPSIjMzZjZmQxIiAvPgoJPHBhdGggZD0ibTAgMjIuMTloMjUuNjV2MjUuNjVoLTI1LjY1eiIgZmlsbD0iIzM2Y2ZkMSIgLz4KCTxwYXRoIGQ9Im0xOTguMjggNDcuODRoMjUuNjV2MjUuNjVoLTI1LjY1eiIgZmlsbD0iIzYyNGFmZiIgLz4KCTxwYXRoIGQ9Im0xOTguMjggMjIuMTloMjUuNjV2MjUuNjVoLTI1LjY1eiIgZmlsbD0iIzM2Y2ZkMSIgLz4KCTxwYXRoIGQ9Im0xNTAuNDQgMHYyMi4xOWgyNS42NXYyNS42NWgyMi4xOXYtNDcuODR6IiBmaWxsPSIjNjI0YWZmIiAvPgoJPHBhdGggZD0ibTczLjQ5IDQ3Ljg0aDI1LjY1djI1LjY1aC0yNS42NXoiIGZpbGw9IiMzNmNmZDEiIC8+Cgk8cGF0aCBkPSJtNDcuODQgMjIuMTloMjUuNjV2LTIyLjE5aC00Ny44NHY0Ny44NGgyMi4xOXoiIGZpbGw9IiM2MjRhZmYiIC8+Cgk8cGF0aCBkPSJtNDcuODQgNzMuNDloLTIyLjE5djQ3Ljg0aDQ3Ljg0di0yMi4xOWgtMjUuNjV6IiBmaWxsPSIjNjI0YWZmIiAvPgo8L3N2Zz4K)](https://modelscope.cn/studios?name=agentscope&page=1&sort=latest)
Expand Down Expand Up @@ -220,23 +220,41 @@ cd agentscope
pip install -e .
```

- To build distributed multi-agent applications:
### Using pip

- Install AgentScope from pip:

```bash
# On windows
pip install -e .[distribute]
# On mac
pip install -e .\[distribute\]
pip install agentscope
```

### Using pip
### Extra Dependencies

To support different deployment scenarios, AgentScope provides several
optional dependencies. Full list of optional dependencies refers to
[tutorial](https://doc.agentscope.io/en/tutorial/102-installation.html)
Taking distribution mode as an example, you can install its dependencies
as follows:

- Install AgentScope from pip:

#### On Windows

```bash
pip install agentscope --pre
# From source
pip install -e .[distribute]
# From pypi
pip install agentscope[distribute]
```

#### On Mac & Linux
```bash
# From source
pip install -e .\[distribute\]
# From pypi
pip install agentscope\[distribute\]
```


## Quick Start

### Configuration
Expand Down
32 changes: 23 additions & 9 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

[![](https://img.shields.io/badge/cs.MA-2402.14034-B31C1C?logo=arxiv&logoColor=B31C1C)](https://arxiv.org/abs/2402.14034)
[![](https://img.shields.io/badge/python-3.9+-blue)](https://pypi.org/project/agentscope/)
[![](https://img.shields.io/badge/pypi-v0.0.6a2-blue?logo=pypi)](https://pypi.org/project/agentscope/)
[![](https://img.shields.io/badge/pypi-v0.1.0-blue?logo=pypi)](https://pypi.org/project/agentscope/)
[![](https://img.shields.io/badge/Docs-English%7C%E4%B8%AD%E6%96%87-blue?logo=markdown)](https://modelscope.github.io/agentscope/#welcome-to-agentscope-tutorial-hub)
[![](https://img.shields.io/badge/Docs-API_Reference-blue?logo=markdown)](https://modelscope.github.io/agentscope/)
[![](https://img.shields.io/badge/ModelScope-Demos-4e29ff.svg?logo=data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjI0IDEyMS4zMyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KCTxwYXRoIGQ9Im0wIDQ3Ljg0aDI1LjY1djI1LjY1aC0yNS42NXoiIGZpbGw9IiM2MjRhZmYiIC8+Cgk8cGF0aCBkPSJtOTkuMTQgNzMuNDloMjUuNjV2MjUuNjVoLTI1LjY1eiIgZmlsbD0iIzYyNGFmZiIgLz4KCTxwYXRoIGQ9Im0xNzYuMDkgOTkuMTRoLTI1LjY1djIyLjE5aDQ3Ljg0di00Ny44NGgtMjIuMTl6IiBmaWxsPSIjNjI0YWZmIiAvPgoJPHBhdGggZD0ibTEyNC43OSA0Ny44NGgyNS42NXYyNS42NWgtMjUuNjV6IiBmaWxsPSIjMzZjZmQxIiAvPgoJPHBhdGggZD0ibTAgMjIuMTloMjUuNjV2MjUuNjVoLTI1LjY1eiIgZmlsbD0iIzM2Y2ZkMSIgLz4KCTxwYXRoIGQ9Im0xOTguMjggNDcuODRoMjUuNjV2MjUuNjVoLTI1LjY1eiIgZmlsbD0iIzYyNGFmZiIgLz4KCTxwYXRoIGQ9Im0xOTguMjggMjIuMTloMjUuNjV2MjUuNjVoLTI1LjY1eiIgZmlsbD0iIzM2Y2ZkMSIgLz4KCTxwYXRoIGQ9Im0xNTAuNDQgMHYyMi4xOWgyNS42NXYyNS42NWgyMi4xOXYtNDcuODR6IiBmaWxsPSIjNjI0YWZmIiAvPgoJPHBhdGggZD0ibTczLjQ5IDQ3Ljg0aDI1LjY1djI1LjY1aC0yNS42NXoiIGZpbGw9IiMzNmNmZDEiIC8+Cgk8cGF0aCBkPSJtNDcuODQgMjIuMTloMjUuNjV2LTIyLjE5aC00Ny44NHY0Ny44NGgyMi4xOXoiIGZpbGw9IiM2MjRhZmYiIC8+Cgk8cGF0aCBkPSJtNDcuODQgNzMuNDloLTIyLjE5djQ3Ljg0aDQ3Ljg0di0yMi4xOWgtMjUuNjV6IiBmaWxsPSIjNjI0YWZmIiAvPgo8L3N2Zz4K)](https://modelscope.cn/studios?name=agentscope&page=1&sort=latest)
Expand Down Expand Up @@ -208,21 +208,35 @@ cd agentscope
pip install -e .
```

- 构建分布式多智能体应用需要按照以下方式安装:
### 使用pip

- 从pip安装的AgentScope

```bash
# 在windows上
pip install -e .[distribute]
# 在mac上
pip install -e .\[distribute\]
pip install agentscope
```

### 使用pip
### 额外依赖

- 从pip安装的AgentScope
为了支持不同的部署场景,AgentScope提供了若干个可选的依赖项。
完整的可选依赖项列表请参考[tutorial](https://doc.agentscope.io/en/tutorial/102-installation.html)
以分布式模式为例,可以使用以下命令安装AgentScope:

#### On Windows

```bash
# From source
pip install -e .[distribute]
# From pypi
pip install agentscope[distribute]
```

#### On Mac & Linux
```bash
pip install agentscope --pre
# From source
pip install -e .\[distribute\]
# From pypi
pip install agentscope\[distribute\]
```

## 快速开始
Expand Down
33 changes: 27 additions & 6 deletions docs/sphinx_doc/en/source/tutorial/102-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ If you prefer to install AgentScope from Pypi, you can do so easily using `pip`:

```bash
# For centralized multi-agent applications
pip install agentscope --pre
# For distributed multi-agent applications
pip install agentscope[distribute] --pre # On Mac use `pip install agentscope\[distribute\] --pre`
pip install agentscope
```

### Install from Source
Expand All @@ -59,10 +57,33 @@ cd agentscope

# For centralized multi-agent applications
pip install -e .
# For distributed multi-agent applications
pip install -e .[distribute] # On Mac use `pip install -e .\[distribute\]`
```

**Note**: The `[distribute]` option installs additional dependencies required for distributed applications. Remember to activate your virtual environment before running these commands.
### Extra Dependencies

The supported optional dependencies for AgentScope are list as follows:

- ollama: Ollama API
- litellm: Litellm API
- zhipuai: Zhipuai API
- gemini: Gemini API
- service: The dependencies for different service functions
- distribute: The dependencies for distribution mode
- full: All the dependencies

You can install one or more of these dependencies by adding them to the installation command.

#### Windows
```bash
pip install agentscope[gemini]
# or
pip install agentscope[ollama,distribute]
```
#### Mac & Linux
```bash
pip install agentscope\[gemini\]
# or
pip install agentscope\[ollama,distribute\]
```

[[Return to the top]](#102-installation-en)
37 changes: 30 additions & 7 deletions docs/sphinx_doc/zh_CN/source/tutorial/102-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,45 @@ cd agentscope

# 针对本地化的multi-agent应用
pip install -e .
# 为分布式multi-agent应用
pip install -e .[distribute] # 在Mac上使用`pip install -e .\[distribute\]`
```

**注意**`[distribute]`选项安装了分布式应用程序所需的额外依赖项。在运行这些命令之前,请激活您的虚拟环境。

### 使用Pip安装

如果您选择从Pypi安装AgentScope,可以使用`pip`轻松地完成:

```bash
# 针对本地化的multi-agent应用
pip install agentscope --pre
pip install agentscope
```

### 额外依赖

AgentScope 支持可选依赖如下,用户可以根据自己的需求选择安装:

- ollama: Ollama API
- litellm: Litellm API
- zhipuai: Zhipuai API
- gemini: Gemini API
- service: 不同工具函数的依赖
- distribute: 分布式模式的依赖
- full: 一次性安装上述所有的依赖,可能耗时较长

可以通过将它们添加到安装命令中来安装这些依赖。

# 为分布式multi-agent应用
pip install agentscope[distribute] --pre # 在Mac上使用`pip install agentscope\[distribute\] --pre`
#### Windows

```bash
pip install agentscope[gemini]
# or
pip install agentscope[ollama,distribute]
```

#### Mac & Linux

```bash
pip install agentscope\[gemini\]
# or
pip install agentscope\[ollama,distribute\]
```

[[返回顶端]](#102-installation-zh)
149 changes: 77 additions & 72 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,50 +17,6 @@
NAME = "agentscope"
URL = "https://github.com/modelscope/agentscope"

rpc_requires = [
"grpcio==1.60.0",
"grpcio-tools==1.60.0",
"protobuf==4.25.0",
"expiringdict",
"dill",
"psutil",
]

service_requires = [
"docker",
"pymongo",
"pymysql",
"bs4",
"beautifulsoup4",
"feedparser",
]

doc_requires = [
"sphinx",
"sphinx-autobuild",
"sphinx_rtd_theme",
"myst-parser",
"sphinxcontrib-mermaid",
]

test_requires = ["pytest", "pytest-cov", "pre-commit"]

gradio_requires = [
"gradio==4.19.1",
"modelscope_studio==0.0.5",
]

rag_requires = [
"llama-index==0.10.30",
]

studio_requires = []

web_requires = [
"playwright",
"markdownify",
]

# released requires
minimal_requires = [
"networkx",
Expand All @@ -71,47 +27,85 @@
"tiktoken",
"Pillow",
"requests",
"chardet",
"inputimeout",
"openai>=1.3.0",
"numpy",
"Flask==3.0.0",
"Flask-Cors==4.0.0",
"Flask-SocketIO==5.3.6",
"flask_sqlalchemy",
"flake8",
# TODO: move into other requires
"dashscope==1.14.1",
"psutil",
"scipy",
# Leaving openai and dashscope here as default supports
"openai>=1.3.0",
"ollama>=0.1.7",
"google-generativeai>=0.4.0",
"zhipuai",
"litellm",
"dashscope==1.14.1",
]

extra_service_requires = [
"docker",
"pymongo",
"pymysql",
"bs4",
"beautifulsoup4",
"feedparser",
"notebook",
"nbclient",
"nbformat",
"psutil",
"scipy",
"pillow",
"playwright",
"markdownify",
]

extra_distribute_requires = [
"grpcio==1.60.0",
"grpcio-tools==1.60.0",
"protobuf==4.25.0",
"expiringdict",
"dill",
]

extra_dev_requires = [
# unit test
"pytest",
"pytest-cov",
"pre-commit",
# doc
"sphinx",
"sphinx-autobuild",
"sphinx_rtd_theme",
"myst-parser",
"sphinxcontrib-mermaid",
]

distribute_requires = minimal_requires + rpc_requires
extra_gradio_requires = [
"gradio==4.19.1",
"modelscope_studio==0.0.5",
]

dev_requires = minimal_requires + test_requires
extra_rag_requires = [
"llama-index==0.10.30",
]

full_requires = (
minimal_requires
+ rpc_requires
+ service_requires
+ doc_requires
+ test_requires
+ gradio_requires
+ rag_requires
+ studio_requires
+ web_requires
# API requires
extra_gemini_requires = ["google-generativeai>=0.4.0"]
extra_litellm_requires = ["litellm"]
extra_zhipuai_requires = ["zhipuai"]
extra_ollama_requires = ["ollama>=0.1.7"]

# Full requires
extra_full_requires = (
extra_distribute_requires
+ extra_service_requires
+ extra_dev_requires
+ extra_gradio_requires
+ extra_rag_requires
+ extra_gemini_requires
+ extra_litellm_requires
+ extra_zhipuai_requires
+ extra_ollama_requires
)

online_requires = full_requires + [
# For online workstation
extra_online_requires = extra_full_requires + [
"oss2",
"flask_babel",
"babel==2.15.0",
Expand Down Expand Up @@ -141,10 +135,21 @@
},
install_requires=minimal_requires,
extras_require={
"distribute": distribute_requires,
"dev": dev_requires,
"full": full_requires,
"online": online_requires,
# For specific LLM API
"ollama": extra_ollama_requires,
"litellm": extra_litellm_requires,
"zhipuai": extra_zhipuai_requires,
"gemini": extra_gemini_requires,
# For service functions
"service": extra_service_requires,
# For distribution mode
"distribute": extra_distribute_requires,
# With unit test requires
"dev": extra_dev_requires,
# With full requires
"full": extra_full_requires,
# With online workstation requires
"online": extra_online_requires,
},
license="Apache License 2.0",
classifiers=[
Expand Down
Loading

0 comments on commit bfaf9ed

Please sign in to comment.