Skip to content

libpython shared library cannot be found by python3-config on Mac #879

Description

@astrobatty

python3-config --ldflag reports -L/opt/miniconda3/lib/python3.12/config-3.12-darwin -ldl -framework CoreFoundation on Mac. However, libpython is not included in -L, so linking to the conda python shared library is impossible.

For reference, the brew installed python creates a symlink to libpython in the library returned by python3-config.

$ python3.13-config --ldflags
-L/opt/homebrew/opt/python@3.13/Frameworks/Python.framework/Versions/3.13/lib/python3.13/config-3.13-darwin -ldl -framework CoreFoundation

$ ls -lhg /opt/homebrew/opt/python@3.13/Frameworks/Python.framework/Versions/3.13/lib/python3.13/config-3.13-darwin
total 552
-rw-r--r--@ 1 admin   3.5K Feb  4  2025 config.c
-rw-r--r--@ 1 admin   1.7K Feb  4  2025 config.c.in
-rwxr-xr-x@ 1 admin    15K Feb  4  2025 install-sh
lrwxr-xr-x@ 1 admin    15B Feb  4  2025 libpython3.13.a -> ../../../Python
lrwxr-xr-x@ 1 admin    15B Feb  4  2025 libpython3.13.dylib -> ../../../Python
-rw-r--r--@ 1 admin   201K Feb 17  2025 Makefile
-rwxr-xr-x@ 1 admin   8.8K Feb  4  2025 makesetup
-rwxr-xr-x@ 1 admin   2.1K Feb 17  2025 python-config.py
-rw-r--r--@ 1 admin   3.8K Feb  4  2025 python.o
-rw-r--r--@ 1 admin    11K Feb  4  2025 Setup
-rw-r--r--@ 1 admin   954B Feb  4  2025 Setup.bootstrap
-rw-r--r--@ 1 admin    41B Feb  4  2025 Setup.local
-rw-r--r--@ 1 admin   6.6K Feb  4  2025 Setup.stdlib

Conda Info

active environment : base
    active env location : /opt/miniconda3
            shell level : 1
       user config file : /Users/batty/.condarc
 populated config files : /opt/miniconda3/.condarc
                          /Users/batty/.condarc
          conda version : 24.9.2
    conda-build version : not installed
         python version : 3.12.7.final.0
                 solver : classic
       virtual packages : __archspec=1=m1
                          __conda=24.9.2=0
                          __osx=15.7.7=0
                          __unix=0=0
       base environment : /opt/miniconda3  (writable)
      conda av data dir : /opt/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-arm64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/osx-arm64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-arm64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /opt/miniconda3/pkgs
                          /Users/batty/.conda/pkgs
       envs directories : /opt/miniconda3/envs
                          /Users/batty/.conda/envs
               platform : osx-arm64
             user-agent : conda/24.9.2 requests/2.32.3 CPython/3.12.7 Darwin/24.6.0 OSX/15.7.7 aau/0.4.4 c/. s/. e/.
                UID:GID : 501:20
             netrc file : None
           offline mode : False

Note: reposting https://github.com/conda/conda/issues/16177#issuecomment-4649074170

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