Skip to content

fix: add ARM architecture support for conda installation#56

Open
RusilKoirala wants to merge 6 commits intonu-ZOO:mainfrom
RusilKoirala:main
Open

fix: add ARM architecture support for conda installation#56
RusilKoirala wants to merge 6 commits intonu-ZOO:mainfrom
RusilKoirala:main

Conversation

@RusilKoirala
Copy link

Summary

Fixes #55

Added support for ARM-based architectures (arm64/aarch64) in the conda installation process.

Changes

  • Added architecture detection using uname -m
  • Updated conda download URL to use detected architecture instead of hardcoded x86_64
  • Added better logging to show both OS and architecture

Testing

  • Tested successfully on macOS with Apple M4 (arm64)
  • Conda installed correctly
  • Environment created and activated successfully
Screenshot 2026-01-30 at 09 13 10 Screenshot 2026-01-30 at 09 14 41

Related

Implementation follows the pattern suggested in the issue discussion.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds ARM architecture support to the conda installation script to fix issue #55. The changes enable the setup script to work on ARM-based systems (like Apple Silicon Macs) by detecting the system architecture and using the appropriate conda installer.

Changes:

  • Added architecture detection using uname -m to identify x86_64, arm64, or aarch64 systems
  • Updated the conda download URL to use the detected architecture instead of hardcoded x86_64
  • Enhanced logging to display both OS and architecture information
Comments suppressed due to low confidence (1)

setup.sh:41

  • The Miniconda installer is downloaded from https://repo.anaconda.com into miniconda.sh and then executed with bash without any integrity verification. If an attacker can tamper with the installer content in transit or via a supply-chain compromise of the hosting endpoint, they could execute arbitrary code in the environment running setup.sh. Consider enforcing integrity checks (e.g., verifying a known checksum or signature for the installer) before executing it, or using an installation mechanism that provides built-in integrity verification.
	CONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-py${PYTHON_VERSION//.}_24.9.2-0-${CONDA_OS}-${CONDA_ARCH}.sh"
	if which wget; then
        wget ${CONDA_URL} -O miniconda.sh
    else
        curl ${CONDA_URL} -o miniconda.sh
    fi
    bash miniconda.sh -b -p $HOME/miniconda

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

setup.sh Outdated
export CONDA_ARCH=x86_64
;;
arm64|aarch64)
export CONDA_ARCH=arm64
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The architecture naming convention may be incorrect for Linux ARM systems. Miniconda uses different architecture names depending on the OS:

  • macOS: arm64 (correct)
  • Linux: aarch64 (not arm64)

Currently, this code maps both arm64 and aarch64 from uname -m to arm64 for the conda URL. While this will work correctly for macOS (which reports arm64), it will likely fail for Linux ARM systems because the miniconda repository uses "aarch64" in the filename for Linux ARM packages (e.g., "Miniconda3-...-Linux-aarch64.sh"), not "arm64".

Consider updating the logic to set CONDA_ARCH based on both the OS and the architecture. For example, use arm64 for macOS and aarch64 for Linux when detecting arm-based systems.

Suggested change
export CONDA_ARCH=arm64
if [ "$CONDA_OS" = "MacOSX" ]; then
export CONDA_ARCH=arm64
else
export CONDA_ARCH=aarch64
fi

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Github copilots review here is almost right, but not quite.

When you use uname -m on a linux based arm64 machine, it will return aarch64. So a simpler method for extracting this is like so:

    # Setting architecture based on input
    CONDA_ARCH=$(uname -m)
    
    case $CONDA_ARCH in

        x86_64) : ;;
        arm64)  : ;;
        aarch64) : ;;
        *)
            echo "Installation only supported on x86_64 and arm architectures"
            exit 1
            ;;
    esac 

Copy link
Member

@jwaiton jwaiton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this small change to simplify the architecture selection would be nice.

It would be good to also alter the GHA runner as done here to test everything under differing architectures :)

setup.sh Outdated
Comment on lines 21 to 36
case "$(uname -m)" in
x86_64)
export CONDA_ARCH=x86_64
;;
arm64|aarch64)
if [ "$CONDA_OS" = "MacOSX" ]; then
export CONDA_ARCH=arm64
else
export CONDA_ARCH=aarch64
fi
;;
*)
echo "Unsupported architecture: $(uname -m)"
exit 1
;;
esac
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As referenced here, this logic can be simplified.

@RusilKoirala
Copy link
Author

@jwaiton Updated! I've simplified the architecture detection as you suggested. The logic now directly uses the output from uname -m without any OS-specific mapping.

@jwaiton
Copy link
Member

jwaiton commented Feb 2, 2026

Hi @RusilKoirala. Perfect! That looks to work, and passes the expected tests. The only addition needed now is updating the GHA runner as suggested above, and then I can approve this :)

@RusilKoirala
Copy link
Author

@jwaiton I've added multi-architecture testing to the GHA workflow. The tests will now run on:

  • Linux x86_64 (ubuntu-24.04)
  • Linux ARM64 (ubuntu-24.04-arm64)
  • macOS Intel (macos-13)
  • macOS ARM (macos-14)

The workflow now uses the setup.sh script directly, so it automatically detects the architecture and downloads the correct Miniconda installer for each platform. Ready for your review!

@jwaiton
Copy link
Member

jwaiton commented Feb 3, 2026

Hi @RusilKoirala,

It appears that the MacOS image you wish to run for intel is out of date:

The macOS-13 based runner images are being deprecated, consider switching to macOS-15 (macos-15-intel) or macOS 15 arm64 (macos-latest) instead. For more details see https://github.com/actions/runner-images/issues/13046

The error suggests using macos-15-intel instead.

The other tests all failed, due to two things:

  • If the environment doesn't detect conda present, it will ask the user to install it. This stops the tests.
  • Once conda has been installed it needs to be initialised with conda init because an environment can be activated (which source setup.sh does).

Resolving these two issues should fix it :) For the first once I'd recommend a pipe of this style:

- name: Run script with input 1
  run: echo 1 | ./your_script.sh

For the second, I'll leave that to you, but it should just require the addition of conda init into the setup script.

@RusilKoirala
Copy link
Author

@jwaiton Fixed all three issues:

  1. Updated runner to macos-15-intel
  2. Added echo 1 | to handle conda prompt in CI
  3. Added conda init after installation

Tested locally on M4 - everything works. Ready for review!

@jwaiton
Copy link
Member

jwaiton commented Feb 4, 2026

Hi @RusilKoirala,

It appears the tests still fail! I'm unsure as to why the Mac ones fail, but the ubuntu one appears to be relatively simple:

CondaError: Run 'conda init' before 'conda activate'

The simple solution (I believe) is to use source setup.sh <<< "1" rather than the pipe, although I'm not 100% sure on this. If this fix doesn't work, I'll take some time to figure exactly whats wrong with the GHA.

@RusilKoirala
Copy link
Author

@jwaiton
Addressed CI failures by initializing conda shell hooks in [setup.sh] and running tests with conda run. Also ensured pytest is installed inside the env and swapped CI input to a here-string. Please re-run checks.

@jwaiton
Copy link
Member

jwaiton commented Feb 4, 2026

Because running the tests is annoying for users outside of the nu-ZOO group (sorry about that!), I've done some debugging myself and found that this is the last required change to make the code run. Doing this will allow the tests to pass :)

It also appears that ubuntu arm64 is no longer available as a github runner platform as seen here, so please remove it from the list of runners tested. :)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

setup.sh breaks for arm based installations of conda

3 participants