Skip to content

Mac installation: since changes in Homebrew for Python 3.12, pip3 install manim doesn't work. Improvement of the doc is needed. #3656

Closed
@quark67

Description

@quark67

Preliminaries

Description of error

The command pip3 install manim throw this error in the Terminal on Mac (Python is installed by Homebrew, as suggested in the Manim manual: https://docs.manim.community/en/stable/installation/macos.html):

error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try brew install
xyz, where xyz is the package you are trying to
install.

If you wish to install a non-brew-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip.

If you wish to install a non-brew packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

This is related to PEP 668 (https://peps.python.org/pep-0668/).

This is documented in this discussion on the GitHub for the Homebrew package manager project: https://github.com/orgs/Homebrew/discussions/3404

On February 21, this change was implemented, as writed here:

@pradyunsg we have now implemented this starting with Python 3.12: Homebrew/homebrew-core#150390, and Python 3.12 has become the default Python 3 in Homebrew so more users will be made aware of the change.

Installation logs

Terminal output
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try brew install
    xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-brew-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip.
    
    If you wish to install a non-brew packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

System specifications

System Details
  • OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)):
  • RAM:
  • Python version (python/py/python3 --version):
  • Installed modules (provide output from pip list):
macOS 14.3.1 (Sonoma)
64 GB
Python 3.12.2
Brotli   1.1.0
certifi  2024.2.2
gpg      1.23.2
mutagen  1.47.0
openvino 2023.3.0
pip      24.0
pycairo  1.26.0
TBB      0.2
wheel    0.42.0
LaTeX details
  • LaTeX distribution (e.g. TeX Live 2020): TeX Live 2024 (MacTeX 2024)
  • Installed LaTeX packages: a list of 4693 packages
FFMPEG

Output of ffmpeg -version:

ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers

Additional comments

I suggest an improvement of the manual for the Mac installation, specifically for users which have Python 3.12 installed. By the way: I have Python 3.11 installed and it's the command brew install py3cairo ffmpeg (see https://docs.manim.community/en/stable/installation/macos.html#required-dependencies) which has upgraded the Python version. During the installation of py3cairo and ffmpeg, I read this:

==> Installing py3cairo dependency: python@3.12
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.12/manifests/3.12.2_1

The documentation can be improved either by replacing pip3 install manim with brew install manim (not working, unlike to what the text error suggest in the Terminal after the command pip3 install manim is entered), or pip3 install manim --break-system-packages (not tested yet, I will wait for your suggestion) or configuring pip.conf with break-system-packages by default (I don't know how to do this, I have never modified this file ; this is suggested here).

What do you suggest to do yet, before the manual is updated? How can I reinstall Manim (it was installed with a previous version of Python, but in every update of Python, I loose Manim, I have the ModuleNotFoundError: No module named 'manim' error)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    installationEverything concerning the installation process

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions