Pipenv thinks a hidden path is a python version
See original GitHub issue$ pipenv --python .tox/py39-lock/bin/python install .
Traceback (most recent call last):
File "/ifs/home/dtucker/.local/bin/pipenv", line 8, in <module>
sys.exit(cli())
File "/ifs/home/dtucker/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/ifs/home/dtucker/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/ifs/home/dtucker/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1256, in invoke
Command.invoke(self, ctx)
File "/ifs/home/dtucker/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/ifs/home/dtucker/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/ifs/home/dtucker/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 73, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/ifs/home/dtucker/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/ifs/home/dtucker/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/ifs/home/dtucker/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/cli/command.py", line 204, in cli
clear=state.clear,
File "/ifs/home/dtucker/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/core.py", line 580, in ensure_project
pypi_mirror=pypi_mirror,
File "/ifs/home/dtucker/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/core.py", line 498, in ensure_virtualenv
python = ensure_python(three=three, python=python)
File "/ifs/home/dtucker/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/core.py", line 388, in ensure_python
path_to_python = find_a_system_python(python)
File "/ifs/home/dtucker/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/core.py", line 354, in find_a_system_python
python_entry = find_python(finder, line)
File "/ifs/home/dtucker/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/utils.py", line 2196, in find_python
result = finder.find_python_version(line)
File "/ifs/home/dtucker/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 262, in find_python_version
version_dict = self.parse_major(major, minor=minor, patch=patch, arch=arch)
File "/ifs/home/dtucker/.local/pipx/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 209, in parse_major
int(version_dict["major"]) if version_dict.get("major") is not None else major
ValueError: invalid literal for int() with base 10: '.tox/py39-lock/bin/python'
- Note: This was originally encountered via a
tox.ini
:commands = pipenv --python {envpython} install .
https://github.com/pypa/pipenv/blob/deefb637a646b4e5432e1934453da61a9683ad7e/pipenv/utils.py#L2212
Perhaps that should use parentheses instead of brackets (or just omit the .
altogether)?
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (3 by maintainers)
Top Results From Across the Web
Why is pipenv telling me the wrong version of python?
With pipenv you simply have to set the WORKON_HOME folder then pipenv install should create your virtual env under that same folder. Every...
Read more >Pipenv install - Python - Codecademy Forums
I tried and tried but can't run piping or piping --version. I've uninstalled and installed again copied the path but it doesn't work....
Read more >Pipenv: A Guide to the New Python Packaging Tool
Pipenv is a packaging tool for Python that solves some common problems associated with the typical workflow using pip, virtualenv, and the good...
Read more >Django tooling with Pipenv, Pre-Commit, GitHub actions and ...
This also means that you'll end up with 2 versions of python in your computer. ... you can think of pipenv like the...
Read more >Python versions, pyenv and pipenv - GitLab
If the pyenv directory is in your path, you can simply invoke $ pipenv --python 3.7 without you having to explicitly specify the...
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 Free
Top 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
@matteius I can reproduce the issue on Ubuntu 22.04 using the following versions:
python: 3.10.4 pipenv: 2022.6.7
Simple script to reproduce this, utilizes
tox
andtox-pipenv
:and the following
Pipfile
:tox -e py310
gives the following output:well, the goal is to prevent it from treating a path as a python version; it’s supposed to use a python of its own if it’s a version and the specified python if it’s a path, and I think in that latter case people are taking responsibility for ensuring that executable is appropriate. So maybe in this case it would be appropriate to borrow
packaging.version.VERSION_PATTERN
that matches PEP 440 versions, and make sure the version is the whole string, with something likere.match(f'^{VERSION_PATTERN}$')
.