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.
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.
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.
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')>
$ 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')>
I will leave it here just in case, it helps to debug.
This could be a bug in pythonfinder
.
from pipenv.vendor.pythonfinder import Finder
finder = Finder(system=False, global_search=True)
finder.find_all_python_versions()
File "<stdin>", line 1, in <module>
File "/Users/rajaravivarma/.pyenv/versions/3.6.1/lib/python3.6/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 "/Users/rajaravivarma/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 40, in system_path
global_search=self.global_search,
File "/Users/rajaravivarma/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 305, in create
global_search=global_search,
File "<attrs generated init bde0054ea6f8f56b755b8b6facd8b8699a25e504>", line 36, in __init__
self.__attrs_post_init__()
File "/Users/rajaravivarma/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 101, in __attrs_post_init__
self._setup_pyenv()
File "/Users/rajaravivarma/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 132, in _setup_pyenv
self.pyenv_finder = PyenvFinder.create(root=PYENV_ROOT)
File "/Users/rajaravivarma/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/pyenv.py", line 52, in create
return cls(root=root)
File "<attrs generated init b016a3823f5b2d50d2778b5f25fdad9695433c03>", line 6, in __init__
self.versions = __attr_factory_versions(self)
File "/Users/rajaravivarma/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/pyenv.py", line 26, in get_versions
version = PythonVersion.parse(p.name)
File "/Users/rajaravivarma/.pyenv/versions/3.6.1/lib/python3.6/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('2.7.14_vim')>
Not a valid python version: <LegacyVersion('2.7.14_vim')>
yeah this is definitely a bug in pythonfinder, I thought we fixed this actually...
can you file against pythonfinder with these logs so we can track it over there? thanks
@techalchemy sure: https://github.com/sarugaku/pythonfinder/issues/12
I've added a PR that implements a flag for pythonfinder to ignore unsupported python versions and thus silence the errors. An extra step on pipenv side of things is probably to ensure that the warning for unsupported versions is shown with --verbose
flag.
@techalchemy whoops, i think i have misplaced the word "fix" in the description to https://github.com/sarugaku/pythonfinder/pull/14, this should probably be reopened until there's a PR that enables that flag
This bug occurs at 2018.10.9, too.
✘  ~/tmp/pyenvpipenv  pipenv install --python=3.6.6 requests
Traceback (most recent call last):
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/bin/pipenv", line 11, in <module>
load_entry_point('pipenv==2018.10.9', 'console_scripts', 'pipenv')()
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pipenv/cli/command.py", line 249, in install
editable_packages=state.installstate.editables,
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pipenv/core.py", line 1695, in do_install
pypi_mirror=pypi_mirror,
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pipenv/core.py", line 561, in ensure_project
pypi_mirror=pypi_mirror,
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pipenv/core.py", line 484, in ensure_virtualenv
python = ensure_python(three=three, python=python)
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pipenv/core.py", line 397, in ensure_python
path_to_python = find_a_system_python(python)
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pipenv/core.py", line 360, in find_a_system_python
python_entry = finder.find_python_version(line)
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 86, in find_python_version
return self.system_path.find_python_version(
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 40, in system_path
global_search=self.global_search,
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 305, in create
global_search=global_search,
File "<attrs generated init bde0054ea6f8f56b755b8b6facd8b8699a25e504>", line 36, in __init__
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 101, in __attrs_post_init__
self._setup_pyenv()
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 132, in _setup_pyenv
self.pyenv_finder = PyenvFinder.create(root=PYENV_ROOT)
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/pyenv.py", line 52, in create
return cls(root=root)
File "<attrs generated init 20759c21490810f5defeadf2f52bb9c4e0ffb315>", line 6, in __init__
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/pyenv.py", line 26, in get_versions
version = PythonVersion.parse(p.name)
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.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('sample3env')>
This bug in fact only occurs in 2018.10.9 as that is the only version with pythonfinder in it. It will be fixed in the follow up release in 20 mins
I still get the error with pipenv==2018.10.13
and pyenv
.
Managed to get it working with the older versions:
pip install pip==18.0
pip install pipenv==2018.7.1
I've managed it with brew on macOS:
brew switch pipenv 2018.7.1
pipenv --python 3.6.4
and then back as version 2018.7.1 has its own bugs:
brew switch pipenv 2018.10.13
I am getting the following error :
Step 13/19 : RUN pipenv run python3
---> Running in 8cc80c17cd1e
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/pipenv/cli/command.py", line 405, in run
command=command, args=args, three=state.three, python=state.python, pypi_mirror=state.pypi_mirror
File "/usr/local/lib/python3.6/dist-packages/pipenv/core.py", line 2303, in do_run
three=three, python=python, validate=False, pypi_mirror=pypi_mirror,
File "/usr/local/lib/python3.6/dist-packages/pipenv/core.py", line 569, in ensure_project
pypi_mirror=pypi_mirror,
File "/usr/local/lib/python3.6/dist-packages/pipenv/core.py", line 489, in ensure_virtualenv
python = ensure_python(three=three, python=python)
File "/usr/local/lib/python3.6/dist-packages/pipenv/core.py", line 397, in ensure_python
path_to_python = find_a_system_python(python)
File "/usr/local/lib/python3.6/dist-packages/pipenv/core.py", line 360, in find_a_system_python
python_entry = finder.find_python_version(line)
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 114, in find_python_version
major=major, minor=minor, patch=patch, pre=pre, dev=dev, arch=arch, name=name
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/pythonfinder/models/path.py", line 396, in find_python_version
ver = next(iter(self.get_pythons(sub_finder)), None)
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/pythonfinder/models/path.py", line 279, in get_pythons
reverse=True
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/pythonfinder/models/path.py", line 277, in <genexpr>
(p for p in self._filter_paths(finder) if p.is_python),
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/pythonfinder/models/path.py", line 264, in <genexpr>
pth for pth in unnest(finder(p) for p in self.path_entries if p is not None)
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/pythonfinder/utils.py", line 138, in unnest
for el in target:
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/pythonfinder/models/path.py", line 264, in <genexpr>
pth for pth in unnest(finder(p) for p in self.path_entries if p is not None)
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/pythonfinder/models/mixins.py", line 121, in find_python_version
for child in unnest(self.pythons.values())
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/pythonfinder/models/path.py", line 523, in pythons
for path, entry in self.children.items():
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/cached_property.py", line 35, in __get__
value = obj.__dict__[self.func.__name__] = self.func(obj)
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/pythonfinder/models/path.py", line 494, in children
for child_key, child_val in self._gen_children():
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/pythonfinder/models/path.py", line 487, in _gen_children
yield (child.as_posix(), PathEntry.create(path=child, **pass_args))
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/pythonfinder/models/path.py", line 567, in create
_new = cls(**creation_args)
File "<attrs generated init ccbadb9d488cff824a579602da7c0d1b845480a9>", line 16, in __init__
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/pythonfinder/models/path.py", line 510, in get_py_version
py_version = PythonVersion.from_path(path=self, name=self.name)
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/pythonfinder/models/python.py", line 418, in from_path
instance_dict = cls.parse(py_version.strip())
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/pythonfinder/models/python.py", line 366, in parse
raise ValueError("Not a valid python version: %r" % version)
ValueError: Not a valid python version: <LegacyVersion('3.6.6+')>
The command '/bin/sh -c pipenv run python3' returned a non-zero code: 1
I had the same error with ubuntu 18.10: its python 2.7 in /usr/bin/python reports itself as 2.7.15+
and the +
doesn't amuse pythonfinder.
(With the info here I added a quick .rstrip('+')
into the vendored pythonfinder, so I'm ok. And I see the fix will be included in the november bugfix release. So I mostly mentioned it to help people googling for the ubuntu 18.10 problem.)
These issues are all resolved in the current master branch and the fix will be released shortly.
Most helpful comment
Managed to get it working with the older versions: