Description
- [ /] Minimal reproducible example or detailed descriptions:
Due to a need to have multiple, non-interfering python installs running locally on a machine. We have a custom distutils.cfg (as per https://docs.python.org/3.6/install/index.html?highlight=distutils%20cfg#distutils-configuration-files ) that has an install_scripts
flag set in the mentioned system path.
Example distutils.cfg
for macOS based system:
[install]
prefix=/usr/local
install_scripts=/usr/local/opt/python@3.6.8/bin
Creating a virtualenv using the above configuration and a python install containing that config at prefix/lib/pythonver/distutils/distutils.cfg
results in a virutalenv directory with the structure:
├── lib
│ └── python3.6
│ └── site-packages ....
└── usr
└── local
└── opt
└── python@3.6.8
└── bin
Note that binaries are in usr/local/opt/python@3.6.8/bin
instead of bin/
- [/ ] the output of the virtual environment creation with the
-vvv --with-traceback
flags included
~ % virtualenv --python=python3 -vvv --with-traceback venv
219 setup logging to NOTSET [DEBUG report:43]
236 find interpreter for spec PythonSpec(implementation=CPython, major=3) [INFO builtin:43]
236 proposed PythonInfo(spec=CPython3.6.8.final.0-64, exe=/usr/local/opt/python@3.6.8/bin/python3.6, platform=darwin, version='3.6.8 (default, Feb 13 2020, 09:47:29) \n[GCC 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.33.17)]', encoding_fs_io=utf-8-UTF-8) [INFO builtin:49]
236 accepted PythonInfo(spec=CPython3.6.8.final.0-64, exe=/usr/local/opt/python@3.6.8/bin/python3.6, platform=darwin, version='3.6.8 (default, Feb 13 2020, 09:47:29) \n[GCC 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.33.17)]', encoding_fs_io=utf-8-UTF-8) [DEBUG builtin:51]
240 filesystem is not case-sensitive [DEBUG info:28]
279 create virtual environment via CPython3Posix(dest=/Users/csalch/venv, clear=False, global=False) [INFO session:51]
279 create folder /Users/csalch/venv/lib/python3.6/site-packages [DEBUG _sync:20]
280 create folder /Users/csalch/venv/usr/local/opt/python@3.6.8/bin [DEBUG _sync:20]
280 write /Users/csalch/venv/pyvenv.cfg [DEBUG pyenv_cfg:34]
280 home = /usr/local/Cellar/python@3.6.8/3.6.8_2/Frameworks/Python.framework/Versions/3.6 [DEBUG pyenv_cfg:38]
280 implementation = CPython [DEBUG pyenv_cfg:38]
280 version_info = 3.6.8.final.0 [DEBUG pyenv_cfg:38]
281 virtualenv = 20.0.4 [DEBUG pyenv_cfg:38]
281 include-system-site-packages = false [DEBUG pyenv_cfg:38]
281 base-prefix = /usr/local/Cellar/python@3.6.8/3.6.8_2/Frameworks/Python.framework/Versions/3.6 [DEBUG pyenv_cfg:38]
281 base-exec-prefix = /usr/local/Cellar/python@3.6.8/3.6.8_2/Frameworks/Python.framework/Versions/3.6 [DEBUG pyenv_cfg:38]
281 base-executable = /usr/local/opt/python@3.6.8/bin/python3.6 [DEBUG pyenv_cfg:38]
281 symlink /usr/local/opt/python@3.6.8/bin/python3.6 to /Users/csalch/venv/usr/local/opt/python@3.6.8/bin/python [DEBUG _sync:39]
282 ============================== target debug ============================== [DEBUG session:53]
283 debug via /Users/csalch/venv/usr/local/opt/python@3.6.8/bin/python /usr/local/lib/python3.6/site-packages/virtualenv/create/debug.py [DEBUG creator:191]
282 {
"sys": {
"executable": "/usr/local/opt/python@3.6.8/bin/python3.6",
"_base_executable": null,
"prefix": "/usr/local/opt/python@3.6.8/bin/../Frameworks/Python.framework/Versions/3.6",
"base_prefix": "/usr/local/opt/python@3.6.8/bin/../Frameworks/Python.framework/Versions/3.6",
"real_prefix": null,
"exec_prefix": "/usr/local/opt/python@3.6.8/bin/../Frameworks/Python.framework/Versions/3.6",
"base_exec_prefix": "/usr/local/opt/python@3.6.8/bin/../Frameworks/Python.framework/Versions/3.6",
"path": [
"/usr/local/opt/python@3.6.8/Frameworks/Python.framework/Versions/3.6/lib/python36.zip",
"/usr/local/opt/python@3.6.8/Frameworks/Python.framework/Versions/3.6/lib/python3.6",
"/usr/local/opt/python@3.6.8/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload",
"/usr/local/opt/python@3.6.8/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages"
],
"meta_path": [
"<class '_frozen_importlib.BuiltinImporter'>",
"<class '_frozen_importlib.FrozenImporter'>",
"<class '_frozen_importlib_external.PathFinder'>"
],
"fs_encoding": "utf-8",
"io_encoding": "UTF-8"
},
"version": "3.6.8 (default, Feb 13 2020, 09:47:29) \n[GCC 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.33.17)]",
"os": "<module 'os' from '/usr/local/opt/python@3.6.8/bin/../Frameworks/Python.framework/Versions/3.6/lib/python3.6/os.py'>",
"site": "<module 'site' from '/usr/local/opt/python@3.6.8/bin/../Frameworks/Python.framework/Versions/3.6/lib/python3.6/site.py'>",
"datetime": "<module 'datetime' from '/usr/local/opt/python@3.6.8/Frameworks/Python.framework/Versions/3.6/lib/python3.6/datetime.py'>",
"math": "<module 'math' from '/usr/local/opt/python@3.6.8/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/math.cpython-36m-darwin.so'>",
"json": "<module 'json' from '/usr/local/opt/python@3.6.8/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py'>"
} [DEBUG session:54]
340 add seed packages via FromAppData pip=latest setuptools=latest wheel=latest app_data_dir=/Users/csalch/Library/Application Support/virtualenv/seed-v1 via=copy [INFO session:58]
341 Attempting to acquire lock 4353297544 on /Users/csalch/Library/Application Support/virtualenv/seed-v1/3.6/wheels.lock [DEBUG filelock:270]
342 Lock 4353297544 acquired on /Users/csalch/Library/Application Support/virtualenv/seed-v1/3.6/wheels.lock [INFO filelock:274]
345 install pip from wheel /Users/csalch/Library/Application Support/virtualenv/seed-v1/3.6/wheels/pip-20.0.2-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:56]
345 install setuptools from wheel /Users/csalch/Library/Application Support/virtualenv/seed-v1/3.6/wheels/setuptools-45.2.0-py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:56]
345 install wheel from wheel /Users/csalch/Library/Application Support/virtualenv/seed-v1/3.6/wheels/wheel-0.34.2-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:56]
346 copy /Users/csalch/Library/Application Support/virtualenv/seed-v1/3.6/image/CopyPipInstall/setuptools-45.2.0-py3-none-any/easy_install.py to /Users/csalch/venv/lib/python3.6/site-packages/easy_install.py [DEBUG _sync:47]
346 copy directory /Users/csalch/Library/Application Support/virtualenv/seed-v1/3.6/image/CopyPipInstall/wheel-0.34.2-py2.py3-none-any/wheel to /Users/csalch/venv/lib/python3.6/site-packages/wheel [DEBUG _sync:47]
347 copy /Users/csalch/Library/Application Support/virtualenv/seed-v1/3.6/image/CopyPipInstall/pip-20.0.2-py2.py3-none-any/pip-20.0.2.dist-info.virtualenv to /Users/csalch/venv/lib/python3.6/site-packages/pip-20.0.2.dist-info.virtualenv [DEBUG _sync:47]
348 copy directory /Users/csalch/Library/Application Support/virtualenv/seed-v1/3.6/image/CopyPipInstall/pip-20.0.2-py2.py3-none-any/pip to /Users/csalch/venv/lib/python3.6/site-packages/pip [DEBUG _sync:47]
348 copy /Users/csalch/Library/Application Support/virtualenv/seed-v1/3.6/image/CopyPipInstall/setuptools-45.2.0-py3-none-any/setuptools-45.2.0.dist-info.virtualenv to /Users/csalch/venv/lib/python3.6/site-packages/setuptools-45.2.0.dist-info.virtualenv [DEBUG _sync:47]
349 copy directory /Users/csalch/Library/Application Support/virtualenv/seed-v1/3.6/image/CopyPipInstall/setuptools-45.2.0-py3-none-any/setuptools to /Users/csalch/venv/lib/python3.6/site-packages/setuptools [DEBUG _sync:47]
363 copy /Users/csalch/Library/Application Support/virtualenv/seed-v1/3.6/image/CopyPipInstall/wheel-0.34.2-py2.py3-none-any/wheel-0.34.2.dist-info.virtualenv to /Users/csalch/venv/lib/python3.6/site-packages/wheel-0.34.2.dist-info.virtualenv [DEBUG _sync:47]
364 copy directory /Users/csalch/Library/Application Support/virtualenv/seed-v1/3.6/image/CopyPipInstall/wheel-0.34.2-py2.py3-none-any/wheel-0.34.2.dist-info to /Users/csalch/venv/lib/python3.6/site-packages/wheel-0.34.2.dist-info [DEBUG _sync:47]
468 changing mode of /Users/csalch/venv/usr/local/opt/python@3.6.8/bin/wheel-3.6 to 755 [INFO util:566]
469 changing mode of /Users/csalch/venv/usr/local/opt/python@3.6.8/bin/wheel3 to 755 [INFO util:566]
470 changing mode of /Users/csalch/venv/usr/local/opt/python@3.6.8/bin/wheel to 755 [INFO util:566]
470 generated console scripts wheel wheel-3.6 wheel3 [DEBUG base:48]
515 copy directory /Users/csalch/Library/Application Support/virtualenv/seed-v1/3.6/image/CopyPipInstall/setuptools-45.2.0-py3-none-any/pkg_resources to /Users/csalch/venv/lib/python3.6/site-packages/pkg_resources [DEBUG _sync:47]
538 copy directory /Users/csalch/Library/Application Support/virtualenv/seed-v1/3.6/image/CopyPipInstall/setuptools-45.2.0-py3-none-any/setuptools-45.2.0.dist-info to /Users/csalch/venv/lib/python3.6/site-packages/setuptools-45.2.0.dist-info [DEBUG _sync:47]
548 changing mode of /Users/csalch/venv/usr/local/opt/python@3.6.8/bin/easy_install to 755 [INFO util:566]
549 changing mode of /Users/csalch/venv/usr/local/opt/python@3.6.8/bin/easy_install3 to 755 [INFO util:566]
549 changing mode of /Users/csalch/venv/usr/local/opt/python@3.6.8/bin/easy_install-3.6 to 755 [INFO util:566]
550 generated console scripts easy_install-3.6 easy_install easy_install3 [DEBUG base:48]
736 copy directory /Users/csalch/Library/Application Support/virtualenv/seed-v1/3.6/image/CopyPipInstall/pip-20.0.2-py2.py3-none-any/pip-20.0.2.dist-info to /Users/csalch/venv/lib/python3.6/site-packages/pip-20.0.2.dist-info [DEBUG _sync:47]
741 changing mode of /Users/csalch/venv/usr/local/opt/python@3.6.8/bin/pip-3.6 to 755 [INFO util:566]
741 changing mode of /Users/csalch/venv/usr/local/opt/python@3.6.8/bin/pip to 755 [INFO util:566]
741 changing mode of /Users/csalch/venv/usr/local/opt/python@3.6.8/bin/pip3 to 755 [INFO util:566]
742 generated console scripts pip3 pip-3.6 pip [DEBUG base:48]
742 Attempting to release lock 4353297544 on /Users/csalch/Library/Application Support/virtualenv/seed-v1/3.6/wheels.lock [DEBUG filelock:315]
742 Lock 4353297544 released on /Users/csalch/Library/Application Support/virtualenv/seed-v1/3.6/wheels.lock [INFO filelock:318]
742 add activators for Bash, CShell, Fish, PowerShell, Python, Xonsh [INFO session:64]
746 write /Users/csalch/venv/pyvenv.cfg [DEBUG pyenv_cfg:34]
747 home = /usr/local/Cellar/python@3.6.8/3.6.8_2/Frameworks/Python.framework/Versions/3.6 [DEBUG pyenv_cfg:38]
747 implementation = CPython [DEBUG pyenv_cfg:38]
747 version_info = 3.6.8.final.0 [DEBUG pyenv_cfg:38]
747 virtualenv = 20.0.4 [DEBUG pyenv_cfg:38]
747 include-system-site-packages = false [DEBUG pyenv_cfg:38]
747 base-prefix = /usr/local/Cellar/python@3.6.8/3.6.8_2/Frameworks/Python.framework/Versions/3.6 [DEBUG pyenv_cfg:38]
747 base-exec-prefix = /usr/local/Cellar/python@3.6.8/3.6.8_2/Frameworks/Python.framework/Versions/3.6 [DEBUG pyenv_cfg:38]
747 base-executable = /usr/local/opt/python@3.6.8/bin/python3.6 [DEBUG pyenv_cfg:38]
747 created virtual environment in 530ms CPython3Posix(dest=/Users/csalch/venv, clear=False, global=False) with seeder FromAppData pip=latest setuptools=latest wheel=latest app_data_dir=/Users/csalch/Library/Application Support/virtualenv/seed-v1 via=copy [WARNING __main__:24]
- [/ ]
pip list
of the environment where virtualenv is installed into if not using the zipapp
~ % source venv/bin/activate
source: no such file or directory: venv/bin/activate
~ % source venv/usr/local/opt/python@3.6.8/bin/activate
(venv) ~ % pip list
Traceback (most recent call last):
File "/Users/csalch/venv/usr/local/opt/python@3.6.8/bin/pip", line 5, in <module>
from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip._internal.cli.main'
(venv) ~ % which python
/Users/csalch/venv/usr/local/opt/python@3.6.8/bin/python
(venv) ~ % python -m pip list
Package Version
------------------- -------
anisble 0.1
ansible 2.9.4
appdirs 1.4.3
cffi 1.13.2
cryptography 2.8
distlib 0.3.0
filelock 3.0.12
importlib-metadata 1.5.0
importlib-resources 1.0.2
Jinja2 2.10.3
MarkupSafe 1.1.1
pip 19.3.1
pycparser 2.19
PyYAML 5.3
ruamel.yaml 0.16.5
ruamel.yaml.clib 0.2.0
setuptools 42.0.2
six 1.13.0
virtualenv 20.0.4
wheel 0.33.6
zipp 2.2.0
(venv) ~ % cat $(which pip)
#!/Users/csalch/venv/usr/local/opt/python@3.6.8/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from pip._internal.cli.main import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())
(venv) ~ %