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

Add installation instructions for Macs running on Apple Silicon #2774

Merged
merged 12 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/book/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ pip install "zenml[server]"
We highly encourage you to install ZenML in a virtual environment. At ZenML, We like to use [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/) or [pyenv-virtualenv](https://github.com/pyenv/pyenv-virtualenv) to manage our Python virtual environments.
{% endhint %}

## Installing onto MacOS with Apple Silicon (M1, M2)
strickvl marked this conversation as resolved.
Show resolved Hide resolved

A change in how forking works on Macs running on Apple Silicon means that you
should set the following environment variable which will ensure that your
connections to the server remain unbroken:

```bash
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
```

You can read more about this [here](http://sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html). This environment variable is needed if you are working with a local server on your Mac, but if you're just using ZenML as a client / CLI and connecting to a deployed server then you don't need to set it.

## Nightly builds

ZenML also publishes nightly builds under the [`zenml-nightly` package name](https://pypi.org/project/zenml-nightly/). These are built from the latest [`develop` branch](https://github.com/zenml-io/zenml/tree/develop) (to which work ready for release is published) and are not guaranteed to be stable. To install the nightly build, run:
Expand Down
18 changes: 18 additions & 0 deletions docs/book/reference/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@ The ZenML team and community are constantly working to include more tools and in

Most importantly, ZenML is extensible, and we encourage you to use it with whatever other tools you require as part of your ML process and system(s). Check out [our documentation on how to get started](../introduction.md) with extending ZenML to learn more!

#### Do you support Windows?

ZenML officially supports Windows if you're using WSL. Much of ZenML will also
work on Windows outside a WSL environment, but we don't officially support it
and some features don't work (notably anything that requires spinning up a
server process).

#### Do you support Macs running on Apple Silicon?

Yes, ZenML does support Macs running on Apple Silicon. You just need to make sure that you set the following environment variable:

```bash
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
```

This is a known issue with how forking works on Macs running on Apple Silicon
and it will enable you to use ZenML and the server. This environment variable is needed if you are working with a local server on your Mac, but if you're just using ZenML as a client / CLI and connecting to a deployed server then you don't need to set it.

#### How can I make ZenML work with my custom tool? How can I extend or build on ZenML?

This depends on the tool and its respective MLOps category. We have a full guide on this over [here](../how-to/stack-deployment/implement-a-custom-stack-component.md)!
Expand Down
6 changes: 6 additions & 0 deletions src/zenml/cli/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@ def up(
else:
pass
provider = ServerProviderType.LOCAL
if cli_utils.requires_mac_env_var_warning():
cli_utils.error(
"The `OBJC_DISABLE_INITIALIZE_FORK_SAFETY` environment variable "
"is recommended to run the ZenML server locally on a Mac. "
"Please set it to `YES` and try again."
)

os.environ[ENV_ZENML_LOCAL_SERVER] = str(True)

Expand Down
16 changes: 16 additions & 0 deletions src/zenml/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2748,3 +2748,19 @@ def is_jupyter_installed() -> bool:
return True
except pkg_resources.DistributionNotFound:
return False


def requires_mac_env_var_warning() -> bool:
"""Checks if a warning needs to be shown for a local Mac server.

This is for the case where a user is on a MacOS system, trying to run a
local server but is missing the `OBJC_DISABLE_INITIALIZE_FORK_SAFETY`
environment variable.

Returns:
bool: True if a warning needs to be shown, False otherwise.
"""
return (
not os.getenv("OBJC_DISABLE_INITIALIZE_FORK_SAFETY")
and sys.platform == "darwin"
strickvl marked this conversation as resolved.
Show resolved Hide resolved
)
Loading