Repository: pyscf/pyscf

Issue #1405: PySCF 2.1.0 wheels for MacOS and python > 3.7 don't install
Created: 2022-09-06T14:48:45Z
The pyscf 2.1.0 distribution for MacOS changed the scipy requirements from scipy (!=1.5.0,!=1.5.1) to scipy (<=1.1.0).
However there is no scipy (<=1.1.0) distribution for python > 3.7 under MacOS.
For the MacOS, under python 3.8, it reverts to pyscf 2.0.1 and works, however for python 3.10, it can't install the only wheel existent for python 3.10 and fails.
Scipy <= 1.1.0 is very old and while there are wheels for python <=3.7, there aren't any for python > 3.7
So it seems to me that the current MacOS wheels for python > 3.7 don't work.

Duplicate issue #1425: Failure pip installing pyscf
Created: 2022-09-14T09:21:45Z
Hi, I'm having a weird failure I had not encountered before installing pyscf. I am just running pip install pyscf, and initially the output I get seems fine
Collecting pyscf
  Using cached pyscf-2.1.0-cp39-cp39-macosx_10_15_x86_64.whl (25.8 MB)
Requirement already satisfied: numpy!=1.16,!=1.17,>=1.13 in /Users/pablo_1/opt/miniconda3/lib/python3.9/site-packages (from pyscf) (1.23.1)
Requirement already satisfied: h5py>=2.7 in /Users/.../opt/miniconda3/lib/python3.9/site-packages (from pyscf) (3.7.0)
Collecting scipy<=1.1.0
  Using cached scipy-1.1.0.tar.gz (15.6 MB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: scipy
  Building wheel for scipy (setup.py) ... 

but then this wheel fails, and I get a ton of
gfortran: internal compiler error: Abort trap: 6 signal terminated program f951
      Please submit a full bug report,
      with preprocessed source if appropriate.
      See <https://github.com/Homebrew/homebrew-core/issues> for instructions.
      dyld[69942]: Library not loaded: '/usr/local/opt/isl/lib/libisl.19.dylib'
        Referenced from: '/usr/local/Cellar/gcc/8.3.0/libexec/gcc/x86_64-apple-darwin18.2.0/8.3.0/f951'
        Reason: tried: '/usr/local/opt/isl/lib/libisl.19.dylib' (no such file), '/usr/local/lib/libisl.19.dylib' (no such file), '/usr/lib/libisl.19.dylib' (no such file), '/usr/local/Cellar/isl/0.22.1/lib/libisl.19.dylib' (no such file), '/usr/local/lib/libisl.19.dylib' (no such file), '/usr/lib/libisl.19.dylib' (no such file)

messages and
gfortran: internal compiler error: Abort trap: 6 signal terminated program f951
      Please submit a full bug report,
      with preprocessed source if appropriate.
      See <https://github.com/Homebrew/homebrew-core/issues> for instructions.
      error: Command "/usr/local/bin/gfortran -Wall -g -ffixed-form -fno-second-underscore -fPIC -O3 -funroll-loops -I/Users/pablo_1/opt/miniconda3/lib/python3.9/site-packages/numpy/core/include -Ibuild/src.macosx-10.9-x86_64-3.9/numpy/distutils/include -c -c scipy/fftpack/src/dfftpack/dcosqb.f -o build/temp.macosx-10.9-x86_64-cpython-39/scipy/fftpack/src/dfftpack/dcosqb.o" failed with exit status 4
      INFO:
      ########### CLIB COMPILER OPTIMIZATION ###########
      INFO: Platform      :
        Architecture: x64
        Compiler    : clang
      
      CPU baseline  :
        Requested   : 'min'
        Enabled     : SSE SSE2 SSE3
        Flags       : -msse -msse2 -msse3
        Extra checks: none
      
      CPU dispatch  :
        Requested   : 'max -xop -fma4'
        Enabled     : SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 AVX512F AVX512CD AVX512_KNL AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL
        Generated   : none
      INFO: CCompilerOpt.cache_flush[857] : write cache to path -> /private/var/folders/yw/g52bzl910kz1t3sdk0h_ydn80000gp/T/pip-install-xgkl14gz/scipy_e38b217a4bf4468ebc23e99bd634838e/build/temp.macosx-10.9-x86_64-cpython-39/ccompiler_opt_cache_clib.py
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for scipy
  Running setup.py clean for scipy
  error: subprocess-exited-with-error
  
  × python setup.py clean did not run successfully.
  │ exit code: 1
  ╰─> [11 lines of output]
      /private/var/folders/yw/g52bzl910kz1t3sdk0h_ydn80000gp/T/pip-install-xgkl14gz/scipy_e38b217a4bf4468ebc23e99bd634838e/setup.py:114: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
        import imp
      
      `setup.py clean` is not supported, use one of the following instead:
      
        - `git clean -xdf` (cleans all files)
        - `git clean -Xdf` (cleans all versioned files, doesn't touch
                            files that aren't checked into the git repo)
      
      Add `--force` to your command to use it anyway if you must (unsupported).
      
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed cleaning build dir for scipy

Failed to build scipy
Installing collected packages: scipy, pyscf
  Attempting uninstall: scipy
    Found existing installation: scipy 1.8.1
    Uninstalling scipy-1.8.1:
      Successfully uninstalled scipy-1.8.1
  Running setup.py install for scipy ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for scipy did not run successfully.
  │ exit code: 1
  ╰─> [520 lines of output]
      /private/var/folders/yw/g52bzl910kz1t3sdk0h_ydn80000gp/T/pip-install-xgkl14gz/scipy_e38b217a4bf4468ebc23e99bd634838e/setup.py:114: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
        import imp
      
      Note: if you need reliable uninstall behavior, then install
      with pip instead of using `setup.py install`:
      
        - `pip install .`       (from a git repo or downloaded source
                                 release)
        - `pip install scipy`   (last SciPy release on PyPI)
      
      
      /private/var/folders/yw/g52bzl910kz1t3sdk0h_ydn80000gp/T/pip-install-xgkl14gz/scipy_e38b217a4bf4468ebc23e99bd634838e/setup.py:450: DeprecationWarning:
      
        `numpy.distutils` is deprecated since NumPy 1.23.0, as a result
        of the deprecation of `distutils` itself. It will be removed for
        Python >= 3.12. For older Python versions it will remain present.
        It is recommended to use `setuptools < 60.0` for those Python versions.
        For more details, see:
          https://numpy.org/devdocs/reference/distutils_status_migration.html

Then some info lines and ending with
error: Command "/usr/local/bin/gfortran -Wall -g -ffixed-form -fno-second-underscore -fPIC -O3 -funroll-loops -I/Users/pablo_1/opt/miniconda3/lib/python3.9/site-packages/numpy/core/include -Ibuild/src.macosx-10.9-x86_64-3.9/numpy/distutils/include -c -c scipy/fftpack/src/dfftpack/dcosqb.f -o build/temp.macosx-10.9-x86_64-cpython-39/scipy/fftpack/src/dfftpack/dcosqb.o" failed with exit status 4
      INFO:
      ########### CLIB COMPILER OPTIMIZATION ###########
      INFO: Platform      :
        Architecture: x64
        Compiler    : clang
      
      CPU baseline  :
        Requested   : 'min'
        Enabled     : SSE SSE2 SSE3
        Flags       : -msse -msse2 -msse3
        Extra checks: none
      
      CPU dispatch  :
        Requested   : 'max -xop -fma4'
        Enabled     : SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 AVX512F AVX512CD AVX512_KNL AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL
        Generated   : none
      INFO: CCompilerOpt.cache_flush[857] : write cache to path -> /private/var/folders/yw/g52bzl910kz1t3sdk0h_ydn80000gp/T/pip-install-xgkl14gz/scipy_e38b217a4bf4468ebc23e99bd634838e/build/temp.macosx-10.9-x86_64-cpython-39/ccompiler_opt_cache_clib.py
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  Rolling back uninstall of scipy
  Moving to /Users/pablo_1/opt/miniconda3/lib/python3.9/site-packages/scipy-1.8.1.dist-info/
   from /Users/pablo_1/opt/miniconda3/lib/python3.9/site-packages/~cipy-1.8.1.dist-info
  Moving to /Users/pablo_1/opt/miniconda3/lib/python3.9/site-packages/scipy/
   from /Users/pablo_1/opt/miniconda3/lib/python3.9/site-packages/~cipy
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> scipy

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Any reason why this might be? The only change I have done recently is updating my Macos Intel to macOS Monterey 12.6. Not sure this should matter though.

Closing comment (2022-09-14T09:56:45Z): Maybe related to #1405 (comment)?
At least this seems to solve the problem, but using python 3.7.