question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"pipenv --python X.Y" fails with a traceback if pyenv has debug versions installed

See original GitHub issue

Be sure to check the existing issues (both open and closed!), and make sure you are running the latest version of Pipenv.

Check the diagnose documentation for common issues before posting! We may close your issue if it is very similar to one of them. Please be considerate, or be on your way.

Make sure to mention your debugging experience if the documented solution failed.

Issue description

pipenv --python X.Y command checks pyenv’s version list and does not like the debug builds (whose versions look like X.Y.Z-debug) failing with a traceback.

Expected result

I would expect pipenv to ignore unsupported versions silently (and with one warning per incompatible version in verbose mode), and proceed with installing what it wants.

Actual result

pyenv versions
immerrr@mmrcomp:~/pipenv-temp$ pyenv versions
* system (set by /home/immerrr/src/pyenv/version)
  3.6.4
  3.6.6
  3.6.6-debug
  3.7.0
pipenv --python 3.6.4 (traceback)
immerrr@mmrcomp:~/pipenv-temp$ pipenv --verbose --python 3.6.4
Traceback (most recent call last):
  File "/home/immerrr/.local/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 1114, in invoke
    return Command.invoke(self, ctx)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/cli/command.py", line 203, in cli
    clear=state.clear,
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/core.py", line 561, in ensure_project
    pypi_mirror=pypi_mirror,
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/core.py", line 506, in ensure_virtualenv
    ensure_python(three=three, python=python)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/core.py", line 397, in ensure_python
    path_to_python = find_a_system_python(python)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/core.py", line 360, in find_a_system_python
    python_entry = finder.find_python_version(line)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 86, in find_python_version
    return self.system_path.find_python_version(
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 40, in system_path
    global_search=self.global_search,
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 305, in create
    global_search=global_search,
  File "<attrs generated init 86da6fe0111de9e514cb2e45cc4c2cdd5d1b77a5>", line 36, in __init__
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 101, in __attrs_post_init__
    self._setup_pyenv()
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 132, in _setup_pyenv
    self.pyenv_finder = PyenvFinder.create(root=PYENV_ROOT)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/pyenv.py", line 52, in create
    return cls(root=root)
  File "<attrs generated init b7362d3ad3f81af215543f778c6ac52da8efc1bf>", line 6, in __init__
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/pyenv.py", line 26, in get_versions
    version = PythonVersion.parse(p.name)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 110, in parse
    raise ValueError("Not a valid python version: %r" % version)
ValueError: Not a valid python version: <LegacyVersion('3.6.6-debug')>

Steps to replicate

$ mkdir pipenv-temp; cd pipenv-temp
$ pyenv install 3.6.4
$ pyenv install 3.6.6 --debug
$ pipenv --python 3.6.4

pipenv --support is not much of a help here, because it tries to report a list of existing python versions.

pipenv --support | xclip
immerrr@mmrcomp:~/pipenv-temp$ pipenv --support | xclip
Traceback (most recent call last):
  File "/home/immerrr/.local/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 1114, in invoke
    return Command.invoke(self, ctx)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/cli/command.py", line 142, in cli
    get_pipenv_diagnostics()
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/help.py", line 33, in get_pipenv_diagnostics
    python_paths = finder.find_all_python_versions()
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 94, in find_all_python_versions
    python_version_dict = getattr(self.system_path, "python_version_dict")
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 40, in system_path
    global_search=self.global_search,
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 305, in create
    global_search=global_search,
  File "<attrs generated init 86da6fe0111de9e514cb2e45cc4c2cdd5d1b77a5>", line 36, in __init__
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 101, in __attrs_post_init__
    self._setup_pyenv()
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 132, in _setup_pyenv
    self.pyenv_finder = PyenvFinder.create(root=PYENV_ROOT)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/pyenv.py", line 52, in create
    return cls(root=root)
  File "<attrs generated init 9b5f675c374466a4d4c73b5f8e0738e27fe467e3>", line 6, in __init__
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/pyenv.py", line 26, in get_versions
    version = PythonVersion.parse(p.name)
  File "/home/immerrr/.local/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 110, in parse
    raise ValueError("Not a valid python version: %r" % version)
ValueError: Not a valid python version: <LegacyVersion('3.6.6-debug')>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
andreifcommented, Oct 19, 2018

Managed to get it working with the older versions:

pip install pip==18.0
pip install pipenv==2018.7.1
1reaction
techalchemycommented, Nov 23, 2018

These issues are all resolved in the current master branch and the fix will be released shortly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is Pipenv not picking up my Pyenv versions?
Show activity on this post. I came across this previous question Pipenv not recognizing Pyenv version? and set the environment variable PIPENV_ ...
Read more >
What's New In Python 3.11 — Python 3.11.1 documentation
When printing tracebacks, the interpreter will now point to the exact expression that caused the error, instead of just the line. For example:....
Read more >
Python 3.11.0 final - Hacker News
Is it a good idea to test things with Python 3.11 and run it in prod using a different Python version? It might...
Read more >
if this fails your python may not be configured for tk ...
if you have your Python version already installed with pyenv then uninstall it with ... Luckily, the solution is simple: install tkinter for...
Read more >
pipenv Documentation - Read the Docs
Generates and checks file hashes for locked dependencies when installing from Pipfile.lock. • Automatically install required Python version when pyenv is ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found