add docs/install

This commit is contained in:
better629 2023-10-27 17:06:45 +08:00
parent f1bcfc7868
commit 11e720a496
4 changed files with 240 additions and 0 deletions

109
docs/install/cli_install.md Normal file
View file

@ -0,0 +1,109 @@
## Traditional Command Line Installation
### Support System and version
| System Version | Python Version | Supported |
| ---- | ---- | ----- |
| macOS 13.x | python 3.9 | Yes |
| Windows 11 | python 3.9 | Yes |
| Ubuntu 22.04 | python 3.9 | Yes |
### Detail Installation
```bash
# Step 1: Ensure that NPM is installed on your system. Then install mermaid-js. (If you don't have npm in your computer, please go to the Node.js official website to install Node.js https://nodejs.org/ and then you will have npm tool in your computer.)
npm --version
sudo npm install -g @mermaid-js/mermaid-cli
# Step 2: Ensure that Python 3.9+ is installed on your system. You can check this by using:
python3 --version
# Step 3: Clone the repository to your local machine, and install it.
git clone https://github.com/geekan/metagpt
cd metagpt
pip install -e.
```
**Note:**
- If already have Chrome, Chromium, or MS Edge installed, you can skip downloading Chromium by setting the environment variable
`PUPPETEER_SKIP_CHROMIUM_DOWNLOAD` to `true`.
- Some people are [having issues](https://github.com/mermaidjs/mermaid.cli/issues/15) installing this tool globally. Installing it locally is an alternative solution,
```bash
npm install @mermaid-js/mermaid-cli
```
- don't forget to the configuration for mmdc in config.yml
```yml
PUPPETEER_CONFIG: "./config/puppeteer-config.json"
MMDC: "./node_modules/.bin/mmdc"
```
- if `pip install -e.` fails with error `[Errno 13] Permission denied: '/usr/local/lib/python3.11/dist-packages/test-easy-install-13129.write-test'`, try instead running `pip install -e. --user`
- To convert Mermaid charts to SVG, PNG, and PDF formats. In addition to the Node.js version of Mermaid-CLI, you now have the option to use Python version Playwright, pyppeteer or mermaid.ink for this task.
- Playwright
- **Install Playwright**
```bash
pip install playwright
```
- **Install the Required Browsers**
to support PDF conversion, please install Chrominum.
```bash
playwright install --with-deps chromium
```
- **modify `config.yaml`**
uncomment MERMAID_ENGINE from config.yaml and change it to `playwright`
```yaml
MERMAID_ENGINE: playwright
```
- pyppeteer
- **Install pyppeteer**
```bash
pip install pyppeteer
```
- **Use your own Browsers**
pyppeteer allows you use installed browsers, please set the following envirment
```bash
export PUPPETEER_EXECUTABLE_PATH = /path/to/your/chromium or edge or chrome
```
please do not use this command to install browser, it is too old
```bash
pyppeteer-install
```
- **modify `config.yaml`**
uncomment MERMAID_ENGINE from config.yaml and change it to `pyppeteer`
```yaml
MERMAID_ENGINE: pyppeteer
```
- mermaid.ink
- **modify `config.yaml`**
uncomment MERMAID_ENGINE from config.yaml and change it to `ink`
```yaml
MERMAID_ENGINE: ink
```
Note: this method does not support pdf export.

View file

@ -0,0 +1,43 @@
## 命令行安装
### 支持的系统和版本
| 系统版本 | Python 版本 | 是否支持 |
| ---- | ---- | ----- |
| macOS 13.x | python 3.9 | 是 |
| Windows 11 | python 3.9 | 是 |
| Ubuntu 22.04 | python 3.9 | 是 |
### 详细安装
```bash
# 第 1 步:确保您的系统上安装了 NPM。并使用npm安装mermaid-js
npm --version
sudo npm install -g @mermaid-js/mermaid-cli
# 第 2 步:确保您的系统上安装了 Python 3.9+。您可以使用以下命令进行检查:
python --version
# 第 3 步:克隆仓库到您的本地机器,并进行安装。
git clone https://github.com/geekan/metagpt
cd metagpt
pip install -e.
```
**注意:**
- 如果已经安装了Chrome、Chromium或MS Edge可以通过将环境变量`PUPPETEER_SKIP_CHROMIUM_DOWNLOAD`设置为`true`来跳过下载Chromium。
- 一些人在全局安装此工具时遇到问题。在本地安装是替代解决方案,
```bash
npm install @mermaid-js/mermaid-cli
```
- 不要忘记在config.yml中为mmdc配置配置
```yml
PUPPETEER_CONFIG: "./config/puppeteer-config.json"
MMDC: "./node_modules/.bin/mmdc"
```
- 如果`pip install -e.`失败并显示错误`[Errno 13] Permission denied: '/usr/local/lib/python3.11/dist-packages/test-easy-install-13129.write-test'`,请尝试使用`pip install -e. --user`运行。

View file

@ -0,0 +1,44 @@
## Docker Installation
### Use default MetaGPT image
```bash
# Step 1: Download metagpt official image and prepare config.yaml
docker pull metagpt/metagpt:latest
mkdir -p /opt/metagpt/{config,workspace}
docker run --rm metagpt/metagpt:latest cat /app/metagpt/config/config.yaml > /opt/metagpt/config/key.yaml
vim /opt/metagpt/config/key.yaml # Change the config
# Step 2: Run metagpt demo with container
docker run --rm \
--privileged \
-v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \
-v /opt/metagpt/workspace:/app/metagpt/workspace \
metagpt/metagpt:latest \
python3 startup.py "Write a cli snake game"
# You can also start a container and execute commands in it
docker run --name metagpt -d \
--privileged \
-v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \
-v /opt/metagpt/workspace:/app/metagpt/workspace \
metagpt/metagpt:latest
docker exec -it metagpt /bin/bash
$ python3 startup.py "Write a cli snake game"
```
The command `docker run ...` do the following things:
- Run in privileged mode to have permission to run the browser
- Map host configure file `/opt/metagpt/config/key.yaml` to container `/app/metagpt/config/key.yaml`
- Map host directory `/opt/metagpt/workspace` to container `/app/metagpt/workspace`
- Execute the demo command `python3 startup.py "Write a cli snake game"`
### Build image by yourself
```bash
# You can also build metagpt image by yourself.
git clone https://github.com/geekan/MetaGPT.git
cd MetaGPT && docker build -t metagpt:custom .
```

View file

@ -0,0 +1,44 @@
## Docker安装
### 使用MetaGPT镜像
```bash
# 步骤1: 下载metagpt官方镜像并准备好config.yaml
docker pull metagpt/metagpt:latest
mkdir -p /opt/metagpt/{config,workspace}
docker run --rm metagpt/metagpt:latest cat /app/metagpt/config/config.yaml > /opt/metagpt/config/key.yaml
vim /opt/metagpt/config/key.yaml # 修改配置文件
# 步骤2: 使用容器运行metagpt演示
docker run --rm \
--privileged \
-v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \
-v /opt/metagpt/workspace:/app/metagpt/workspace \
metagpt/metagpt:latest \
python startup.py "Write a cli snake game"
# 您也可以启动一个容器并在其中执行命令
docker run --name metagpt -d \
--privileged \
-v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \
-v /opt/metagpt/workspace:/app/metagpt/workspace \
metagpt/metagpt:latest
docker exec -it metagpt /bin/bash
$ python startup.py "Write a cli snake game"
```
`docker run ...`做了以下事情:
- 以特权模式运行,有权限运行浏览器
- 将主机文件 `/opt/metagpt/config/key.yaml` 映射到容器文件 `/app/metagpt/config/key.yaml`
- 将主机目录 `/opt/metagpt/workspace` 映射到容器目录 `/app/metagpt/workspace`
- 执行示例命令 `python startup.py "Write a cli snake game"`
### 自己构建镜像
```bash
# 您也可以自己构建metagpt镜像
git clone https://github.com/geekan/MetaGPT.git
cd MetaGPT && docker build -t metagpt:custom .
```