-
Notifications
You must be signed in to change notification settings - Fork 121
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
venv initialisation fails when build is installed in user library #310
Comments
Thank you for the report. I believe the issue here is that because you installed build in the user library, the user scheme ends up being used when retrieving the venv paths. We should be overriding the scheme on Line 249 in 781c0f1
|
Actually, it's the |
Technically a venv can be created with |
Apple patch |
Urgh, in that case I guess it's best to hard-code |
Or you know, just use virtualenv that has this patch-ed and handled 😎 @deprekate do you still get the issue when you install |
Unfortunately, virtualenv has also fallen victim to Apple's machinations: #294. |
I think this issue should be split into two parts:
This probably needs to be escalated to the broader packaging community and potentially CPython core devs, depending on how people think we solution should be. |
Apple's
Apple breaks the core assumption that the platform scheme and virtual environment scheme are the same. In Seeing as not everybody has access to macOS, this is what Apple's _INSTALL_SCHEMES = {
...,
'osx_framework_library': {
'stdlib': '{installed_base}/lib/python{py_version_short}',
'platstdlib': '{platbase}/lib/python{py_version_short}',
'purelib': '/Library/Python/{py_version_short}/site-packages',
'platlib': '/Library/Python/{py_version_short}/site-packages',
'include': '/Library/Python/{py_version_short}{abiflags}/include',
'platinclude': '/Library/Python/{py_version_short}{abiflags}/include',
'scripts': '/usr/local/bin',
'data': '/Library/Python/{py_version_short}',
},
}
def _use_darwin_global_library():
if sys.platform == 'darwin' and sys._framework:
prefix = os.path.dirname(sys.prefix)
framework_versions = sys._framework + '.framework/Versions'
if prefix.endswith(framework_versions):
frameworks = os.path.dirname(os.path.dirname(prefix))
if (frameworks in
['/System/Library/Frameworks',
'/AppleInternal/Library/Frameworks',
'/Library/Frameworks',
'/Library/Developer/CommandLineTools/Library/Frameworks']):
return True
if frameworks.endswith('.app/Contents/Developer/Library/Frameworks'):
return True
return False
def _get_default_scheme():
if _use_darwin_global_library():
return 'osx_framework_library'
if os.name == 'posix':
# the default scheme for posix is posix_prefix
return 'posix_prefix'
return os.name |
You probably meant
The PEP wording is a bit ambiguous to me, to be honest. It is kind of speaking under the assumption that each platform has one (default) installation layout, which is not true for downstream distributed Pythons. As far as I am aware, almost all Linux distribution-distributed Python installations would unfortunately fail under your interpretation, including Debian, Red Hat, etc., because they all use a vendor-defined default scheme, but uses |
AFAIK Linux distros do not accomplish this by varying the default scheme although it is conceivable that they might do that in Python 3.10. I think it'd be informative to know how they approach this in some more detail - it'll help with what we decide to do here. |
Oh! So I misunderstood the issue entirely. Thanks for the correction. So to make sure I’m on the correct page, Apple’s system Python returns I proposed a while ago that a virtual environment tool should record what scheme it is creating the virtual environment as in |
That is correct.
I would instead propose to copy the default |
Right, PyPy3 uses a scheme for venvs which diverges from |
It definitely is unsatisfactory. Maybe it’s time to bring up the topic putting |
As a virtualenv maintainer, I'd accept such PR, though I have no powers over venv... |
Thank you for providing feedback on Python packaging!
To help us help you, please fill out as much of the following as you can. If a question is not relevant, feel free to skip it.
What is your operating system and version?
This issue is for trying to get it run on OSX Big Sur (I've commented on the other [closed] issues with the errors I get when trying on various linux machines)
What is your Python version?
Python 3.8.2
What version of pip do you have?
pip 21.1.2 from /Users/katelyn/Library/Python/3.8/lib/python/site-packages/pip (python 3.8)
If following an online tutorial or guide, please provide a link to the page or section giving you trouble:
https://packaging.python.org/tutorials/packaging-projects/
I guess pypa uses hardcoded paths? So I tried to symlink the correct structure:
Just more errors down the rabbit hole:
The text was updated successfully, but these errors were encountered: