Skip to content

Trouble installing cypari2 on M1 Mac #118

@liammulh

Description

@liammulh

Hello,

I'm having trouble installing cypari2 on a new-ish Mac using the Poetry package manager. Any help would be greatly appreciated!

System Info

  • macOS Monterey Version 12.4
  • MacBook Air (M1, 2020)

What I'm Trying to Do

Command I'm Issuing and Resultant Error
(backscope-xBHlVOM6-py3.10) liam@ratbook backscope % poetry add cypari2
Using version ^2.1.2 for cypari2

Updating dependencies
Resolving dependencies... (0.1s)

Writing lock file

Package operations: 1 install, 0 updates, 0 removals

  • Installing cypari2 (2.1.2): Failed

  EnvCommandError

  Command ['/Users/liam/Library/Caches/pypoetry/virtualenvs/backscope-xBHlVOM6-py3.10/bin/pip', 'install', '--no-deps', 'file:///Users/liam/Library/Caches/pypoetry/artifacts/0a/70/e5/c27a295638f41052766b4dc4bee01122a4788154100ad59cefa22105d0/cypari2-2.1.2.tar.gz'] errored with the following return code 1, and output: 
  Processing /Users/liam/Library/Caches/pypoetry/artifacts/0a/70/e5/c27a295638f41052766b4dc4bee01122a4788154100ad59cefa22105d0/cypari2-2.1.2.tar.gz
    Preparing metadata (setup.py): started
    Preparing metadata (setup.py): finished with status 'done'
  Building wheels for collected packages: cypari2
    Building wheel for cypari2 (setup.py): started
    Building wheel for cypari2 (setup.py): finished with status 'error'
    error: subprocess-exited-with-error
    
    × python setup.py bdist_wheel did not run successfully.
    │ exit code: 1
    ╰─> [46 lines of output]
        running bdist_wheel
        running build
        running build_py
        creating build
        creating build/lib.macosx-10.9-universal2-cpython-310
        creating build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/types.pxd -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/gen.pxd -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/convert.pxd -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/auto_paridecl.pxd -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/stack.pxd -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/string_utils.pxd -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/paridecl.pxd -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/handle_error.pxd -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/pari_instance.pxd -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/paripriv.pxd -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/closure.pxd -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/cypari.h -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        running build_ext
        Compiling cypari2/closure.pyx because it changed.
        Compiling cypari2/convert.pyx because it changed.
        Compiling cypari2/gen.pyx because it changed.
        Compiling cypari2/handle_error.pyx because it changed.
        Compiling cypari2/pari_instance.pyx because it changed.
        Compiling cypari2/stack.pyx because it changed.
        Compiling cypari2/string_utils.pyx because it changed.
        [1/7] Cythonizing cypari2/closure.pyx
        [2/7] Cythonizing cypari2/convert.pyx
        [3/7] Cythonizing cypari2/gen.pyx
        [4/7] Cythonizing cypari2/handle_error.pyx
        [5/7] Cythonizing cypari2/pari_instance.pyx
        [6/7] Cythonizing cypari2/stack.pyx
        [7/7] Cythonizing cypari2/string_utils.pyx
        building 'cypari2.closure' extension
        creating build/temp.macosx-10.9-universal2-cpython-310
        creating build/temp.macosx-10.9-universal2-cpython-310/cypari2
        clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I./cypari2 -I/Users/liam/Library/Caches/pypoetry/virtualenvs/backscope-xBHlVOM6-py3.10/lib/python3.10/site-packages/cysignals -I/opt/homebrew/include -I/Users/liam/Library/Caches/pypoetry/virtualenvs/backscope-xBHlVOM6-py3.10/include -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c cypari2/closure.c -o build/temp.macosx-10.9-universal2-cpython-310/cypari2/closure.o
        clang -bundle -undefined dynamic_lookup -arch arm64 -arch x86_64 -g build/temp.macosx-10.9-universal2-cpython-310/cypari2/closure.o -L/opt/homebrew/lib -lgmp -lpari -o build/lib.macosx-10.9-universal2-cpython-310/cypari2/closure.cpython-310-darwin.so
        ld: warning: dylib (/opt/homebrew/lib/libgmp.dylib) was built for newer macOS version (12.0) than being linked (11.0)
        ld: warning: dylib (/opt/homebrew/lib/libpari.dylib) was built for newer macOS version (12.0) than being linked (11.0)
        ld: warning: ignoring file /opt/homebrew/lib/libgmp.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
        ld: warning: ignoring file /opt/homebrew/lib/libpari.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
        ld: illegal thread local variable reference to regular symbol _avma for architecture x86_64
        clang: error: linker command failed with exit code 1 (use -v to see invocation)
        error: command '/usr/bin/clang' failed with exit code 1
        [end of output]
    
    note: This error originates from a subprocess, and is likely not a problem with pip.
    ERROR: Failed building wheel for cypari2
    Running setup.py clean for cypari2
  Failed to build cypari2
  Installing collected packages: cypari2
    Running setup.py install for cypari2: started
    Running setup.py install for cypari2: finished with status 'error'
    error: subprocess-exited-with-error
    
    × Running setup.py install for cypari2 did not run successfully.
    │ exit code: 1
    ╰─> [34 lines of output]
        running install
        /Users/liam/Library/Caches/pypoetry/virtualenvs/backscope-xBHlVOM6-py3.10/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
          warnings.warn(
        running build
        running build_py
        creating build
        creating build/lib.macosx-10.9-universal2-cpython-310
        creating build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/types.pxd -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/gen.pxd -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/convert.pxd -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/auto_paridecl.pxd -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/stack.pxd -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/string_utils.pxd -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/paridecl.pxd -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/handle_error.pxd -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/pari_instance.pxd -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/paripriv.pxd -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/closure.pxd -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        copying cypari2/cypari.h -> build/lib.macosx-10.9-universal2-cpython-310/cypari2
        running build_ext
        building 'cypari2.closure' extension
        creating build/temp.macosx-10.9-universal2-cpython-310
        creating build/temp.macosx-10.9-universal2-cpython-310/cypari2
        clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I./cypari2 -I/Users/liam/Library/Caches/pypoetry/virtualenvs/backscope-xBHlVOM6-py3.10/lib/python3.10/site-packages/cysignals -I/opt/homebrew/include -I/Users/liam/Library/Caches/pypoetry/virtualenvs/backscope-xBHlVOM6-py3.10/include -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c cypari2/closure.c -o build/temp.macosx-10.9-universal2-cpython-310/cypari2/closure.o
        clang -bundle -undefined dynamic_lookup -arch arm64 -arch x86_64 -g build/temp.macosx-10.9-universal2-cpython-310/cypari2/closure.o -L/opt/homebrew/lib -lgmp -lpari -o build/lib.macosx-10.9-universal2-cpython-310/cypari2/closure.cpython-310-darwin.so
        ld: warning: dylib (/opt/homebrew/lib/libgmp.dylib) was built for newer macOS version (12.0) than being linked (11.0)
        ld: warning: dylib (/opt/homebrew/lib/libpari.dylib) was built for newer macOS version (12.0) than being linked (11.0)
        ld: warning: ignoring file /opt/homebrew/lib/libgmp.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
        ld: warning: ignoring file /opt/homebrew/lib/libpari.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
        ld: illegal thread local variable reference to regular symbol _avma for architecture x86_64
        clang: error: linker command failed with exit code 1 (use -v to see invocation)
        error: command '/usr/bin/clang' failed with exit code 1
        [end of output]
    
    note: This error originates from a subprocess, and is likely not a problem with pip.
  error: legacy-install-failure
  
  × Encountered error while trying to install package.
  ╰─> cypari2
  
  note: This is an issue with the package mentioned above, not pip.
  hint: See above for output from the failure.
  

  at ~/Library/Application Support/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1195 in _run
      1191│                 output = subprocess.check_output(
      1192│                     cmd, stderr=subprocess.STDOUT, **kwargs
      1193│                 )
      1194│         except CalledProcessError as e:
    → 1195│             raise EnvCommandError(e, input=input_)
      1196│ 
      1197│         return decode(output)
      1198│ 
      1199│     def execute(self, bin, *args, **kwargs):


Failed to add packages, reverting the pyproject.toml file to its original content.

clang Version

(backscope-xBHlVOM6-py3.10) liam@ratbook backscope % clang --version
Apple clang version 13.0.0 (clang-1300.0.27.3)
Target: arm64-apple-darwin21.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Where to go from here?

It seems like the error has to do with the .dylib files for GNU multiple precision arithmetic library (a dependency of PARI/GP) and PARI/GP installed via Homebrew being incompatible with what is being linked. If this the case, then I guess this isn't an issue with cypari2 per se, but I'm not sure where else I would ask for help. Again, any advice or directions would be greatly appreciated. Thanks in advance! :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions