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

Error Installing on Arch Linux: "Cannot activate mitsuba-blender add-on. Python pip module cannot be initialized." #119

Open
Zi7ar21 opened this issue Jan 11, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@Zi7ar21
Copy link

Zi7ar21 commented Jan 11, 2025

Bug Description

After downloading the latest version of "mitsuba-blender.zip" and attempting to install it, an error pops up:

Cannot activate mitsuba-blender add-on. Python pip module cannot be initialized.

And the add-on is not enabled.

To Reproduce

Steps to reproduce the behavior:

  1. Download the latest copy of mitsuba-blender.zip from the releases tab
  2. Open Blender (I'm using 4.3.2, but this error should occur on any recent version of Blender)
  3. Open Blender's Preferences (CTRL+[,] or Edit > Preferences)
  4. Click Add-ons > Add-ons Settings drop-down > Install from Disk...
  5. Navigate and select mitsuba-blender.zip
  6. Attempt to enable "Mitsuba-Blender" add-on

Expected behavior

The Mitsuba Blender add-on to be enabled without any errors.

Resources

If applicable, add screenshots or other files (Blender projects, Mitsuba scenes) to help explain or demonstrate your problem.

Environment (please complete the following information):

  • uname -a output:
    Linux jacobarch 6.12.8-zen1-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Thu, 02 Jan 2025 22:52:21 +0000 x86_64 GNU/Linux
    
  • Blender Version: 4.3.2
  • Add-on Version: latest

Additional context

Unlike other Linux distros (e.g. Debian), Arch Linux follows PEP 668. This means you cannot simply install packages using pip, the regular way to do it is by first initializing a venv with:

python -m venv [ENV_DIR]

and then using pip from the virtual environment:

[ENV_DIR]/bin/python -m pip install [Package Name]

To understand why this is, see PEP 668, or additionally the thread "What's the story on pip's externally-managed-environment error?" on the Arch Linux forums.

@Zi7ar21 Zi7ar21 added the bug Something isn't working label Jan 11, 2025
@Zi7ar21
Copy link
Author

Zi7ar21 commented Jan 11, 2025

For reference, here is what happens when I try to install numpy using pip:

[jacob@jacobarch ~]$ pip install numpy
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try 'pacman -S
    python-xyz', where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Arch-packaged Python package,
    create a virtual environment using 'python -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-Arch packaged Python application,
    it may be easiest to use 'pipx install xyz', which will manage a
    virtual environment for you. Make sure you have python-pipx
    installed via pacman.

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.

The canonical way of installing numpy system-wide is to use pacman (or your distro's equivalent):

sudo pacman -S python-numpy

I don't know why this error exists with Blender though, I thought it maintained a separate Python installation? Maybe only on Windows...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant