Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pyenv and Python 3.4.* not installing #3124

Closed
MasonEgger opened this issue Oct 29, 2018 · 5 comments · Fixed by #3161
Closed

Pyenv and Python 3.4.* not installing #3124

MasonEgger opened this issue Oct 29, 2018 · 5 comments · Fixed by #3161

Comments

@MasonEgger
Copy link

Issue description

Using pyenv 1.2.7 and pipenv 2018.10.13 I cannot install any variant of Python 3.4 without a stack trace. I have tested it with Python 3.5., 3.6., and 3.7.* and all of those versions work just fine.

Expected result

pipenv --python 3.4.9 correctly installs Python 3.4 with pyenv and the environment functions as expected.

Actual result

A stack trace is thrown from the pipenv code

Steps to replicate

Operating System: Fedora 27 on a desktop

  1. Install pyenv and pipenv as usual, setting up all necessary env variables. (I know these work since pipenv handles all other supported versions of Python 3 just fine
  2. run the command pipenv --install python 3.4
  3. Will be prompted to have pyenv install Python 3.4.9. Accept.

Stack trace

[18:09:41] megger:~ $ pipenv --python 3.4
Warning: Python 3.4 was not found on your system…
Would you like us to install CPython 3.4.9 with pyenv? [Y/n]: y
Installing CPython 3.4.9 with pyenv (this may take a few minutes)…
Traceback (most recent call last):
  File "/home/megger/.local/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/home/megger/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/megger/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/megger/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1114, in invoke
    return Command.invoke(self, ctx)
  File "/home/megger/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/megger/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/megger/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/megger/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/megger/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/megger/.local/pipx/venvs/pipenv/lib64/python3.6/site-packages/pipenv/cli/command.py", line 203, in cli
    clear=state.clear,
  File "/home/megger/.local/pipx/venvs/pipenv/lib64/python3.6/site-packages/pipenv/core.py", line 565, in ensure_project
    pypi_mirror=pypi_mirror,
  File "/home/megger/.local/pipx/venvs/pipenv/lib64/python3.6/site-packages/pipenv/core.py", line 488, in ensure_virtualenv
    python = ensure_python(three=three, python=python)
  File "/home/megger/.local/pipx/venvs/pipenv/lib64/python3.6/site-packages/pipenv/core.py", line 451, in ensure_python
    c = pyenv.install(version)
  File "/home/megger/.local/pipx/venvs/pipenv/lib64/python3.6/site-packages/pipenv/pyenv.py", line 117, in install
    timeout=PIPENV_INSTALL_TIMEOUT,
  File "/home/megger/.local/pipx/venvs/pipenv/lib64/python3.6/site-packages/pipenv/pyenv.py", line 73, in _pyenv
    raise PyenvError('faild to run {0}'.format(args), c)
  File "/home/megger/.local/pipx/venvs/pipenv/lib64/python3.6/site-packages/pipenv/pyenv.py", line 56, in __init__
    self.err = c.err
  File "/home/megger/.local/pipx/venvs/pipenv/lib64/python3.6/site-packages/pipenv/vendor/delegator.py", line 146, in err
    return self._pexpect_out
  File "/home/megger/.local/pipx/venvs/pipenv/lib64/python3.6/site-packages/pipenv/vendor/delegator.py", line 114, in _pexpect_out
    result += self.subprocess.after
TypeError: must be str, not type

$ pipenv --support

Pipenv version: '2018.10.13'

Pipenv location: '/home/megger/.local/pipx/venvs/pipenv/lib64/python3.6/site-packages/pipenv'

Python location: '/home/megger/.local/pipx/venvs/pipenv/bin/python3'

Python installations found:

  • 3.7.1: /home/megger/.pyenv/versions/3.7.1/bin/python3.7
  • 3.7.1: /home/megger/.pyenv/versions/3.7.1/bin/python3.7m
  • 3.6.6: /home/megger/.pyenv/shims/python3
  • 3.6.6: /usr/bin/python3.6m
  • 3.6.6: /usr/bin/python3.6
  • 3.5.6: /home/megger/.pyenv/versions/3.5.6/bin/python3.5
  • 3.5.6: /home/megger/.pyenv/versions/3.5.6/bin/python3.5m
  • 2.7.15: /home/megger/.pyenv/shims/python
  • 2.7.15: /usr/bin/python2.7

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.6.6',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '4.18.16-100.fc27.x86_64',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP Sun Oct 21 09:33:00 UTC 2018',
 'python_full_version': '3.6.6',
 'python_version': '3.6',
 'sys_platform': 'linux'}

System environment variables:

  • XDG_MENU_PREFIX
  • BYOBU_ULIMIT
  • LANG
  • GDM_LANG
  • HISTCONTROL
  • _VIRTUALENVWRAPPER_API
  • DISPLAY
  • HOSTNAME
  • BYOBU_CONFIG_DIR
  • OLDPWD
  • BYOBU_DARK
  • BYOBU_LIGHT
  • COLORTERM
  • USERNAME
  • XDG_VTNR
  • SSH_AUTH_SOCK
  • BYOBU_PREFIX
  • XDG_SESSION_ID
  • BYOBU_TTY
  • USER
  • DESKTOP_SESSION
  • BYOBU_TERM
  • BYOBU_HIGHLIGHT
  • WAYLAND_DISPLAY
  • BYOBU_DISTRO
  • PWD
  • HOME
  • BYOBU_PAGER
  • JOURNAL_STREAM
  • TMUX
  • XDG_SESSION_TYPE
  • XDG_DATA_DIRS
  • BYOBU_DATE
  • BYOBU_PYTHON
  • BYOBU_CHARMAP
  • XDG_SESSION_DESKTOP
  • GJS_DEBUG_OUTPUT
  • BYOBU_READLINK
  • LOADEDMODULES
  • MAIL
  • BYOBU_WINDOW_NAME
  • VIRTUALENVWRAPPER_SCRIPT
  • VTE_VERSION
  • TERM
  • SHELL
  • BYOBU_SED
  • QT_IM_MODULE
  • XMODIFIERS
  • XDG_CURRENT_DESKTOP
  • BYOBU_BACKEND
  • TMUX_PANE
  • XDG_SEAT
  • SHLVL
  • BYOBU_ACCENT
  • BYOBU_TIME
  • BYOBU_RUN_DIR
  • MODULEPATH
  • GDMSESSION
  • GNOME_DESKTOP_SESSION_ID
  • LOGNAME
  • DBUS_SESSION_BUS_ADDRESS
  • XDG_RUNTIME_DIR
  • PATH
  • MODULESHOME
  • HISTSIZE
  • GJS_DEBUG_TOPICS
  • SESSION_MANAGER
  • LESSOPEN
  • LS_COLORS
  • ZSH
  • WORKON_HOME
  • PAGER
  • LESS
  • LC_CTYPE
  • LSCOLORS
  • PYENV_SHELL
  • PYENV_VIRTUALENV_INIT
  • _
  • PYTHONDONTWRITEBYTECODE
  • PIP_SHIMS_BASE_MODULE
  • PIP_PYTHON_PATH
  • PIPENV_ACTIVE
  • PS1
  • PYENV_ROOT

Pipenv–specific environment variables:

  • PIPENV_ACTIVE: 1

Debug–specific environment variables:

  • PATH: /home/megger/.pyenv/plugins/pyenv-virtualenv/shims:/home/megger/.pyenv/shims:/home/megger/.pyenv/bin:/home/megger/.local/bin:/home/megger/.pyenv/plugins/pyenv-virtualenv/shims:/home/megger/.pyenv/shims:/home/megger/.pyenv/bin:/home/megger/.local/bin:/home/megger/.pyenv/plugins/pyenv-virtualenv/shims:/home/megger/.pyenv/shims:/home/megger/.pyenv/bin:/home/megger/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/megger/bin
  • SHELL: /usr/bin/zsh
  • LANG: en_US.UTF-8
  • PWD: /home/megger

Contents of Pipfile ('/home/megger/Pipfile'):

@asmaier
Copy link

asmaier commented Oct 30, 2018

I have the same problem when trying to install python 3.6.5 via pipenv2018.10.13 and pyenv on Mac OS X 10.14. In the stacktrace I see PIPENV_INSTALL_TIMEOUT . So maybe some timeout is causing this bug.

@asmaier
Copy link

asmaier commented Oct 30, 2018

On Mac OS 10.14 this behavior of pipenv is actually triggered by a problem of pyenv: pyenv/pyenv#1219 . The workaround is to install the missing zlib header files on Mac OS X 10.14 with

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

After doing this I don't see the PIPENV_INSTALL_TIMEOUT error anymore. However after successfully installing Python 3.6.5 pipenv claims

Warning: The Python you just installed is not available on your PATH, apparently.

This happens despite setting the PYENV_ROOT variable. So it could be related to issue #3123

@asmaier
Copy link

asmaier commented Oct 30, 2018

I couldn't find a workaround for issue #3123 . So my steps how I got Python 3.6.5 working with pipenv and pyenv were

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
pyenv install 3.6.5
pipenv install --python ~/.pyenv/versions/3.6.5/bin/python

@ryancausey
Copy link

OS: Ubuntu 18.04
pipenv version: pipenv, version 2018.10.13
pyenv version: pyenv 1.2.8

I think that I'm having a potentially related issue? I can promote it to a separate ticket if it doesn't match this one.

I used the advanced feature of pipenv where it will detect that pyenv is installed and install the required version of python. That seemed to go well, though I did get the warning:
Warning: The Python you just installed is not available on your PATH, apparently.

After a reboot and attempting to pipenv install I get the following error:

ryan@ryan-XPS-13-9370:~/workspace/municipal_alarm/django-matsite$ pipenv install
Creating a virtualenv for this project…
Pipfile: /home/ryan/workspace/municipal_alarm/django-matsite/Pipfile
Using /home/ryan/.pyenv/shims/python3.7 (None) to create virtualenv…
⠹Running virtualenv with interpreter /home/ryan/.pyenv/shims/python3.7
pyenv: python3.7: command not found

The `python3.7' command exists in these Python versions:
  3.7.1


Traceback (most recent call last):
  File "/home/ryan/.local/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/home/ryan/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/ryan/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/ryan/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ryan/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ryan/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/ryan/.local/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/ryan/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/ryan/.local/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/ryan/.local/lib/python3.6/site-packages/pipenv/cli/command.py", line 249, in install
    editable_packages=state.installstate.editables,
  File "/home/ryan/.local/lib/python3.6/site-packages/pipenv/core.py", line 1724, in do_install
    pypi_mirror=pypi_mirror,
  File "/home/ryan/.local/lib/python3.6/site-packages/pipenv/core.py", line 565, in ensure_project
    pypi_mirror=pypi_mirror,
  File "/home/ryan/.local/lib/python3.6/site-packages/pipenv/core.py", line 500, in ensure_virtualenv
    python=python, site_packages=site_packages, pypi_mirror=pypi_mirror
  File "/home/ryan/.local/lib/python3.6/site-packages/pipenv/core.py", line 901, in do_create_virtualenv
    click.echo(crayons.blue("{0}".format(c.err)), err=True)
  File "/home/ryan/.local/lib/python3.6/site-packages/pipenv/vendor/delegator.py", line 146, in err
    return self._pexpect_out
  File "/home/ryan/.local/lib/python3.6/site-packages/pipenv/vendor/delegator.py", line 114, in _pexpect_out
    result += self.subprocess.after
TypeError: must be str, not type

The workaround that worked for me was to run pyenv local 3.7.1 in the parent directory (municipal_alarm) so that pyenv set the running version to 3.7.1 instead of the system python.

@techalchemy
Copy link
Member

between #3159 and #3161 I believe this is covered now, sorry for the bug!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants