You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. I'm trying to create a Python 2 virtualenv on macOS Mojave and am running into an error.
bagel$ pip3 install --user virtualenv
<snipped>
WARNING: The script virtualenv is installed in'/Users/bagel/Library/Python/3.7/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed virtualenv-20.0.1
bagel$ pip3 list
Package Version
------------------ -------
appdirs 1.4.3
filelock 3.0.12
importlib-metadata 1.5.0
pip 19.3.1
setuptools 42.0.2
six 1.14.0
virtualenv 20.0.1
wheel 0.33.6
zipp 2.2.0
bagel$ which python2.7
/usr/bin/python2.7
bagel$ ~/Library/Python/3.7/bin/virtualenv -p python2.7 venv
PermissionError: [Errno 1] Operation not permitted: '/Users/bagel/Documents/projects/test/venv/bin/python'
It's worth noting that Python 2 is the system Python, while Python 3 is installed from Homebrew.
So basically we do not support with the rewrite the MacOs framework python. We'll need to fix this. In this particular case it seems that copying the file stats of the system python is not allowed, hence the above error.
I don't think this is fixed entirely. Virtualenv creation doesn't fail, but there are a lot of unexpected packages present. Also, is the venv creation output expected?
bagel$ ~/Library/Python/3.7/bin/virtualenv -p python2.7 venv
created virtual environment CPython2Posix(dest=/Users/bagel/Documents/projects/test/venv, clear=False, global=False) with seeder FromAppData pip=latest setuptools=latest wheel=latest app_data_dir=/Users/bagel/Library/Application Support/virtualenv/seed-v1 via=copy
bagel$ source venv/bin/activate
(venv) bagel$ pip list
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support forPython 2.7. More details about Python 2 supportin pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Package Version
-------------------------------------- --------
altgraph 0.10.2
bdist-mpkg 0.5.0
bonjour-py 0.3
macholib 1.5.1
matplotlib 1.3.1
modulegraph 0.10.4
numpy 1.8.0rc1
pip 20.0.2
py2app 0.7.3
pyobjc-core 2.5.1
pyobjc-framework-Accounts 2.5.1
pyobjc-framework-AddressBook 2.5.1
pyobjc-framework-AppleScriptKit 2.5.1
pyobjc-framework-AppleScriptObjC 2.5.1
pyobjc-framework-Automator 2.5.1
pyobjc-framework-CFNetwork 2.5.1
pyobjc-framework-Cocoa 2.5.1
pyobjc-framework-Collaboration 2.5.1
pyobjc-framework-CoreData 2.5.1
pyobjc-framework-CoreLocation 2.5.1
pyobjc-framework-CoreText 2.5.1
pyobjc-framework-DictionaryServices 2.5.1
pyobjc-framework-EventKit 2.5.1
pyobjc-framework-ExceptionHandling 2.5.1
pyobjc-framework-FSEvents 2.5.1
pyobjc-framework-InputMethodKit 2.5.1
pyobjc-framework-InstallerPlugins 2.5.1
pyobjc-framework-InstantMessage 2.5.1
pyobjc-framework-LatentSemanticMapping 2.5.1
pyobjc-framework-LaunchServices 2.5.1
pyobjc-framework-Message 2.5.1
pyobjc-framework-OpenDirectory 2.5.1
pyobjc-framework-PreferencePanes 2.5.1
pyobjc-framework-PubSub 2.5.1
pyobjc-framework-QTKit 2.5.1
pyobjc-framework-Quartz 2.5.1
pyobjc-framework-ScreenSaver 2.5.1
pyobjc-framework-ScriptingBridge 2.5.1
pyobjc-framework-SearchKit 2.5.1
pyobjc-framework-ServiceManagement 2.5.1
pyobjc-framework-Social 2.5.1
pyobjc-framework-SyncServices 2.5.1
pyobjc-framework-SystemConfiguration 2.5.1
pyobjc-framework-WebKit 2.5.1
pyOpenSSL 0.13.1
pyparsing 2.0.1
python-dateutil 1.5
pytz 2013.7
scipy 0.13.0b1
setuptools 44.0.0
six 1.4.1
vboxapi 1.0
wheel 0.34.2
xattr 0.6.4
However, the contents of the venv's site-packages are:
bagel$ ls venv/lib/python2.7/site-packages/
total 4.0K
drwxr-xr-x 7 bagel staff 224 Feb 11 10:42 pip
drwxr-xr-x 9 bagel staff 288 Feb 11 10:41 pip-20.0.2.dist-info
drwxr-xr-x 6 bagel staff 192 Feb 11 10:41 pkg_resources
drwxr-xr-x 43 bagel staff 1.4K Feb 11 10:41 setuptools
drwxr-xr-x 11 bagel staff 352 Feb 11 10:41 setuptools-44.0.0.dist-info
drwxr-xr-x 13 bagel staff 416 Feb 11 10:41 wheel
drwxr-xr-x 9 bagel staff 288 Feb 11 10:41 wheel-0.34.2.dist-info
-rw-r--r-- 1 bagel staff 126 Feb 11 10:41 easy_install.py
-rw-r--r-- 1 bagel staff 0 Feb 11 10:41 pip-20.0.2.dist-info.virtualenv
-rw-r--r-- 1 bagel staff 0 Feb 11 10:41 setuptools-44.0.0.dist-info.virtualenv
-rw-r--r-- 1 bagel staff 0 Feb 11 10:41 wheel-0.34.2.dist-info.virtualenv
I'm fairly certain the issue here is that site.py of the shipped python adds the global python to the sys path unconditionally (ignoring blatantly the enable global site packages flag within site.py 🤦♂️🤷♂️ macOS) so you're picking up things as that. We'll need to escape this in the custom shim site.py we ship 👍
"""Append module search paths for third-party packages to sys.path.***************************************************************** This module is automatically imported during initialization. *****************************************************************In earlier versions of Python (up to 1.5a3), scripts or modules thatneeded to use site-specific modules would place ``import site''somewhere near the top of their code. Because of the automaticimport, this is no longer necessary (but code that does it stillworks).This will append site-specific paths to the module search path. OnUnix (including Mac OSX), it starts with sys.prefix andsys.exec_prefix (if different) and appendslib/python<version>/site-packages as well as lib/site-python.On other platforms (such as Windows), it tries each of theprefixes directly, as well as with lib/site-packages appended. Theresulting directories, if they exist, are appended to sys.path, andalso inspected for path configuration files.A path configuration file is a file whose name has the form<package>.pth; its contents are additional directories (one per line)to be added to sys.path. Non-existing directories (ornon-directories) are never added to sys.path; no directory is added tosys.path more than once. Blank lines and lines beginning with'#' are skipped. Lines starting with 'import' are executed.For example, suppose sys.prefix and sys.exec_prefix are set to/usr/local and there is a directory /usr/local/lib/python2.5/site-packageswith three subdirectories, foo, bar and spam, and two pathconfiguration files, foo.pth and bar.pth. Assume foo.pth contains thefollowing: # foo package configuration foo bar bletchand bar.pth contains: # bar package configuration barThen the following directories are added to sys.path, in this order: /usr/local/lib/python2.5/site-packages/bar /usr/local/lib/python2.5/site-packages/fooNote that bletch is omitted because it doesn't exist; bar precedes foobecause bar.pth comes alphabetically before foo.pth; and spam isomitted because it is not mentioned in either path configuration file.After these path manipulations, an attempt is made to import a modulenamed sitecustomize, which can perform arbitrary additionalsite-specific customizations. If this import fails with anImportError exception, it is silently ignored."""importsysimportosimport__builtin__importtraceback# Prefixes for site-packages; add additional prefixes like /usr/local herePREFIXES= [sys.prefix, sys.exec_prefix]
# Enable per user site-packages directory# set it to False to disable the feature or True to force the featureENABLE_USER_SITE=None# for distutils.commands.install# These values are initialized by the getuserbase() and getusersitepackages()# functions, through the main() function when Python starts.USER_SITE=NoneUSER_BASE=Nonedefmakepath(*paths):
dir=os.path.join(*paths)
try:
dir=os.path.abspath(dir)
exceptOSError:
passreturndir, os.path.normcase(dir)
defabs__file__():
"""Set all module' __file__ attribute to an absolute path"""forminsys.modules.values():
ifhasattr(m, '__loader__'):
continue# don't mess with a PEP 302-supplied __file__try:
m.__file__=os.path.abspath(m.__file__)
except (AttributeError, OSError):
passdefremoveduppaths():
""" Remove duplicate entries from sys.path along with making them absolute"""# This ensures that the initial path provided by the interpreter contains# only absolute pathnames, even if we're running from the build directory.L= []
known_paths=set()
fordirinsys.path:
# Filter out duplicate paths (on case-insensitive file systems also# if they only differ in case); turn relative paths into absolute# paths.dir, dircase=makepath(dir)
ifnotdircaseinknown_paths:
L.append(dir)
known_paths.add(dircase)
sys.path[:] =Lreturnknown_pathsdef_init_pathinfo():
"""Return a set containing all existing directory entries from sys.path"""d=set()
fordirinsys.path:
try:
ifos.path.isdir(dir):
dir, dircase=makepath(dir)
d.add(dircase)
exceptTypeError:
continuereturnddefaddpackage(sitedir, name, known_paths):
"""Process a .pth file within the site-packages directory: For each line in the file, either combine it with sitedir to a path and add that to known_paths, or execute it if it starts with 'import '. """ifknown_pathsisNone:
_init_pathinfo()
reset=1else:
reset=0fullname=os.path.join(sitedir, name)
try:
f=open(fullname, "rU")
exceptIOError:
returnwithf:
forn, lineinenumerate(f):
ifline.startswith("#"):
continuetry:
ifline.startswith(("import ", "import\t")):
execlinecontinueline=line.rstrip()
dir, dircase=makepath(sitedir, line)
ifnotdircaseinknown_pathsandos.path.exists(dir):
sys.path.append(dir)
known_paths.add(dircase)
exceptExceptionaserr:
print>>sys.stderr, "Error processing line {:d} of {}:\n".format(
n+1, fullname)
forrecordintraceback.format_exception(*sys.exc_info()):
forlineinrecord.splitlines():
print>>sys.stderr, ' '+lineprint>>sys.stderr, "\nRemainder of file ignored"breakifreset:
known_paths=Nonereturnknown_pathsdefaddsitedir(sitedir, known_paths=None):
"""Add 'sitedir' argument to sys.path if missing and handle .pth files in 'sitedir'"""ifknown_pathsisNone:
known_paths=_init_pathinfo()
reset=1else:
reset=0sitedir, sitedircase=makepath(sitedir)
ifnotsitedircaseinknown_paths:
sys.path.append(sitedir) # Add path componenttry:
names=os.listdir(sitedir)
exceptos.error:
returndotpth=os.extsep+"pth"names= [namefornameinnamesifname.endswith(dotpth)]
fornameinsorted(names):
addpackage(sitedir, name, known_paths)
ifreset:
known_paths=Nonereturnknown_pathsdefcheck_enableusersite():
"""Check if user site directory is safe for inclusion The function tests for the command line flag (including environment var), process uid/gid equal to effective uid/gid. None: Disabled for security reasons False: Disabled by user (command line option) True: Safe and enabled """ifsys.flags.no_user_site:
returnFalseifhasattr(os, "getuid") andhasattr(os, "geteuid"):
# check process uid == effective uidifos.geteuid() !=os.getuid():
returnNoneifhasattr(os, "getgid") andhasattr(os, "getegid"):
# check process gid == effective gidifos.getegid() !=os.getgid():
returnNonereturnTruedefgetuserbase():
"""Returns the `user base` directory path. The `user base` directory can be used to store data. If the global variable ``USER_BASE`` is not initialized yet, this function will also set it. """globalUSER_BASEifUSER_BASEisnotNone:
returnUSER_BASEfromsysconfigimportget_config_varUSER_BASE=get_config_var('userbase')
returnUSER_BASEdefgetusersitepackages():
"""Returns the user-specific site-packages directory path. If the global variable ``USER_SITE`` is not initialized yet, this function will also set it. """globalUSER_SITEuser_base=getuserbase() # this will also set USER_BASEifUSER_SITEisnotNone:
returnUSER_SITEfromsysconfigimportget_pathimportosifsys.platform=='darwin':
fromsysconfigimportget_config_varifget_config_var('PYTHONFRAMEWORK'):
USER_SITE=get_path('purelib', 'osx_framework_user')
returnUSER_SITEUSER_SITE=get_path('purelib', '%s_user'%os.name)
returnUSER_SITEdefaddusersitepackages(known_paths):
"""Add a per user site-package to sys.path Each user has its own python directory with site-packages in the home directory. """# get the per user site-package path# this call will also make sure USER_BASE and USER_SITE are setuser_site=getusersitepackages()
ifENABLE_USER_SITEandos.path.isdir(user_site):
addsitedir(user_site, known_paths)
returnknown_pathsdefgetsitepackages():
"""Returns a list containing all global site-packages directories (and possibly site-python). For each directory present in the global ``PREFIXES``, this function will find its `site-packages` subdirectory depending on the system environment, and will return a list of full paths. """sitepackages= []
seen=set()
forprefixinPREFIXES:
ifnotprefixorprefixinseen:
continueseen.add(prefix)
ifsys.platformin ('os2emx', 'riscos'):
sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
elifos.sep=='/':
sitepackages.append(os.path.join(prefix, "lib",
"python"+sys.version[:3],
"site-packages"))
sitepackages.append(os.path.join(prefix, "lib", "site-python"))
else:
sitepackages.append(prefix)
sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
ifsys.platform=="darwin":
# for framework builds *only* we add the standard Apple# locations.fromsysconfigimportget_config_varframework=get_config_var("PYTHONFRAMEWORK")
ifframework:
sitepackages.append(
os.path.join("/Library", framework,
sys.version[:3], "site-packages"))
returnsitepackagesdefaddsitepackages(known_paths):
"""Add site-packages (and possibly site-python) to sys.path"""forsitediringetsitepackages():
ifos.path.isdir(sitedir):
addsitedir(sitedir, known_paths)
returnknown_pathsdefsetBEGINLIBPATH():
"""The OS/2 EMX port has optional extension modules that do double duty as DLLs (and must use the .DLL file extension) for other extensions. The library search path needs to be amended so these will be found during module import. Use BEGINLIBPATH so that these are at the start of the library search path. """dllpath=os.path.join(sys.prefix, "Lib", "lib-dynload")
libpath=os.environ['BEGINLIBPATH'].split(';')
iflibpath[-1]:
libpath.append(dllpath)
else:
libpath[-1] =dllpathos.environ['BEGINLIBPATH'] =';'.join(libpath)
defsetquit():
"""Define new builtins 'quit' and 'exit'. These are objects which make the interpreter exit when called. The repr of each object contains a hint at how it works. """ifos.sep==':':
eof='Cmd-Q'elifos.sep=='\\':
eof='Ctrl-Z plus Return'else:
eof='Ctrl-D (i.e. EOF)'classQuitter(object):
def__init__(self, name):
self.name=namedef__repr__(self):
return'Use %s() or %s to exit'% (self.name, eof)
def__call__(self, code=None):
# Shells like IDLE catch the SystemExit, but listen when their# stdin wrapper is closed.try:
sys.stdin.close()
except:
passraiseSystemExit(code)
__builtin__.quit=Quitter('quit')
__builtin__.exit=Quitter('exit')
class_Printer(object):
"""interactive prompt objects for printing the license text, a list of contributors and the copyright notice."""MAXLINES=23def__init__(self, name, data, files=(), dirs=()):
self.__name=nameself.__data=dataself.__files=filesself.__dirs=dirsself.__lines=Nonedef__setup(self):
ifself.__lines:
returndata=Nonefordirinself.__dirs:
forfilenameinself.__files:
filename=os.path.join(dir, filename)
try:
fp=file(filename, "rU")
data=fp.read()
fp.close()
breakexceptIOError:
passifdata:
breakifnotdata:
data=self.__dataself.__lines=data.split('\n')
self.__linecnt=len(self.__lines)
def__repr__(self):
self.__setup()
iflen(self.__lines) <=self.MAXLINES:
return"\n".join(self.__lines)
else:
return"Type %s() to see the full %s text"% ((self.__name,)*2)
def__call__(self):
self.__setup()
prompt='Hit Return for more, or q (and Return) to quit: 'lineno=0while1:
try:
foriinrange(lineno, lineno+self.MAXLINES):
printself.__lines[i]
exceptIndexError:
breakelse:
lineno+=self.MAXLINESkey=NonewhilekeyisNone:
key=raw_input(prompt)
ifkeynotin ('', 'q'):
key=Noneifkey=='q':
breakdefsetcopyright():
"""Set 'copyright' and 'credits' in __builtin__"""__builtin__.copyright=_Printer("copyright", sys.copyright)
ifsys.platform[:4] =='java':
__builtin__.credits=_Printer(
"credits",
"Jython is maintained by the Jython developers (www.jython.org).")
else:
__builtin__.credits=_Printer("credits", """\ Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands for supporting Python development. See www.python.org for more information.""")
here=os.path.dirname(os.__file__)
__builtin__.license=_Printer(
"license", "See https://www.python.org/psf/license/",
["LICENSE.txt", "LICENSE"],
[os.path.join(here, os.pardir), here, os.curdir])
class_Helper(object):
"""Define the builtin 'help'. This is a wrapper around pydoc.help (with a twist). """def__repr__(self):
return"Type help() for interactive help, " \
"or help(object) for help about object."def__call__(self, *args, **kwds):
importpydocreturnpydoc.help(*args, **kwds)
defsethelper():
__builtin__.help=_Helper()
defaliasmbcs():
"""On Windows, some default encodings are not provided by Python, while they are always available as "mbcs" in each locale. Make them usable by aliasing to "mbcs" in such a case."""ifsys.platform=='win32':
importlocale, codecsenc=locale.getdefaultlocale()[1]
ifenc.startswith('cp'): # "cp***" ?try:
codecs.lookup(enc)
exceptLookupError:
importencodingsencodings._cache[enc] =encodings._unknownencodings.aliases.aliases[enc] ='mbcs'defsetencoding():
"""Set the string encoding used by the Unicode implementation. The default is 'ascii', but if you're willing to experiment, you can change this."""encoding="ascii"# Default value set by _PyUnicode_Init()if0:
# Enable to support locale aware default string encodings.importlocaleloc=locale.getdefaultlocale()
ifloc[1]:
encoding=loc[1]
if0:
# Enable to switch off string to Unicode coercion and implicit# Unicode to string conversion.encoding="undefined"ifencoding!="ascii":
# On Non-Unicode builds this will raise an AttributeError...sys.setdefaultencoding(encoding) # Needs Python Unicode build !defexecsitecustomize():
"""Run custom site specific code, if available."""try:
importsitecustomizeexceptImportError:
passexceptException:
ifsys.flags.verbose:
sys.excepthook(*sys.exc_info())
else:
print>>sys.stderr, \
"'import sitecustomize' failed; use -v for traceback"defexecusercustomize():
"""Run custom user specific code, if available."""try:
importusercustomizeexceptImportError:
passexceptException:
ifsys.flags.verbose:
sys.excepthook(*sys.exc_info())
else:
print>>sys.stderr, \
"'import usercustomize' failed; use -v for traceback"defmain():
globalENABLE_USER_SITEabs__file__()
known_paths=removeduppaths()
ifENABLE_USER_SITEisNone:
ENABLE_USER_SITE=check_enableusersite()
known_paths=addusersitepackages(known_paths)
known_paths=addsitepackages(known_paths)
ifsys.platform=='os2emx':
setBEGINLIBPATH()
setquit()
setcopyright()
sethelper()
aliasmbcs()
setencoding()
execsitecustomize()
ifENABLE_USER_SITE:
execusercustomize()
# Remove sys.setdefaultencoding() so that users cannot change the# encoding after initialization. The test for presence is needed when# this module is run as a script, because this code is executed twice.ifhasattr(sys, "setdefaultencoding"):
delsys.setdefaultencodingmain()
def_script():
help="""\ %s [--user-base] [--user-site] Without arguments print some useful information With arguments print the value of USER_BASE and/or USER_SITE separated by '%s'. Exit codes with --user-base or --user-site: 0 - user site directory is enabled 1 - user site directory is disabled by user 2 - uses site directory is disabled by super user or for security reasons >2 - unknown error """args=sys.argv[1:]
ifnotargs:
print"sys.path = ["fordirinsys.path:
print" %r,"% (dir,)
print"]"print"USER_BASE: %r (%s)"% (USER_BASE,
"exists"ifos.path.isdir(USER_BASE) else"doesn't exist")
print"USER_SITE: %r (%s)"% (USER_SITE,
"exists"ifos.path.isdir(USER_SITE) else"doesn't exist")
print"ENABLE_USER_SITE: %r"%ENABLE_USER_SITEsys.exit(0)
buffer= []
if'--user-base'inargs:
buffer.append(USER_BASE)
if'--user-site'inargs:
buffer.append(USER_SITE)
ifbuffer:
printos.pathsep.join(buffer)
ifENABLE_USER_SITE:
sys.exit(0)
elifENABLE_USER_SITEisFalse:
sys.exit(1)
elifENABLE_USER_SITEisNone:
sys.exit(2)
else:
sys.exit(3)
else:
importtextwrapprinttextwrap.dedent(help% (sys.argv[0], os.pathsep))
sys.exit(10)
if__name__=='__main__':
_script()
ai31:~ yannick$ ./minimal_example.sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 20.5M 100 20.5M 0 0 1263k 0 0:00:16 0:00:16 --:--:-- 1707k
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 20.2M 100 20.2M 0 0 1406k 0 0:00:14 0:00:14 --:--:-- 1607k
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1764k 100 1764k 0 0 6561k 0 --:--:-- --:--:-- --:--:-- 6561k
virtualenv 20.0.5 from /usr/local/lib/python3.7/site-packages/virtualenv/__init__.py
created virtual environment CPython3.7.5.final.0-64 in 199ms
creator CPython3Posix(dest=/Users/yannick/tmp_dir/env, clear=False, global=False)
seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=/Users/yannick/Library/Application Support/virtualenv/seed-v1)
activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
Collecting pytest
Using cached pytest-5.3.5-py3-none-any.whl (235 kB)
Collecting packaging
Using cached packaging-20.1-py2.py3-none-any.whl (36 kB)
Collecting importlib-metadata>=0.12; python_version < "3.8"
Using cached importlib_metadata-1.5.0-py2.py3-none-any.whl (30 kB)
Collecting more-itertools>=4.0.0
Using cached more_itertools-8.2.0-py3-none-any.whl (43 kB)
Collecting py>=1.5.0
Using cached py-1.8.1-py2.py3-none-any.whl (83 kB)
Collecting pluggy<1.0,>=0.12
Using cached pluggy-0.13.1-py2.py3-none-any.whl (18 kB)
Collecting attrs>=17.4.0
Using cached attrs-19.3.0-py2.py3-none-any.whl (39 kB)
Collecting wcwidth
Using cached wcwidth-0.1.8-py2.py3-none-any.whl (17 kB)
Collecting pyparsing>=2.0.2
Using cached pyparsing-2.4.6-py2.py3-none-any.whl (67 kB)
Collecting six
Using cached six-1.14.0-py2.py3-none-any.whl (10 kB)
Collecting zipp>=0.5
Using cached zipp-3.0.0-py3-none-any.whl (4.8 kB)
Installing collected packages: pyparsing, six, packaging, zipp, importlib-metadata, more-itertools, py, pluggy, attrs, wcwidth, pytest
Successfully installed attrs-19.3.0 importlib-metadata-1.5.0 more-itertools-8.2.0 packaging-20.1 pluggy-0.13.1 py-1.8.1 pyparsing-2.4.6 pytest-5.3.5 six-1.14.0 wcwidth-0.1.8 zipp-3.0.0
======================================== test session starts ========================================
platform darwin -- Python 3.7.5, pytest-5.3.5, py-1.8.1, pluggy-0.13.1
rootdir: /Users/yannick/tmp_dir
collected 2 items
test.py FF [100%]
============================================= FAILURES ==============================================
_______________________________________________ test2 _______________________________________________
def test2():
subprocess.check_call(['pypy2.7-v7.3.0-osx64/bin/pypy', 'get-pip.py', '-v'])
subprocess.check_call(['pypy2.7-v7.3.0-osx64/bin/pypy', '-m', 'site'])
print(os.listdir('pypy2.7-v7.3.0-osx64/bin'))
> assert False
E assert False
test.py:8: AssertionError
--------------------------------------- Captured stdout call ----------------------------------------
Non-user install because site-packages writeable
Created temporary directory: /private/var/folders/2k/7lc28xfj6vbfpyjpphcvyh7w0000gn/T/pip-ephem-wheel-cache-Dzm69W
Created temporary directory: /private/var/folders/2k/7lc28xfj6vbfpyjpphcvyh7w0000gn/T/pip-req-tracker-4kc17d
Initialized build tracking at /private/var/folders/2k/7lc28xfj6vbfpyjpphcvyh7w0000gn/T/pip-req-tracker-4kc17d
Created build tracker: /private/var/folders/2k/7lc28xfj6vbfpyjpphcvyh7w0000gn/T/pip-req-tracker-4kc17d
Entered build tracker: /private/var/folders/2k/7lc28xfj6vbfpyjpphcvyh7w0000gn/T/pip-req-tracker-4kc17d
Created temporary directory: /private/var/folders/2k/7lc28xfj6vbfpyjpphcvyh7w0000gn/T/pip-install-yhafaR
1 location(s) to search for versions of pip:
* https://pypi.org/simple/pip/
Fetching project page and analyzing links: https://pypi.org/simple/pip/
Getting page https://pypi.org/simple/pip/
Found index url https://pypi.org/simple
Looking up "https://pypi.org/simple/pip/" in the cache
Request header has "max_age" as 0, cache bypassed
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /simple/pip/ HTTP/1.1" 304 0
Found link https://files.pythonhosted.org/packages/3d/9d/1e313763bdfb6a48977b65829c6ce2a43eaae29ea2f907c8bbef024a7219/pip-0.2.tar.gz#sha256=88bb8d029e1bf4acd0e04d300104b7440086f94cc1ce1c5c3c31e3293aee1f81 (from https://pypi.org/simple/pip/), version: 0.2
...
Installing collected packages: pip, setuptools, wheel
Created temporary directory: /private/var/folders/2k/7lc28xfj6vbfpyjpphcvyh7w0000gn/T/pip-unpacked-wheel-xnir60
changing mode of /Users/yannick/tmp_dir/pypy2.7-v7.3.0-osx64/bin/pip to 755
changing mode of /Users/yannick/tmp_dir/pypy2.7-v7.3.0-osx64/bin/pip2 to 755
changing mode of /Users/yannick/tmp_dir/pypy2.7-v7.3.0-osx64/bin/pip2.7 to 755
Created temporary directory: /private/var/folders/2k/7lc28xfj6vbfpyjpphcvyh7w0000gn/T/pip-unpacked-wheel-qGsleO
changing mode of /Users/yannick/tmp_dir/pypy2.7-v7.3.0-osx64/bin/easy_install to 755
changing mode of /Users/yannick/tmp_dir/pypy2.7-v7.3.0-osx64/bin/easy_install-2.7 to 755
Created temporary directory: /private/var/folders/2k/7lc28xfj6vbfpyjpphcvyh7w0000gn/T/pip-unpacked-wheel-erEv1A
changing mode of /Users/yannick/tmp_dir/pypy2.7-v7.3.0-osx64/bin/wheel to 755
Successfully installed pip-20.0.2 setuptools-44.0.0 wheel-0.34.2
Cleaning up...
Removed build tracker: '/private/var/folders/2k/7lc28xfj6vbfpyjpphcvyh7w0000gn/T/pip-req-tracker-4kc17d'
sys.path = [
'/Users/yannick/tmp_dir',
'/Users/yannick/tmp_dir/pypy2.7-v7.3.0-osx64/lib_pypy/__extensions__',
'/Users/yannick/tmp_dir/pypy2.7-v7.3.0-osx64/lib_pypy',
'/Users/yannick/tmp_dir/pypy2.7-v7.3.0-osx64/lib-python/2.7',
'/Users/yannick/tmp_dir/pypy2.7-v7.3.0-osx64/lib-python/2.7/lib-tk',
'/Users/yannick/tmp_dir/pypy2.7-v7.3.0-osx64/lib-python/2.7/plat-darwin',
'/Users/yannick/tmp_dir/pypy2.7-v7.3.0-osx64/lib-python/2.7/plat-mac',
'/Users/yannick/tmp_dir/pypy2.7-v7.3.0-osx64/lib-python/2.7/plat-mac/lib-scriptpackages',
'/Users/yannick/tmp_dir/pypy2.7-v7.3.0-osx64/site-packages',
]
USER_BASE: '/Users/yannick/.local' (doesn't exist)
USER_SITE: '/Users/yannick/.local/lib/pypy2.7/site-packages' (doesn't exist)
ENABLE_USER_SITE: True
['libpypy-c.dylib', 'pip2', 'easy_install', 'wheel', 'pip', 'pypy', 'easy_install-2.7', 'pip2.7']
--------------------------------------- Captured stderr call ----------------------------------------
DEPRECATION: A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
_______________________________________________ test3 _______________________________________________
def test3():
subprocess.check_call(['pypy3.6-v7.3.0-osx64/bin/pypy3', 'get-pip.py', '-v'])
subprocess.check_call(['pypy3.6-v7.3.0-osx64/bin/pypy3', '-m', 'site'])
print(os.listdir('pypy3.6-v7.3.0-osx64/bin'))
> assert False
E assert False
test.py:14: AssertionError
--------------------------------------- Captured stdout call ----------------------------------------
Non-user install because user site-packages disabled
Created temporary directory: /private/var/folders/2k/7lc28xfj6vbfpyjpphcvyh7w0000gn/T/pip-ephem-wheel-cache-p_j2cq6p
Created temporary directory: /private/var/folders/2k/7lc28xfj6vbfpyjpphcvyh7w0000gn/T/pip-req-tracker-na7rsa2b
Initialized build tracking at /private/var/folders/2k/7lc28xfj6vbfpyjpphcvyh7w0000gn/T/pip-req-tracker-na7rsa2b
Created build tracker: /private/var/folders/2k/7lc28xfj6vbfpyjpphcvyh7w0000gn/T/pip-req-tracker-na7rsa2b
Entered build tracker: /private/var/folders/2k/7lc28xfj6vbfpyjpphcvyh7w0000gn/T/pip-req-tracker-na7rsa2b
Created temporary directory: /private/var/folders/2k/7lc28xfj6vbfpyjpphcvyh7w0000gn/T/pip-install-08qoikav
1 location(s) to search for versions of pip:
* https://pypi.org/simple/pip/
Fetching project page and analyzing links: https://pypi.org/simple/pip/
Getting page https://pypi.org/simple/pip/
Found index url https://pypi.org/simple
Looking up "https://pypi.org/simple/pip/" in the cache
Request header has "max_age" as 0, cache bypassed
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /simple/pip/ HTTP/1.1" 304 0
Found link https://files.pythonhosted.org/packages/3d/9d/1e313763bdfb6a48977b65829c6ce2a43eaae29ea2f907c8bbef024a7219/pip-0.2.tar.gz#sha256=88bb8d029e1bf4acd0e04d300104b7440086f94cc1ce1c5c3c31e3293aee1f81 (from https://pypi.org/simple/pip/), version: 0.2
...
Installing collected packages: pip, setuptools, wheel
Created temporary directory: /private/var/folders/2k/7lc28xfj6vbfpyjpphcvyh7w0000gn/T/pip-unpacked-wheel-_wruh4x9
changing mode of /Users/yannick/tmp_dir/env/bin/pip to 755
changing mode of /Users/yannick/tmp_dir/env/bin/pip3 to 755
changing mode of /Users/yannick/tmp_dir/env/bin/pip3.6 to 755
Created temporary directory: /private/var/folders/2k/7lc28xfj6vbfpyjpphcvyh7w0000gn/T/pip-unpacked-wheel-15knx9f1
changing mode of /Users/yannick/tmp_dir/env/bin/easy_install to 755
changing mode of /Users/yannick/tmp_dir/env/bin/easy_install-3.6 to 755
Created temporary directory: /private/var/folders/2k/7lc28xfj6vbfpyjpphcvyh7w0000gn/T/pip-unpacked-wheel-n8_gcseu
changing mode of /Users/yannick/tmp_dir/env/bin/wheel to 755
Successfully installed pip-20.0.2 setuptools-45.2.0 wheel-0.34.2
Cleaning up...
Removed build tracker: '/private/var/folders/2k/7lc28xfj6vbfpyjpphcvyh7w0000gn/T/pip-req-tracker-na7rsa2b'
sys.path = [
'/Users/yannick/tmp_dir',
'/Users/yannick/tmp_dir/pypy3.6-v7.3.0-osx64/lib_pypy/__extensions__',
'/Users/yannick/tmp_dir/pypy3.6-v7.3.0-osx64/lib_pypy',
'/Users/yannick/tmp_dir/pypy3.6-v7.3.0-osx64/lib-python/3',
'/Users/yannick/tmp_dir/pypy3.6-v7.3.0-osx64/lib-python/3/lib-tk',
'/Users/yannick/tmp_dir/pypy3.6-v7.3.0-osx64/lib-python/3/plat-darwin',
'/Users/yannick/tmp_dir/pypy3.6-v7.3.0-osx64/lib-python/3/plat-mac',
'/Users/yannick/tmp_dir/pypy3.6-v7.3.0-osx64/lib-python/3/plat-mac/lib-scriptpackages',
'/Users/yannick/tmp_dir/env/site-packages',
]
USER_BASE: '/Users/yannick/.local' (doesn't exist)
USER_SITE: '/Users/yannick/.local/lib/pypy3.6/site-packages' (doesn't exist)
ENABLE_USER_SITE: False
['libpypy3-c.dylib', 'pypy3']
======================================== 2 failed in 23.66s =========================================
I think the main thing to notice in that whole output, is that when running PyPy 3.6, v7.3.0 from within pytest from within a virtualenv (oh yes, and somehow only on macOS; and oh yes, on virtualenv<20, it works), -m site gives this output:
@YannickJadoul you're issue is related with pypy, please open a separate issue for that; with a clearer description of what's expected and what happens 👍 this issue is mainly about CPython Framework builds on macOs.
@YannickJadoul you're issue is related with pypy, please open a separate issue for that; with a clearer description of what's expected and what happens +1 this issue is mainly about CPython Framework builds on macOs.
Yeah, sorry, I came across these two issues at the same time, so I kind of assumed they were linked. I've opened #1654 now, hopefully that's more clear :-)
Activity
gaborbernat commentedon Feb 10, 2020
Can you please show the output with -vvv? Thanks!
rpkilby commentedon Feb 10, 2020
Also:
Sherpa-3:test bagel$ which python2.7 /usr/bin/python2.7 Sherpa-3:test bagel$ ls /usr/bin/python2.7 lrwxr-xr-x 1 root wheel 75 Nov 16 2018 /usr/bin/python2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7szmark001 commentedon Feb 11, 2020
I am seeing the same issue with version 20.0.1.
mctrafik commentedon Feb 11, 2020
+1 on Mac OS 10.15.3 Catalina. Same exact issue.
[-]Unable to create Python 2 virtualenvs on macOS[/-][+]macPython 2 not supported[/+]gaborbernat commentedon Feb 11, 2020
So basically we do not support with the rewrite the MacOs framework python. We'll need to fix this. In this particular case it seems that copying the file stats of the system python is not allowed, hence the above error.
gaborbernat commentedon Feb 11, 2020
Hello, a fix for this issue has been released via virtualenv 20.0.2; see https://pypi.org/project/virtualenv/20.0.2/ (https://virtualenv.pypa.io/en/latest/changelog.html#v20-0-2-2020-02-11) . Please give a try and report back if your issue has not been addressed; if not, please comment here, and we'll reopen the ticket. We want to apologize for the inconvenience this has caused you and say thanks for having patience while we resolve the unexpected bugs with this new major release.
rpkilby commentedon Feb 11, 2020
I don't think this is fixed entirely. Virtualenv creation doesn't fail, but there are a lot of unexpected packages present. Also, is the venv creation output expected?
However, the contents of the venv's site-packages are:
gaborbernat commentedon Feb 11, 2020
Thanks I'll take a look why this happens 🤔 seems the system python does not respects ignore global site packages on site.py 🤔
gaborbernat commentedon Feb 12, 2020
#1588 fixes this now.
22 remaining items
gaborbernat commentedon Feb 21, 2020
Oh another differently customized python under System path this time 🤷♂️macOs is wonderful. If you install brew version that will work.
gaborbernat commentedon Feb 21, 2020
Note for some reason we're picking up /usr/bin/python2.7, not the global python you're showcasing.
rpkilby commentedon Feb 21, 2020
For context I've installed Python 3.7 via brew, but Python 2.7 is what shipped with Mojave.
It's just a symlink to the framework Python.
gaborbernat commentedon Feb 21, 2020
I'm fairly certain the issue here is that site.py of the shipped python adds the global python to the sys path unconditionally (ignoring blatantly the enable global site packages flag within site.py 🤦♂️🤷♂️ macOS) so you're picking up things as that. We'll need to escape this in the custom shim site.py we ship 👍
rpkilby commentedon Feb 21, 2020
Idk if it helps, but here are the contents of the site module.
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.pygaborbernat commentedon Feb 21, 2020
Yeah see the hardcoded part at
framework = get_config_var("PYTHONFRAMEWORK") if framework: sitepackages.append( os.path.join("/Library", framework, sys.version[:3], "site-packages"
YannickJadoul commentedon Feb 21, 2020
@gaborbernat I've managed to reproduce my remaining issue in a simpler way:
Output
I think the main thing to notice in that whole output, is that when running PyPy 3.6, v7.3.0 from within pytest from within a virtualenv (oh yes, and somehow only on macOS; and oh yes, on virtualenv<20, it works),
-m sitegives this output:while if I afterwards run the same command outside of
pytest, I get:Somehow, the same doesn't happen with PyPy 2.7.
EDIT: I'm really sorry for finding such a nasty bug, that needs to be reproduced in such a horrible way :-/
gaborbernat commentedon Feb 22, 2020
@rpkilby your issue should be addressed with #1653, can you validate? Thanks!
gaborbernat commentedon Feb 22, 2020
@YannickJadoul you're issue is related with pypy, please open a separate issue for that; with a clearer description of what's expected and what happens 👍 this issue is mainly about CPython Framework builds on macOs.
[-]macPython 2 not supported[/-][+]framework build CPython macOs issues[/+]YannickJadoul commentedon Feb 22, 2020
Yeah, sorry, I came across these two issues at the same time, so I kind of assumed they were linked. I've opened #1654 now, hopefully that's more clear :-)
rpkilby commentedon Feb 22, 2020
@gaborbernat #1653 seems to work :D
gaborbernat commentedon Feb 26, 2020
Hello, a fix for this issue has been released via virtualenv 20.0.6; see https://pypi.org/project/virtualenv/20.0.6/ (https://virtualenv.pypa.io/en/latest/changelog.html#v20-0-6-2020-02-26) . Please give a try and report back if your issue has not been addressed; if not, please comment here, and we'll reopen the ticket. We want to apologize for the inconvenience this has caused you and say thanks for having patience while we resolve the unexpected bugs with this new major release.
