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

MacOS Big Sur PyDIP installation #63

Closed
sivlab opened this issue Nov 27, 2020 · 5 comments
Closed

MacOS Big Sur PyDIP installation #63

sivlab opened this issue Nov 27, 2020 · 5 comments
Labels
bug component:building About building the project component:PyDIP About the PyDIP Python interface

Comments

@sivlab
Copy link

sivlab commented Nov 27, 2020

I'm trying to install diplib + PyDIP on my system following the "INSTALL_MacOS.md" file. But I have problem when I try to install PyDIP or try to generate its wheel.

In detail, the commands:

mkdir src
cd src
git clone https://github.com/DIPlib/diplib.git
mkdir diplib/target
cd diplib/target
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/dip -DCMAKE_CXX_FLAGS="-march=native"
make -j check
make -j install

work fine and, in fact, I have the binaries in my $HOME/dip (and they are executable, e.g. )

But when I try to run:
make pip_install

I have the following output/problem:

make pip_install
[ 17%] Built target jpeg
[ 23%] Built target zlibstatic
[ 35%] Built target tiff
[ 39%] Built target libics
[ 91%] Built target DIP
[ 96%] Built target DIPviewer
[ 96%] Built target PyDIPviewer
[100%] Built target PyDIP_bin
[100%] Built target PyDIP
[100%] Built target staging
/usr/local/anaconda3/lib/python3.8/site-packages/setuptools/dist.py:452: UserWarning: Normalizing '3.0.b8' to '3.0b8'
  warnings.warn(tmpl.format(**locals()))
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.8
creating build/lib.macosx-10.9-x86_64-3.8/diplib
copying diplib/loadjvm.py -> build/lib.macosx-10.9-x86_64-3.8/diplib
copying diplib/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/diplib
copying diplib/PyDIP_py.py -> build/lib.macosx-10.9-x86_64-3.8/diplib
copying diplib/__main__.py -> build/lib.macosx-10.9-x86_64-3.8/diplib
copying diplib/PyDIPviewer.cpython-38-darwin.so -> build/lib.macosx-10.9-x86_64-3.8/diplib
copying diplib/PyDIP_bin.cpython-38-darwin.so -> build/lib.macosx-10.9-x86_64-3.8/diplib
running build_ext
installing to build/bdist.macosx-10.9-x86_64/wheel
running install
running install_lib
creating build/bdist.macosx-10.9-x86_64
creating build/bdist.macosx-10.9-x86_64/wheel
creating build/bdist.macosx-10.9-x86_64/wheel/diplib
copying build/lib.macosx-10.9-x86_64-3.8/diplib/PyDIPviewer.cpython-38-darwin.so -> build/bdist.macosx-10.9-x86_64/wheel/diplib
copying build/lib.macosx-10.9-x86_64-3.8/diplib/loadjvm.py -> build/bdist.macosx-10.9-x86_64/wheel/diplib
copying build/lib.macosx-10.9-x86_64-3.8/diplib/__init__.py -> build/bdist.macosx-10.9-x86_64/wheel/diplib
copying build/lib.macosx-10.9-x86_64-3.8/diplib/PyDIP_py.py -> build/bdist.macosx-10.9-x86_64/wheel/diplib
copying build/lib.macosx-10.9-x86_64-3.8/diplib/PyDIP_bin.cpython-38-darwin.so -> build/bdist.macosx-10.9-x86_64/wheel/diplib
copying build/lib.macosx-10.9-x86_64-3.8/diplib/__main__.py -> build/bdist.macosx-10.9-x86_64/wheel/diplib
running install_egg_info
running egg_info
creating diplib.egg-info
writing diplib.egg-info/PKG-INFO
writing dependency_links to diplib.egg-info/dependency_links.txt
writing top-level names to diplib.egg-info/top_level.txt
writing manifest file 'diplib.egg-info/SOURCES.txt'
reading manifest file 'diplib.egg-info/SOURCES.txt'
writing manifest file 'diplib.egg-info/SOURCES.txt'
Copying diplib.egg-info to build/bdist.macosx-10.9-x86_64/wheel/diplib-3.0b8-py3.8.egg-info
running install_scripts
[WARNING] This wheel needs a higher macOS version than the version your Python interpreter is compiled against.  To silence this warning, set MACOSX_DEPLOYMENT_TARGET to at least 11_0 or recreate these files with lower MACOSX_DEPLOYMENT_TARGET:
build/bdist.macosx-10.9-x86_64/wheel/diplib/PyDIPviewer.cpython-38-darwin.so
build/bdist.macosx-10.9-x86_64/wheel/diplib/PyDIP_bin.cpython-38-darwin.soTraceback (most recent call last):
  File "../setup.py", line 69, in <module>
    setup(**setup_kwargs)
  File "/usr/local/anaconda3/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/anaconda3/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/local/anaconda3/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/local/anaconda3/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/local/anaconda3/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 328, in run
    impl_tag, abi_tag, plat_tag = self.get_tag()
  File "/usr/local/anaconda3/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 278, in get_tag
    assert tag in supported_tags, "would build wheel with unsupported tag {}".format(tag)
AssertionError: would build wheel with unsupported tag ('cp38', 'cp38', 'macosx_11_0_x86_64')
make[3]: *** [pydip/CMakeFiles/bdist_wheel] Error 1
make[2]: *** [pydip/CMakeFiles/bdist_wheel.dir/all] Error 2
make[1]: *** [pydip/CMakeFiles/pip_install.dir/rule] Error 2
make: *** [pip_install] Error 2

System information:

  • What OS do you have?:
sw_vers
ProductName:	macOS
ProductVersion:	11.0.1
BuildVersion:	20B29
  • If PyDIP, what version of Python do you have?:
python -V
Python 3.8.5
@crisluengo
Copy link
Member

This is weird, I don't know what could be the cause. The error

AssertionError: would build wheel with unsupported tag ('cp38', 'cp38', 'macosx_11_0_x86_64')

could be related to this earlier warning:

[WARNING] This wheel needs a higher macOS version than the version your Python interpreter is compiled against. To silence this warning, set MACOSX_DEPLOYMENT_TARGET to at least 11_0 or recreate these files with lower MACOSX_DEPLOYMENT_TARGET:

I also see that the directory lib.macosx-10.9-x86_64-3.8 is created, which seems to be explicitly for macOS 10.9, not 11.0 as referenced in the tag (which matches your OS version number).

If I decode these hints right, I think we need to explicitly target macOS 10.9 in the build. Please try setting the CMAKE_OSX_DEPLOYMENT_TARGET variable in cmake:

cmake . -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9

and then recompiling. (Running cmake like this, referencing the build directory with . rather than the source directory, will add to the existing configuration. Thus, your original settings for CMAKE_INSTALL_PREFIX and CMAKE_CXX_FLAGS` will be preserved.)

If this works, please report back, I presume other people upgrading to Big Sur will have the same issue.

@crisluengo
Copy link
Member

There seems to be a problem with Python packaging on Big Sur:
pypa/pip#9138
pypa/packaging#319

We're about to release Python 3.9.1rc1 which is the first release to attempt to fully support macOS 11.0

You might need to add --platform macosx_10_9_x86_64 to the pip install command, I'm not sure.

@crisluengo crisluengo added bug component:PyDIP About the PyDIP Python interface labels Nov 28, 2020
@sivlab
Copy link
Author

sivlab commented Dec 3, 2020

TLTR

After some trial and error I figured out the right combination on my system (using homebrew as package manager):

  • python (latest) version 3.9.0 and numpy (latest) version 1.19.4 -> errors on step "make pip_install"
  • python (latest) version 3.9.0 and numpy version 1.18.0 -> errors installing numpy with "pip install numpy==1.18.0"
  • python version 3.7.9 and numpy (latest) version 1.19.4 -> errors on importing numpy
  • python (latest) version 3.7.9 and numpy version 1.18.0 -> right combination

So, the full sequence of commands (installing python with homebrew):

#install last version of python from homebrew
brew install [email protected]
echo 'export PATH="/usr/local/opt/[email protected]/libexec/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

# check python version
python -V
Python 3.7.9

# install and check numpy version -> errors
pip install numpy
python -c "import numpy ; print(numpy.version.version)"
1.18.0

# installing diplib
mkdir src
cd src
git clone https://github.com/DIPlib/diplib.git
mkdir diplib/target
cd diplib/target

cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/dip -DCMAKE_CXX_FLAGS="-march=native" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 #no errors

make -j check #no errors

make -j install #no errors

make pip_install # no errors

# test import diplib -> no errors
python -c "import diplib"


For completeness, in the following there are the complete log of the several trial:

  • python (latest) version 3.9.0 and numpy (latest) version 1.19.4:
#install last version of python from homebrew
brew install python
echo 'export PATH="/usr/local/opt/[email protected]/libexec/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

# check python version
python -V
Python 3.9.0

# install and check numpy latest version
pip install numpy
python -c "import numpy ; print(numpy.version.version)"
1.19.4


# installing diplib
mkdir src
cd src
git clone https://github.com/DIPlib/diplib.git
mkdir diplib/target
cd diplib/target

cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/dip -DCMAKE_CXX_FLAGS="-march=native" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 #no errors

make -j check #no errors

make -j install #no errors

#errors
make pip_install
[ 17%] Built target jpeg
[ 23%] Built target zlibstatic
[ 36%] Built target tiff
[ 40%] Built target libics
[ 91%] Built target DIP
[ 96%] Built target DIPviewer
[ 97%] Built target PyDIPviewer
[100%] Built target PyDIP_bin
[100%] Built target PyDIP
[100%] Built target staging
Scanning dependencies of target bdist_wheel
/usr/local/lib/python3.9/site-packages/setuptools/dist.py:452: UserWarning: Normalizing '3.0.b8' to '3.0b8'
  warnings.warn(tmpl.format(**locals()))
Traceback (most recent call last):
  File "/Users/sivlab/src/diplib/target/pydip/staging/../setup.py", line 67, in <module>
    name = os.path.join("/Users/sivlab/src/diplib/target/pydip", "staging", "dist", wheel_name(**setup_kwargs))
  File "/Users/sivlab/src/diplib/target/pydip/staging/../setup.py", line 14, in wheel_name
    tag = '-'.join(bdist_wheel_cmd.get_tag())
  File "/usr/local/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 252, in get_tag
    plat_name = get_platform(self.bdist_dir)
  File "/usr/local/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 48, in get_platform
    result = calculate_macosx_platform_tag(archive_root, result)
  File "/usr/local/lib/python3.9/site-packages/wheel/macosx_libfile.py", line 356, in calculate_macosx_platform_tag
    assert len(base_version) == 2
AssertionError
make[3]: *** [pydip/CMakeFiles/bdist_wheel] Error 1
make[2]: *** [pydip/CMakeFiles/bdist_wheel.dir/all] Error 2
make[1]: *** [pydip/CMakeFiles/pip_install.dir/rule] Error 2
make: *** [pip_install] Error 2

  • python (latest) version 3.9.0 and numpy version 1.18.0:
#install last version of python from homebrew
brew install python
echo 'export PATH="/usr/local/opt/[email protected]/libexec/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

# check python version
python -V
Python 3.9.0

# install and check numpy version 1.18.0 -> errors
pip install numpy==1.18.0

Collecting numpy==1.18.0
  Using cached numpy-1.18.0.zip (5.4 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/local/opt/[email protected]/bin/python3.9 /usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/tmpnj7_iirf
         cwd: /private/var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/pip-install-iyn13rgr/numpy_b7bb4435b32e41ae998342dd4aa052d6
    Complete output (210 lines):
    Running from numpy source directory.
    setup.py:425: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
      run_build = parse_setuppy_commands()
    Processing numpy/random/_bounded_integers.pxd.in
    Processing numpy/random/_philox.pyx
    Processing numpy/random/_bit_generator.pyx
    Processing numpy/random/_bounded_integers.pyx.in
    Processing numpy/random/_sfc64.pyx
    Processing numpy/random/_mt19937.pyx
    Processing numpy/random/mtrand.pyx
    Processing numpy/random/_generator.pyx
    Processing numpy/random/_pcg64.pyx
    Processing numpy/random/_common.pyx
    Cythonizing sources
    blas_opt_info:
    blas_mkl_info:
    customize UnixCCompiler
      libraries mkl_rt not found in ['/usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    blis_info:
      libraries blis not found in ['/usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    openblas_info:
      libraries openblas not found in ['/usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    atlas_3_10_blas_threads_info:
    Setting PTATLAS=ATLAS
      libraries tatlas not found in ['/usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    atlas_3_10_blas_info:
      libraries satlas not found in ['/usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    atlas_blas_threads_info:
    Setting PTATLAS=ATLAS
      libraries ptf77blas,ptcblas,atlas not found in ['/usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    atlas_blas_info:
      libraries f77blas,cblas,atlas not found in ['/usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    accelerate_info:
      libraries accelerate not found in ['/usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
    Library accelerate was not found. Ignoring
      libraries veclib not found in ['/usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
    Library veclib was not found. Ignoring
      FOUND:
        extra_compile_args = ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers']
        extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
        define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]

      FOUND:
        extra_compile_args = ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers']
        extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
        define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]

    /bin/sh: svnversion: command not found
    non-existing path in 'numpy/distutils': 'site.cfg'
    lapack_opt_info:
    lapack_mkl_info:
      libraries mkl_rt not found in ['/usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    openblas_lapack_info:
      libraries openblas not found in ['/usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    openblas_clapack_info:
      libraries openblas,lapack not found in ['/usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    flame_info:
      libraries flame not found in ['/usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    atlas_3_10_threads_info:
    Setting PTATLAS=ATLAS
      libraries lapack_atlas not found in /usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib
      libraries tatlas,tatlas not found in /usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib
      libraries lapack_atlas not found in /usr/local/lib
      libraries tatlas,tatlas not found in /usr/local/lib
      libraries lapack_atlas not found in /usr/lib
      libraries tatlas,tatlas not found in /usr/lib
    <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
      NOT AVAILABLE

    atlas_3_10_info:
      libraries lapack_atlas not found in /usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib
      libraries satlas,satlas not found in /usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib
      libraries lapack_atlas not found in /usr/local/lib
      libraries satlas,satlas not found in /usr/local/lib
      libraries lapack_atlas not found in /usr/lib
      libraries satlas,satlas not found in /usr/lib
    <class 'numpy.distutils.system_info.atlas_3_10_info'>
      NOT AVAILABLE

    atlas_threads_info:
    Setting PTATLAS=ATLAS
      libraries lapack_atlas not found in /usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib
      libraries ptf77blas,ptcblas,atlas not found in /usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib
      libraries lapack_atlas not found in /usr/local/lib
      libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
      libraries lapack_atlas not found in /usr/lib
      libraries ptf77blas,ptcblas,atlas not found in /usr/lib
    <class 'numpy.distutils.system_info.atlas_threads_info'>
      NOT AVAILABLE

    atlas_info:
      libraries lapack_atlas not found in /usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib
      libraries f77blas,cblas,atlas not found in /usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib
      libraries lapack_atlas not found in /usr/local/lib
      libraries f77blas,cblas,atlas not found in /usr/local/lib
      libraries lapack_atlas not found in /usr/lib
      libraries f77blas,cblas,atlas not found in /usr/lib
    <class 'numpy.distutils.system_info.atlas_info'>
      NOT AVAILABLE

      FOUND:
        extra_compile_args = ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers']
        extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
        define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]

    /usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py:274: UserWarning: Unknown distribution option: 'define_macros'
      warnings.warn(msg)
    running dist_info
    running build_src
    build_src
    building py_modules sources
    creating build
    creating build/src.macosx-11-x86_64-3.9
    creating build/src.macosx-11-x86_64-3.9/numpy
    creating build/src.macosx-11-x86_64-3.9/numpy/distutils
    building library "npymath" sources
    Traceback (most recent call last):
      File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
        main()
      File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 133, in prepare_metadata_for_build_wheel
        return hook(metadata_directory, config_settings)
      File "/private/var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/pip-build-env-e3u2_cwn/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 161, in prepare_metadata_for_build_wheel
        self.run_setup()
      File "/private/var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/pip-build-env-e3u2_cwn/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 253, in run_setup
        super(_BuildMetaLegacyBackend,
      File "/private/var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/pip-build-env-e3u2_cwn/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 145, in run_setup
        exec(compile(code, __file__, 'exec'), locals())
      File "setup.py", line 450, in <module>
        setup_package()
      File "setup.py", line 442, in setup_package
        setup(**metadata)
      File "/private/var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/pip-install-iyn13rgr/numpy_b7bb4435b32e41ae998342dd4aa052d6/numpy/distutils/core.py", line 171, in setup
        return old_setup(**new_attr)
      File "/private/var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/pip-build-env-e3u2_cwn/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "/usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/private/var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/pip-build-env-e3u2_cwn/overlay/lib/python3.9/site-packages/setuptools/command/dist_info.py", line 31, in run
        egg_info.run()
      File "/private/var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/pip-install-iyn13rgr/numpy_b7bb4435b32e41ae998342dd4aa052d6/numpy/distutils/command/egg_info.py", line 26, in run
        self.run_command("build_src")
      File "/usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/private/var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/pip-install-iyn13rgr/numpy_b7bb4435b32e41ae998342dd4aa052d6/numpy/distutils/command/build_src.py", line 146, in run
        self.build_sources()
      File "/private/var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/pip-install-iyn13rgr/numpy_b7bb4435b32e41ae998342dd4aa052d6/numpy/distutils/command/build_src.py", line 157, in build_sources
        self.build_library_sources(*libname_info)
      File "/private/var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/pip-install-iyn13rgr/numpy_b7bb4435b32e41ae998342dd4aa052d6/numpy/distutils/command/build_src.py", line 290, in build_library_sources
        sources = self.generate_sources(sources, (lib_name, build_info))
      File "/private/var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/pip-install-iyn13rgr/numpy_b7bb4435b32e41ae998342dd4aa052d6/numpy/distutils/command/build_src.py", line 380, in generate_sources
        source = func(extension, build_dir)
      File "numpy/core/setup.py", line 656, in get_mathlib_info
        st = config_cmd.try_link('int main(void) { return 0;}')
      File "/usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/config.py", line 241, in try_link
        self._check_compiler()
      File "/private/var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/pip-install-iyn13rgr/numpy_b7bb4435b32e41ae998342dd4aa052d6/numpy/distutils/command/config.py", line 82, in _check_compiler
        self.fcompiler = new_fcompiler(compiler=self.fcompiler,
      File "/private/var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/pip-install-iyn13rgr/numpy_b7bb4435b32e41ae998342dd4aa052d6/numpy/distutils/fcompiler/__init__.py", line 884, in new_fcompiler
        compiler = get_default_fcompiler(plat, requiref90=requiref90,
      File "/private/var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/pip-install-iyn13rgr/numpy_b7bb4435b32e41ae998342dd4aa052d6/numpy/distutils/fcompiler/__init__.py", line 855, in get_default_fcompiler
        compiler_type =  _find_existing_fcompiler(matching_compiler_types,
      File "/private/var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/pip-install-iyn13rgr/numpy_b7bb4435b32e41ae998342dd4aa052d6/numpy/distutils/fcompiler/__init__.py", line 806, in _find_existing_fcompiler
        c.customize(dist)
      File "/private/var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/pip-install-iyn13rgr/numpy_b7bb4435b32e41ae998342dd4aa052d6/numpy/distutils/fcompiler/__init__.py", line 530, in customize
        linker_so_flags = self.flag_vars.linker_so
      File "/private/var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/pip-install-iyn13rgr/numpy_b7bb4435b32e41ae998342dd4aa052d6/numpy/distutils/fcompiler/environment.py", line 40, in __getattr__
        return self._get_var(name, conf_desc)
      File "/private/var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/pip-install-iyn13rgr/numpy_b7bb4435b32e41ae998342dd4aa052d6/numpy/distutils/fcompiler/environment.py", line 56, in _get_var
        var = self._hook_handler(name, hook)
      File "/private/var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/pip-install-iyn13rgr/numpy_b7bb4435b32e41ae998342dd4aa052d6/numpy/distutils/fcompiler/__init__.py", line 709, in _environment_hook
        return hook()
      File "/private/var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/pip-install-iyn13rgr/numpy_b7bb4435b32e41ae998342dd4aa052d6/numpy/distutils/fcompiler/gnu.py", line 353, in get_flags_linker_so
        flags = GnuFCompiler.get_flags_linker_so(self)
      File "/private/var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/pip-install-iyn13rgr/numpy_b7bb4435b32e41ae998342dd4aa052d6/numpy/distutils/fcompiler/gnu.py", line 144, in get_flags_linker_so
        os.environ['MACOSX_DEPLOYMENT_TARGET'] = target
      File "/usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/os.py", line 684, in __setitem__
        value = self.encodevalue(value)
      File "/usr/local/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/os.py", line 756, in encode
        raise TypeError("str expected, not %s" % type(value).__name__)
    TypeError: str expected, not int
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/opt/[email protected]/bin/python3.9 /usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/dp/h_1zx5g10rx5kb57s8s4p_140000gn/T/tmpnj7_iirf Check the logs for full command output.

  • python version 3.7.9 and numpy (latest) version 1.19.4:
#install last version of python from homebrew
brew install [email protected]
echo 'export PATH="/usr/local/opt/[email protected]/libexec/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

# check python version
python -V
Python 3.7.9

# install and check numpy version -> errors
pip install numpy

python -c "import numpy ; print(numpy.version.version)"
Python(16769,0x1021dee00) malloc: can't allocate region
:*** mach_vm_map(size=18446744072563118080, flags: 100) failed (error code=3)
Python(16769,0x1021dee00) malloc: *** set a breakpoint in malloc_error_break to debug
init_dgelsd failed init
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/numpy/__init__.py", line 286, in <module>
    raise RuntimeError(msg)
RuntimeError: Polyfit sanity test emitted a warning, most likely due to using a buggy Accelerate backend. If you compiled yourself, see site.cfg.example for information. Otherwise report this to the vendor that provided NumPy.
RankWarning: Polyfit may be poorly conditioned

@crisluengo
Copy link
Member

Python 3.9.1 is out now, it is supposed to have fixed packaging issues on macOS Big Sur. I haven't upgraded my Mac yet (still on Mojave) so can't test this. Things work fine on Mojave with Python 3.9.1.

But in the mean time, builds for macOS on Travis are failing due to some issue with the NumPy package for the latest Python version.

@crisluengo
Copy link
Member

I have upgraded to Big Sur, and was able to build the Python bindings without any problems.

Travis is now also building correctly on macOS, for Python 3.7, 3.8 and 3.9.

I think any problems reported in this issue have been resolved in the latest Python builds. I'm closing this issue.

@crisluengo crisluengo added the component:building About building the project label Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component:building About building the project component:PyDIP About the PyDIP Python interface
Projects
None yet
Development

No branches or pull requests

2 participants