Opened 4 years ago

Closed 4 years ago

#62523 closed defect (duplicate)

py39-matplotlib 3.3.4 fails to build on Lion

Reported by: RobK88 Owned by: reneeotten (Renee Otten)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: Lion Cc: michaelld (Michael Dickens)
Port: py-matplotlib py-numpy

Description

I am unable to build py39-matplotlib on Lion.

Here is the bottom part of "sudo port install -v py39-matplotlib"

UPDATING build/lib.macosx-10.7-x86_64-3.9/matplotlib/_version.py
set build/lib.macosx-10.7-x86_64-3.9/matplotlib/_version.py to '3.3.4'
running build_ext
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/__init__.py", line 22, in <module>
    from . import multiarray
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/multiarray.py", line 12, in <module>
    from . import overrides
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so, 2): Symbol not found: _environ
  Referenced from: /opt/local/lib/libgcc/libgfortran.5.dylib
  Expected in: flat namespace
 in /opt/local/lib/libgcc/libgfortran.5.dylib

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-matplotlib/py39-matplotlib/work/matplotlib-3.3.4/setup.py", line 256, in <module>
    setup(  # Finally, pass this all along to distutils to do the heavy lifting.
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 984, in run_command
    cmd_obj.ensure_finalized()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 107, in ensure_finalized
    self.finalize_options()
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-matplotlib/py39-matplotlib/work/matplotlib-3.3.4/setup.py", line 88, in finalize_options
    self.distribution.ext_modules[:] = [
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-matplotlib/py39-matplotlib/work/matplotlib-3.3.4/setup.py", line 91, in <listcomp>
    for ext in package.get_extensions()
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-matplotlib/py39-matplotlib/work/matplotlib-3.3.4/setupext.py", line 345, in get_extensions
    add_numpy_flags(ext)
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-matplotlib/py39-matplotlib/work/matplotlib-3.3.4/setupext.py", line 468, in add_numpy_flags
    import numpy as np
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/__init__.py", line 145, in <module>
    from . import core
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/__init__.py", line 48, in <module>
    raise ImportError(msg)
ImportError: 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.9 from "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9"
  * The NumPy version is: "1.20.1"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so, 2): Symbol not found: _environ
  Referenced from: /opt/local/lib/libgcc/libgfortran.5.dylib
  Expected in: flat namespace
 in /opt/local/lib/libgcc/libgfortran.5.dylib

Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-matplotlib/py39-matplotlib/work/matplotlib-3.3.4" && /opt/local/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 setup.py --no-user-cfg build 
Exit code: 1
Error: Failed to build py39-matplotlib: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-matplotlib/py39-matplotlib/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets to report a bug.
Error: Processing of port py39-matplotlib failed

I tried uninstalling and reinstalling openBLAS and py39-numpy but that did not make a difference. The build for py39-matplotlib still failed with the same error.

I will attach main.log

Attachments (1)

main.log (200.9 KB) - added by RobK88 4 years ago.

Download all attachments as: .zip

Change History (8)

Changed 4 years ago by RobK88

Attachment: main.log added

comment:1 Changed 4 years ago by mf2k (Frank Schima)

Cc: reneeotten@… removed
Owner: set to reneeotten
Port: py-matplotlib added; py39-matplotlib removed
Status: newassigned

comment:2 Changed 4 years ago by reneeotten (Renee Otten)

Cc: michaelld added
Port: py-numpy added

from the log it appears that the problem is related to the installation of py-numpy, likely similarly to what happens on the Buildbots for 10.7 and earlier. Probably a duplicate of 59616.

I don't think it's a problem with py-matplotlib, but even if it were I don't have access to such old systems and don't know how to resolve this. If someone figures it out I am sure Michael is happy to commit it.

comment:3 Changed 4 years ago by RobK88

I do not think it is a duplicate of #59616. But it is probably related (probably Fortran related). I am able to build py-numpy and py39-numpy without any issues on my Mac running Lion 10.7.5.

bash-3.2$ sudo port clean  py39-numpy
--->  Cleaning py39-numpy
bash-3.2$ sudo port install  py39-numpy
--->  Computing dependencies for py39-numpy
--->  Fetching distfiles for py39-numpy
--->  Verifying checksums for py39-numpy
--->  Extracting py39-numpy
--->  Applying patches to py39-numpy
--->  Configuring py39-numpy
--->  Building py39-numpy
--->  Staging py39-numpy into destroot
--->  Installing py39-numpy @1.20.1_0+gfortran+openblas
--->  Activating py39-numpy @1.20.1_0+gfortran+openblas
--->  Cleaning py39-numpy
--->  Updating database of binaries
--->  Scanning binaries for linking errors
--->  No broken files found.                             
--->  No broken ports found.
bash-3.2$

bash-3.2$ sudo port clean py-numpy
--->  Cleaning py-numpy

bash-3.2$ sudo port install  py-numpy
--->  Computing dependencies for py-numpy
--->  Fetching distfiles for py-numpy
--->  Verifying checksums for py-numpy
--->  Extracting py-numpy
--->  Configuring py-numpy
--->  Building py-numpy
--->  Staging py-numpy into destroot
--->  Installing py-numpy @1.20.1_0
--->  Activating py-numpy @1.20.1_0
--->  Cleaning py-numpy
--->  Updating database of binaries
--->  Scanning binaries for linking errors
--->  No broken files found.                             
--->  No broken ports found.
bash-3.2$
Last edited 4 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:4 Changed 4 years ago by reneeotten (Renee Otten)

sure, you might be able to install py39-numpy (as a side note: installing a stub-port like py-numpy isn't very useful). The ticket I mentioned, and the issue you're having here, is that ports that require numpy fail to install because there is an issue when trying to import stuff from py-numpy.

If I were to guess the command python3.9 -c "from numpy.core import multiarray" will give you the same/similar error as you see above. So yes, it appears that you can install numpy but it didn't do so correctly.

comment:5 Changed 4 years ago by RobK88

Considering the possibility that numpy may be the source of the problem when building matplotlib using Macports, I uninstalled py-numpy and py39-numpy using Macports.

Then I tried to build and install numpy using pip3.

sudo -H pip install -U numpy

The build of numpy 1.20.1 failed using pip3 on my Mac running Lion.

I thought I might be able to get around this bug using pip3. It was worth a try.

comment:6 Changed 4 years ago by RobK88

FYI -- below is the output of python3.9 -c "from numpy.core import multiarray" on my Mac running Lion.

You were right. The same error is generated!

bash-3.2$ python3.9 -c "from numpy.core import multiarray"
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/__init__.py", line 22, in <module>
    from . import multiarray
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/multiarray.py", line 12, in <module>
    from . import overrides
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so, 2): Symbol not found: _environ
  Referenced from: /opt/local/lib/libgcc/libgfortran.5.dylib
  Expected in: flat namespace
 in /opt/local/lib/libgcc/libgfortran.5.dylib

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/__init__.py", line 145, in <module>
    from . import core
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/__init__.py", line 48, in <module>
    raise ImportError(msg)
ImportError: 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.9 from "/opt/local/bin/python3.9"
  * The NumPy version is: "1.20.1"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so, 2): Symbol not found: _environ
  Referenced from: /opt/local/lib/libgcc/libgfortran.5.dylib
  Expected in: flat namespace
 in /opt/local/lib/libgcc/libgfortran.5.dylib

bash-3.2$ 

comment:7 Changed 4 years ago by reneeotten (Renee Otten)

Resolution: duplicate
Status: assignedclosed
Note: See TracTickets for help on using tickets.