Skip to content

scipy and M1 arm64 #12

@rweigel

Description

@rweigel

My install of geopack failed on a M1 mac because the scipy install failed.

I was able to get it to work using

pip install --pre -i https://pypi.anaconda.org/scipy-wheels-nightly/simple scipy

This isn't really a bug report but rather a comment to help others that may run into this issue.

In my code that uses geopack, I've added

import platform
import magnetovis as mvs

platform_str = platform.platform()
if platform_str.endswith('arm64-arm-64bit'):
    try:
        from geopack import geopack
    except:
        msg = 'pip install --pre -i https://pypi.anaconda.org/scipy-wheels-nightly/simple scipy'
        msg = '\n\nThis function uses a library that depends on scipy. On Mac M1, you need to install scipy using: \n\n   ' + msg + '\n'
        raise ImportError(msg)

One thing to consider is the only place scipy is used is in t96.py. There, only scipy.special is used for Bessel functions. The scipy dependency adds 40 MB to the required packages and so one may want to consider using https://libraries.io/pypi/special-functions, which is only 2 MB and has no external dependencies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions