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

Mojo: Quickstart - Setup on MacOS(intel) with Orbstack #411

Open
hhstore opened this issue Sep 8, 2023 · 19 comments
Open

Mojo: Quickstart - Setup on MacOS(intel) with Orbstack #411

hhstore opened this issue Sep 8, 2023 · 19 comments

Comments

@hhstore
Copy link
Owner

hhstore commented Sep 8, 2023

📖 Abstract:

  • ✅ Intel Mac 安装 Mojo 教程.

💯 Related:

@hhstore
Copy link
Owner Author

hhstore commented Sep 8, 2023

Mojo 教程:

  • 今天 mojo 已经发布首个版本.

Mojo 官网:

Mojo 成功安装:

🔥 MacOS:

  • ✅ 安装方案: MacOS(intel) + orbstack + Ubuntu 20.04.6 LTS (虚拟机), 目前已经可以成功安装.
    • 更新说明: 目前 Ubuntu 22.04 也可正常安装。
  • ✅ 注意事项: orbstack 虚拟机, 要给多核(2核+), 内存 8G+. (亲测 OK)

🔥 Windows:

  • ✅ 安装方案: Windows + WSL, 目前已经可以成功安装.

🔥 MacOS + Orbstack + 虚拟机 安装教程:

🔥 MacOS + Mojo 安装流程总说明:

  1. ✅ MacOS 安装 orbstack.
  2. ✅ 使用 orbstack 创建 Ubuntu 虚拟机:
    • ✅ orbstack 虚拟机资源要求: CPU 2核+, 内存 8G+ (亲测 OK)
    • ✅ 注意限制版本为 Ubuntu 20.04.6 LTS, 和官方对齐.
    • ✅ (否则有各种报错, 浪费时间调试)
  3. ✅ Ubuntu 虚拟机中:
    • a. ✅ 安装各种依赖(git,zsh, pip, ...), 有详细脚本.
    • b. ✅ 预设置 mojo 环境变量 + 依赖环境变量.
    • c. ✅ 安装 modular.
    • d. ✅ 安装 mojo.
    • e. ✅ 测试 mojo, print("hi") 正常. (结束)
  4. ✅ 配置 Vscode + 插件.

安装环境要求:

image

避坑指南:

限定 OS 版本:

  • ✅ 懒折腾, 和官方安装环境对齐, 推荐 Ubuntu 20.04.6 LTS. (本教程适用)
  • ✅ MacOS 搭配 orbstack 创建 Ubuntu 虚拟机安装.

限定 python 版本:

  • ✅ python 版本: 3.8 - 3.10. (3.11 失败)

预先设置环境变量:

  • ✅ mojo SDK: ``
  • ✅ 通用依赖环境变量: $HOME/.local/bin

@hhstore

This comment was marked as outdated.

@hhstore

This comment was marked as outdated.

@hhstore

This comment was marked as outdated.

@hhstore

This comment was marked as outdated.

@hhstore
Copy link
Owner Author

hhstore commented Sep 8, 2023

VScode 设置:

安装 mojo 插件:

插件设置:

  • 设置 LSP Server 配置: 对应为 orbstack 创建的 Ubuntu 虚拟机 安装路径:
/Users/geek/OrbStack/ubuntu20/home/geek/.modular
  • 截图: 当前仍然有报错.
image

@hhstore

This comment was marked as outdated.

@hhstore

This comment was marked as outdated.

@hhstore
Copy link
Owner Author

hhstore commented Sep 10, 2023

安装成功检查依赖:

╭─geek at ubuntu20 in ~
╰─○ tree .local -L 2
.local
├── bin
│   ├── find_libpython
│   ├── jsonschema
│   ├── jupyter
│   ├── jupyter-execute
│   ├── jupyter-kernel
│   ├── jupyter-kernelspec
│   ├── jupyter-migrate
│   ├── jupyter-run
│   ├── jupyter-troubleshoot
│   ├── jupyter-trust
│   ├── papermill
│   └── tqdm
├── lib
│   └── python3.8
└── share
    └── jupyter
  • 测试依赖:
jupyter

@hhstore

This comment was marked as outdated.

@hhstore
Copy link
Owner Author

hhstore commented Sep 10, 2023

1

@RickieBlaese
Copy link

Hey, just a heads up. You probably don't want to be posting your personal Modular authentication key here. That's the one that begins with mut_.

@hhstore
Copy link
Owner Author

hhstore commented Sep 13, 2023

Hey, just a heads up. You probably don't want to be posting your personal Modular authentication key here. That's the one that begins with mut_.

@RickieBlaese

  • Thanks for the reminder. Considering this account, which is a temporary account, this auth token is not worth much.
  • In China, many people have not registered a modular account, and this auth token is provided for the convenience of others.
  • Anyway, still thanks for the reminder.

@hhstore hhstore changed the title Mojo: Quickstart Mojo: Quickstart - Setup on MacOS(intel) with Orbstack Sep 13, 2023
@hhstore
Copy link
Owner Author

hhstore commented Oct 19, 2023

安装方案 2:

  • 适用于 Intel/M1 Mac
  • 原理: 基于 vscode + Dev Containers 插件 + orbstack + docker 容器。

安装流程:

安装 vscode + 插件:

基于 Dev Containers 插件, 创建 Ubuntu Docker:

@hhstore
Copy link
Owner Author

hhstore commented Oct 19, 2023

image
  • 创建 Ubuntu 容器:
image
  • 输入 Ubuntu, 筛选:
image image

@hhstore
Copy link
Owner Author

hhstore commented Oct 19, 2023

image
  • 创建容器日志
image
  • 容器创建日志内容:
image

@hhstore
Copy link
Owner Author

hhstore commented Oct 19, 2023

modularml/mojo#724

@hhstore
Copy link
Owner Author

hhstore commented Oct 19, 2023

Mojo 官方文档,Intel Mac 推荐使用 Vscode + Dev Containers 插件 + docker (orbstack) ubuntu 22.04 容器这种方式安装, 我测试了,没问题。

这种方式和 orbstack + ubuntu 虚拟机, 效果一样。 都可以配合 vscode + Dev Containers 连接。

这个模式是 vscode 远程连接方式, 可以继续在 Ubuntu 容器/虚拟机 中,继续装 vscode 的 mojo 插件 + copilot(GPT) 插件。

体验和宿主机,基本没差别。丝滑。

@hhstore
Copy link
Owner Author

hhstore commented Oct 19, 2023

image

image

vscode + Dev Containers 插件,创建的 Ubuntu 容器,会自动启动这个。

然后 vscode 远程连进这个容器, 代码目录,创建在这个 docker 容器里, 基本无痛。

Windows 配合 wsl + vscode + Dev Containers 插件,体验基本是差不多的。

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants