Running "pipenv shell" for a Python 2.7 project fails.
Using:
Seems like "subprocess.run()" has been introduced in shells.py ( in #2371 ), while this api was introduced only from Python 3.
A cmd shell with virtual environment active should be spawned.
Launching subshell in virtual environment…
Traceback (most recent call last):
File "c:\program files\python27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\program files\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Program Files\Python27\Scripts\pipenv.exe\__main__.py", line 9, in <module>
File "c:\program files\python27\lib\site-packages\pipenv\vendor\click\core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "c:\program files\python27\lib\site-packages\pipenv\vendor\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "c:\program files\python27\lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\program files\python27\lib\site-packages\pipenv\vendor\click\core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\program files\python27\lib\site-packages\pipenv\vendor\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "c:\program files\python27\lib\site-packages\pipenv\cli.py", line 664, in shell
three=three, python=python, fancy=fancy, shell_args=shell_args, pypi_mirror=pypi_mirror
File "c:\program files\python27\lib\site-packages\pipenv\core.py", line 2159, in do_shell
shell.fork(*fork_args)
File "c:\program files\python27\lib\site-packages\pipenv\shells.py", line 97, in fork
_handover(self.cmd, self.args + list(args))
File "c:\program files\python27\lib\site-packages\pipenv\shells.py", line 62, in _handover
proc = subprocess.run(args, shell=True, universal_newlines=True)
AttributeError: 'module' object has no attribute 'run'
[packages]
[requires]
python_version = "2.7"
$ pipenv install
$ pipenv --support
Pipenv version: '2018.7.1'
Pipenv location: 'c:\\program files\\python27\\lib\\site-packages\\pipenv'
Python location: 'c:\\program files\\python27\\python.exe'
Other Python installations in PATH:
2.7: C:\Program Files\Python27\python.exe
2.7.15: C:\Program Files\Python27\python.exe
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '0',
'os_name': 'nt',
'platform_machine': 'AMD64',
'platform_python_implementation': 'CPython',
'platform_release': '10',
'platform_system': 'Windows',
'platform_version': '10.0.14393',
'python_full_version': '2.7.15',
'python_version': '2.7',
'sys_platform': 'win32'}
System environment variables:
TMPCOMPUTERNAMEVS110COMNTOOLSUSERDOMAINPSMODULEPATHCOMMANDER_PATHIWBPATHCOMMONPROGRAMFILESPROCESSOR_IDENTIFIERWECSDKPROGRAMFILESPROCESSOR_REVISIONPATHSYSTEMROOTPROGRAMFILES(X86)COMSPECTEMPCOMMONPROGRAMFILES(X86)PROCESSOR_ARCHITECTUREPIPENV_VENV_IN_PROJECTALLUSERSPROFILELOCALAPPDATAHOMEPATHUSERDOMAIN_ROAMINGPROFILEVS120COMNTOOLSPROGRAMW6432USERNAMELOGONSERVERPROMPTSESSIONNAMEPROGRAMDATASAP_IPV6_ACTIVECOMMANDER_DRIVECOMMANDER_EXEUSERDNSDOMAINPYTHONDONTWRITEBYTECODEUATDATAPATHEXTPIP_PYTHON_PATHCGROAMINGPATHWINDIRAPPDATAHOMEDRIVECOMMANDER_INISYSTEMDRIVECANOE_INSTALLDIRPUBLICNUMBER_OF_PROCESSORSCANOE_INSTALLDIR64PROCESSOR_LEVELPYTHON_HOMECOMMONPROGRAMW6432OSSNC_LIBUSERPROFILEPipenv–specific environment variables:
PIPENV_VENV_IN_PROJECT: 1Debug–specific environment variables:
PATH: C:\Program Files\Python27\;C:\Program Files\Python27\\Scripts;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\WebEx\Productivity Tools;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Micro Focus\StarTeam SDK 16.0\lib;C:\Program Files\Micro Focus\StarTeam SDK 16.0\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Git\cmd;C:\Users\xmnalepa\AppData\Local\Microsoft\WindowsApps;d:\Apps\Sysinternals Suite\;Contents of Pipfile ('D:\work\scripts\shell_issue\Pipfile'):
[packages]
[requires]
python_version = "2.7"
Contents of Pipfile.lock ('D:\work\scripts\shell_issue\Pipfile.lock'):
{
"_meta": {
"hash": {
"sha256": "ae4bdd7d4157baab65ae9d0e8389a6011e6b640995372c45ec81fa5d1ddfae9f"
},
"pipfile-spec": 6,
"requires": {
"python_version": "2.7"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {},
"develop": {}
}
Thanks for the report and sorry for the frustration. We do strongly recommend installing pipenv with python 3 which would provide a short term solution until next release
No frustration at all. thank you for the prompt response!
:+1:
Here is a workaround I use on Windows. Put this in a batch file, say pipenvshell.bat
@for %%F in ("%cd%") do @set "folder=%%~nxF"
pipenv run cmd /k "title %FOLDER% && prompt (venv)$S%PROMPT%^"
Running pipenvshell will get you a pipenv shell with the title of the window renamed to the name of your current folder and your prompt prefixed with (venv).
Doing the same on Linux left as an exercice for the reader.
What worked for me on Windows with Python 3.4 was to downgrade pipenv (for now).
pip install pipenv==2018.6.25
(possibly throw a --user in there)
Thanks for the work on pipenv btw, I'm doing my bit to spread the word :)
Most helpful comment
What worked for me on Windows with Python 3.4 was to downgrade pipenv (for now).
pip install pipenv==2018.6.25(possibly throw a
--userin there)Thanks for the work on pipenv btw, I'm doing my bit to spread the word :)