pipenv: 'zsh: killed python' while executing from virtualenv on macOS Big Sur for Python 2.7
zsh: killed python
while executing from virtualenv on macOS Big Sur (platform: arm64) for Python 2.7
It is working fine for Python 3.8
Expected result
Python Shell should launch from virtual env shell.
On using pipenv sync
should install dependencies.
Actual result
zsh: killed python
. Python shell is not launched.
Steps to replicate
- pipenv install --python 2.7
- pipenv shell
- python
Using /usr/bin/python2.7 (2.7.16) to create virtualenv...
⠴ Creating virtual environment...created virtual environment CPython2.7.16.final.0-64 in 216ms
creator CPython2macOsFramework(dest=/Users/ab/.local/share/virtualenvs/demo2-HNdtbnRg, clear=False, global=False)
seeder FromAppData(download=False, pip=bundle, wheel=bundle, setuptools=bundle, via=copy, app_data_dir=/Users/ab/Library/Application Support/virtualenv)
added seed packages: pip==20.2.4, setuptools==44.1.1, wheel==0.35.1
activators PythonActivator,CShellActivator,FishActivator,PowerShellActivator,BashActivator
✔ Successfully created virtual environment!
Failed to load paths:
Output:
Virtualenv location: /Users/ab/.local/share/virtualenvs/demo2-HNdtbnRg
Installing dependencies from Pipfile.lock (3cbc06)...
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/0 — 00:00:00
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
demo2 % pipenv shell
Launching subshell in virtual environment...
. /Users/ab/.local/share/virtualenvs/demo2-HNdtbnRg/bin/activate
demo2 % . /Users/ab/.local/share/virtualenvs/demo2-HNdtbnRg/bin/activate
demo2 % python
zsh: killed python
demo2 % which python
/Users/ab/.local/share/virtualenvs/demo2-HNdtbnRg/bin/python
This works perfectly fine with if I use pipenv install --python 3.8
See details of platform and Python version below (skipped sys env variables)
$ pipenv --support
Pipenv version: '2020.8.13'
Pipenv location: '/Users/ab/Library/Python/2.7/lib/python/site-packages/pipenv'
Python location: '/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python'
Python installations found:
3.8.2
:/usr/bin/python3
2.7.16
:/usr/bin/python2.7
2.7.16
:/usr/bin/python2
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '0',
'os_name': 'posix',
'platform_machine': 'arm64',
'platform_python_implementation': 'CPython',
'platform_release': '20.0.0',
'platform_system': 'Darwin',
'platform_version': 'Darwin Kernel Version 20.0.0: Fri Aug 14 00:25:08 PDT 2020; root:xnu-7195.40.44.151.1~4/RELEASE_ARM64_T8020',
'python_full_version': '2.7.16',
'python_version': '2.7',
'sys_platform': 'darwin'}
Pipenv–specific environment variables:
Debug–specific environment variables:
PATH
:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/ab/Library/Python/2.7/bin
SHELL
:/bin/zsh
LANG
:en_US.UTF-8
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 6
- Comments: 36 (4 by maintainers)
solution:
If you are on Apple M1, mac sure open terminal with Rosetta enabled. it will works fine.
I had the same issue on my M1 Mac. You can resolve the same by duplicating your Terminal, and running it with Rosetta. That worked for me.
That works for me for the built-in python, but for the python3 installed through homebrew, I had to reinstall by:
brew reinstall $(brew deps python3) python3
I’ve come across the same issue as well. I’ve created a virtual environment running python 2.7, and any command be it pip or python is killed by the zsh. I’m using Rosetta to run x64 based terminal on arm64 Mac. Any updates would be helpful.
Ah sorry – I had spent too many hours looking at pipenv issues that day, I was amused to see so many names I recognized on this thread but probably didn’t need to add that remark.
(I’m not
pypa/pipenv
, just a random person but…) As I understand it, the reason this is happening here is because in python2 virtual environments the python (and pip) binaries are copied (rather than symlinked, as is the case in python3) into the virtualenv. This results in a mismatch between the binary and the code signature (required to run binaries on macOS). As a result the process is killed on startup.For you case, it is a bit off-topic for this thread. Perhaps post a question in Stack Overflow (or similar) but provide as much information about the script and how you are running it as you are able. I would also check logs in
/var/log/system.log
, or usingconsole.app
to see if there is any useful information there which may help with diagnosing the issue. Good luck.Same problem: can’t make virtualenv work on any M1-based Mac with 2.7. Tried a few systems, always plays out as @aberrya describes.
I suspect this is related to: https://github.com/pypa/virtualenv/issues/2023
It worked for me after I installed Python 2.7.18 using pyenv.