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

Latest pythonfinder logic cant handle pyenv and --two combination #3269

Closed
greysteil opened this issue Nov 20, 2018 · 3 comments
Closed

Latest pythonfinder logic cant handle pyenv and --two combination #3269

greysteil opened this issue Nov 20, 2018 · 3 comments

Comments

@greysteil
Copy link
Contributor

greysteil commented Nov 20, 2018

Issue description

Running pyenv exec pipenv --two lock causes an error

Expected result

It should pick a version of Python 2 and use that, rather than erroring

Actual result

  File "/Users/greysteil/.pyenv/versions/3.6.6/bin/pipenv", line 11, in <module>
    load_entry_point('pipenv', 'console_scripts', 'pipenv')()
  File "/Users/greysteil/code/dependabot-core/helpers/python/src/pipenv/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Users/greysteil/code/dependabot-core/helpers/python/src/pipenv/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/Users/greysteil/code/dependabot-core/helpers/python/src/pipenv/pipenv/vendor/click/core.py", line 1134, in invoke
    Command.invoke(self, ctx)
  File "/Users/greysteil/code/dependabot-core/helpers/python/src/pipenv/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/greysteil/code/dependabot-core/helpers/python/src/pipenv/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/Users/greysteil/code/dependabot-core/helpers/python/src/pipenv/pipenv/vendor/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/Users/greysteil/code/dependabot-core/helpers/python/src/pipenv/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/Users/greysteil/code/dependabot-core/helpers/python/src/pipenv/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/greysteil/code/dependabot-core/helpers/python/src/pipenv/pipenv/cli/command.py", line 204, in cli
    clear=state.clear,
  File "/Users/greysteil/code/dependabot-core/helpers/python/src/pipenv/pipenv/core.py", line 569, in ensure_project
    pypi_mirror=pypi_mirror,
  File "/Users/greysteil/code/dependabot-core/helpers/python/src/pipenv/pipenv/core.py", line 511, in ensure_virtualenv
    ensure_python(three=three, python=python)
  File "/Users/greysteil/code/dependabot-core/helpers/python/src/pipenv/pipenv/core.py", line 397, in ensure_python
    path_to_python = find_a_system_python(python)
  File "/Users/greysteil/code/dependabot-core/helpers/python/src/pipenv/pipenv/core.py", line 360, in find_a_system_python
    python_entry = finder.find_python_version(line)
  File "/Users/greysteil/code/dependabot-core/helpers/python/src/pipenv/pipenv/vendor/pythonfinder/pythonfinder.py", line 95, in find_python_version
    version_dict = PythonVersion.parse(major)
  File "/Users/greysteil/code/dependabot-core/helpers/python/src/pipenv/pipenv/vendor/pythonfinder/models/python.py", line 358, in parse
    version_dict = parse_python_version(str(version))
  File "/Users/greysteil/code/dependabot-core/helpers/python/src/pipenv/pipenv/vendor/pythonfinder/utils.py", line 86, in parse_python_version
    raise InvalidPythonVersion("%s is not a python version" % version_str)
pipenv.vendor.pythonfinder.exceptions.InvalidPythonVersion: 2 is not a python version

Steps to replicate

Run pyenv exec pipenv --two lock on any Pipenv file (with Pipenv at current master).


$ pipenv --support

Pipenv version: '2018.10.14.dev0'

Pipenv location: '/usr/local/lib/python3.6/site-packages/pipenv-2018.10.14.dev0-py3.6.egg/pipenv'

Python location: '/usr/local/opt/python/bin/python3.6'

Python installations found:

  • 3.7.0: /Users/greysteil/.pyenv/versions/3.7.0/bin/python3
  • 3.7.0: /Users/greysteil/.pyenv/versions/3.7.0/bin/python3.7m
  • 3.6.7: /Users/greysteil/.pyenv/versions/3.6.7/bin/python3
  • 3.6.7: /Users/greysteil/.pyenv/versions/3.6.7/bin/python3.6m
  • 3.6.6: /Users/greysteil/.pyenv/versions/3.6.6/bin/python3
  • 3.6.6: /Users/greysteil/.pyenv/versions/3.6.6/bin/python3.6m
  • 3.6.5: /Users/greysteil/.pyenv/versions/3.6.5/bin/python3
  • 3.6.5: /Users/greysteil/.pyenv/versions/3.6.5/bin/python3.6m
  • 3.6.5: /usr/local/bin/python3
  • 3.6.5: /usr/local/bin/python3.6m
  • 3.5.0: /Users/greysteil/.pyenv/versions/3.5.0/bin/python3
  • 3.5.0: /Users/greysteil/.pyenv/versions/3.5.0/bin/python3.5m
  • 2.7.15: /Users/greysteil/.pyenv/versions/2.7.15/bin/python
  • 2.7.14: /Users/greysteil/.pyenv/versions/2.7.14/bin/python
  • 2.7.10: /usr/bin/python
  • 2.7.10: /usr/bin/pythonw
  • 2.7.10: /usr/bin/python2.7

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.6.5',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '17.7.0',
 'platform_system': 'Darwin',
 'platform_version': 'Darwin Kernel Version 17.7.0: Wed Oct 10 23:06:14 PDT '
                     '2018; root:xnu-4570.71.13~1/RELEASE_X86_64',
 'python_full_version': '3.6.5',
 'python_version': '3.6',
 'sys_platform': 'darwin'}

System environment variables:

  • TERM_PROGRAM
  • PYENV_ROOT
  • TERM
  • SHELL
  • CLICOLOR
  • TMPDIR
  • Apple_PubSub_Socket_Render
  • TERM_PROGRAM_VERSION
  • TERM_SESSION_ID
  • USER
  • SSH_AUTH_SOCK
  • LSCOLORS
  • PATH
  • PWD
  • EDITOR
  • LANG
  • XPC_FLAGS
  • RBENV_SHELL
  • XPC_SERVICE_NAME
  • HOME
  • SHLVL
  • LOGNAME
  • OLDPWD
  • _
  • __CF_USER_TEXT_ENCODING
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PIP_SHIMS_BASE_MODULE
  • PIP_PYTHON_PATH
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /Users/greysteil/.poetry/bin:/Users/greysteil/.config/yarn/global/node_modules/.bin:/Users/greysteil/.poetry/bin::/Users/greysteil/go/bin::/usr/local/opt/erlang@20/bin:/Users/greysteil/.pyenv/bin:/Users/greysteil/.cargo/bin:/usr/local/heroku/bin:/Users/greysteil/.rbenv/shims:/usr/local/bin:./node_modules/.bin:.bundle/binstubs:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/go/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/local/git/bin:/usr/local/sbin
  • SHELL: /bin/bash
  • EDITOR: subl -w
  • LANG: en_GB.UTF-8
  • PWD: /Users/greysteil/code/python-test

Contents of Pipfile ('/Users/greysteil/code/python-test/Pipfile'):

[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[dev-packages]
pytest = "==3.4.0"

[packages]
BeautifulSoup = "==3.2.1"

Contents of Pipfile.lock ('/Users/greysteil/code/python-test/Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "4966194f00a93fc69e0ad90f20a2039c70934ebc878e8b9b68bc8c8b3bd214b4"
        },
        "pipfile-spec": 6,
        "requires": {},
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.python.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "beautifulsoup": {
            "hashes": [
                "sha256:6a8cb4401111e011b579c8c52a51cdab970041cc543814bbd9577a4529fe1cdb"
            ],
            "index": "pypi",
            "version": "==3.2.1"
        }
    },
    "develop": {
        "attrs": {
            "hashes": [
                "sha256:10cbf6e27dbce8c30807caf056c8eb50917e0eaafe86347671b57254006c3e69",
                "sha256:ca4be454458f9dec299268d472aaa5a11f67a4ff70093396e1ceae9c76cf4bbb"
            ],
            "version": "==18.2.0"
        },
        "funcsigs": {
            "hashes": [
                "sha256:330cc27ccbf7f1e992e69fef78261dc7c6569012cf397db8d3de0234e6c937ca",
                "sha256:a7bb0f2cf3a3fd1ab2732cb49eba4252c2af4240442415b4abce3b87022a8f50"
            ],
            "markers": "python_version < '3.0'",
            "version": "==1.0.2"
        },
        "pluggy": {
            "hashes": [
                "sha256:7f8ae7f5bdf75671a718d2daf0a64b7885f74510bcd98b1a0bb420eb9a9d0cff",
                "sha256:d345c8fe681115900d6da8d048ba67c25df42973bda370783cd58826442dcd7c",
                "sha256:e160a7fcf25762bb60efc7e171d4497ff1d8d2d75a3d0df7a21b76821ecbf5c5"
            ],
            "version": "==0.6.0"
        },
        "py": {
            "hashes": [
                "sha256:bf92637198836372b520efcba9e020c330123be8ce527e535d185ed4b6f45694",
                "sha256:e76826342cefe3c3d5f7e8ee4316b80d1dd8a300781612ddbc765c17ba25a6c6"
            ],
            "version": "==1.7.0"
        },
        "pytest": {
            "hashes": [
                "sha256:6074ea3b9c999bd6d0df5fa9d12dd95ccd23550df2a582f5f5b848331d2e82ca",
                "sha256:95fa025cd6deb5d937e04e368a00552332b58cae23f63b76c8c540ff1733ab6d"
            ],
            "index": "pypi",
            "version": "==3.4.0"
        },
        "six": {
            "hashes": [
                "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9",
                "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb"
            ],
            "version": "==1.11.0"
        }
    }
}
@duplicate-issues
Copy link

Hey @greysteil,

We did a quick check and this issue looks very darn similar to

This could be a coincidence, but if any of these issues solves your problem then I did a good job 😄

If not, the maintainers will get to this issue shortly.

Cheers,
Your Friendly Neighborhood ProBot

@techalchemy
Copy link
Member

what, you think "2" is a real python version? all part of the plan to deprecate python 2 a year early!

Just kidding, I just didn't write the regex to handle that...

@greysteil
Copy link
Contributor Author

Fixed by #3280.

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

No branches or pull requests

2 participants