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

Use osx_framework_user and osx_framework_library for Command Line Tools Python #9844

Merged
merged 3 commits into from
Jul 12, 2021

Conversation

uranusjr
Copy link
Member

A part of #9839 (comment).

@uranusjr uranusjr added this to the 21.1 milestone Apr 25, 2021
@sbidoul sbidoul modified the milestones: 21.1, 21.1.1 Apr 25, 2021
news/9844.bugfix.rst Outdated Show resolved Hide resolved
Copy link
Member

@pradyunsg pradyunsg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change LGTM!

@uranusjr uranusjr changed the title Use osx_framework_user for Mac framework build Use osx_framework_user and osx_framework_library for Command Line Tools Python Apr 26, 2021
@uranusjr
Copy link
Member Author

I’ve added a commit to incorporate the osx_framework_library scheme. @pradyunsg @rotu could you test if this quelch all warnings on the built-in Python on the following conditions?

  • pip install --user
  • pip install in a virtual environment
  • sudo pip install (Is this possible? Don’t do this if you don’t want to, and make sure to install only something easy to remove afterwards.)

@rotu
Copy link

rotu commented Apr 27, 2021

Installed this PR via /usr/bin/python3 -m pip install git+https:/pypa/pip.git@refs/pull/9844/merge.

We're getting closer!

/usr/bin/python3 -m pip install setuptools --user

Requirement already satisfied: setuptools in ./Library/Python/3.8/lib/python/site-packages (56.0.0)
WARNING: Value for scheme.headers does not match. Please report this to <https:/pypa/pip/issues/9617>
distutils: /Users/dan/Library/Python/3.8/include/python3.8/UNKNOWN
sysconfig: /Users/dan/Library/Python/3.8/include/UNKNOWN
WARNING: Additional context:
user = True
home = None
root = None
prefix = None

./venv/bin/python3 -m pip install setuptools

Requirement already satisfied: setuptools in ./venv/lib/python3.8/site-packages (41.2.0)

sudo -H /usr/bin/python3 -m pip install setuptools (I live dangerously)

Requirement already satisfied: setuptools in /Library/Python/3.8/site-packages (41.2.0)
WARNING: Running pip as root will break packages and permissions. You should install packages reliably by using venv: https://pip.pypa.io/warnings/venv

There are still significant problems with Homebrew's installed Python. Not sure if that's in scope but here's the output just in case:

/usr/local/bin/python3 -m pip install setuptools

WARNING: Value for scheme.platlib does not match. Please report this to <https:/pypa/pip/issues/9617>
distutils: /usr/local/lib/python3.9/site-packages
sysconfig: /usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages
WARNING: Value for scheme.purelib does not match. Please report this to <https:/pypa/pip/issues/9617>
distutils: /usr/local/lib/python3.9/site-packages
sysconfig: /usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages
WARNING: Value for scheme.headers does not match. Please report this to <https:/pypa/pip/issues/9617>
distutils: /usr/local/include/python3.9/UNKNOWN
sysconfig: /usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/include/python3.9/UNKNOWN
WARNING: Value for scheme.scripts does not match. Please report this to <https:/pypa/pip/issues/9617>
distutils: /usr/local/bin
sysconfig: /usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/bin
WARNING: Value for scheme.data does not match. Please report this to <https:/pypa/pip/issues/9617>
distutils: /usr/local
sysconfig: /usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.9
WARNING: Additional context:
user = False
home = None
root = None
prefix = None
Requirement already satisfied: setuptools in /usr/local/lib/python3.9/site-packages (56.0.0)

/usr/local/bin/python3 -m pip install setuptools --user

Requirement already satisfied: setuptools in /usr/local/lib/python3.9/site-packages (56.0.0)
WARNING: Value for scheme.headers does not match. Please report this to <https:/pypa/pip/issues/9617>
distutils: /Users/dan/Library/Python/3.9/include/python3.9/UNKNOWN
sysconfig: /Users/dan/Library/Python/3.9/include/UNKNOWN
WARNING: Additional context:
user = True
home = None
root = None
prefix = None

@uranusjr
Copy link
Member Author

uranusjr commented Apr 27, 2021

Yeah Homebrew is hopeless, it’s impossible to fix it in pip so I’ll just add an exception for it and talk to them directly to resolve this.

The built-in one’s --user thing confuses me though. Would it be possible for you to upload sysconfig.py and distutils/command/install.py somewhere? Apple might be doing something wrong here…

@rotu
Copy link

rotu commented Apr 27, 2021

You got it:
sysconfig.py.zip
install.py.zip

This also seems possibly relevant, found at /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/config-3.8-darwin
config-3.8-darwin.zip

@uranusjr
Copy link
Member Author

Interesting… so it seems like osx_framework_user is just simply wrong (or delibrately breaking backwards compatibility). For all other schemes, sysconfig.get_path('include') is exactly one directory up comapred to distutils’s headers value, but osx_framework_user omits the python{py_version_short} part and is two directories up.

I guess all we can do is bubble this issue to CPython, and add an exception to suppress the warning for now.

@sbidoul
Copy link
Member

sbidoul commented Apr 29, 2021

I removed from the 21.1.1 milestone (replaced by #9912).

@uranusjr
Copy link
Member Author

uranusjr commented May 4, 2021

I’ve forwarded the os_framework_user issue as b.p.o-43948. No response as of now though, I’ll probably just create a PR to “fix” this to force to conversation forward.

@uranusjr uranusjr added this to the 21.2 milestone Jul 12, 2021
@uranusjr uranusjr merged commit ad9d46e into pypa:main Jul 12, 2021
@uranusjr uranusjr deleted the sysconfig-framework-user branch July 12, 2021 06:00
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants