pipenv fails to install python with pyenv in non-interactive environments
See original GitHub issueI have setup pipenv and pyenv in a CI system, with the expectation that if a required version of python was not installed pipenv would invoke pyenv to install the correct version. This works fine in an interactive terminal but fails when run in the CI system.
When attempting to execute “pipenv install” I get the following error:
Warning: Your Pipfile requires python_version 3.7, but you are using 2.7.14 (/opt/j/home/.local/share/v/s/bin/python).
$ pipenv --rm and rebuilding the virtual environment may resolve the issue.
$ pipenv check will surely fail.
Launching subshell in virtual environment…
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pipenv/cli/command.py", line 374, in shell
pypi_mirror=state.pypi_mirror,
File "/usr/local/lib/python2.7/site-packages/pipenv/core.py", line 2088, in do_shell
shell.fork_compat(*fork_args)
File "/usr/local/lib/python2.7/site-packages/pipenv/shells.py", line 121, in fork_compat
c.interact(escape_character=None)
File "/usr/local/lib/python2.7/site-packages/pipenv/vendor/pexpect/pty_spawn.py", line 761, in interact
mode = tty.tcgetattr(self.STDIN_FILENO)
termios.error: (25, 'Inappropriate ioctl for device')
I see a similar issue was reported with “pipenv run” in https://github.com/pypa/pipenv/issues/290
Is there a way to handle the scenario where a specified version of python doesn’t exist in a headless environment? And if no, can “pipenv install” also be modified to use the --no-interactive flag?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:5 (1 by maintainers)
Top Results From Across the Web
pipenv fails to create virtual environment with pyenv python 3.8.0
So I have installed pyenv and installed python 3.8.0 as well. Problem: When I run this command: pipenv --python 3.8.0 shell I get...
Read more >Python Virtual Environments in Five Minutes | Chris Warrick
A short yet descriptive guide on Python virtual environments. ... Both tools install pip and setuptools , but venv does not ship with...
Read more >How to Manage your Python Projects with Pipenv and Pyenv
Set/change a Python version locally for a project. Create and manage virtual environments. Installation. On macOS, you can install this tool ...
Read more >Installing Python 3 and Pyenv on MacOS, Windows, and Linux
Installing Python 3 and Pyenv on MacOS, Windows, and Linux. We will be using the AWS Lambda runtime for the latest stable version...
Read more >pipenv Changelog - PyUp.io
Fix for ``requirementslib`` hanging during install of remote wheels files. ... Fix "The Python interpreter can't be found" error when running ``pipenv ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think it’s strange that pipenv can’t handle
non-interactive
environments by default. Poetry can.But when I run
pipenv run lint
in GitLab CI it just hangs there forever, without even invoking shell.Edit: Using something like
gitlab-ci
with docker executors. So I guess inside a python:3.7 docker image, where no interactive mode existsI also have this issue in combination with Powerlevel10k’s instant prompt. The
2022.1.8
version that you are talking about @matteius also has the same issue still.