using conda python to create pipenv adds both python_version and python_full_version to pipfile
See original GitHub issueHello,
If I use a miniconda environment’s python for creating a pipenv environment, it adds BOTH, a python_version and python_full_version (e.g. 3.9 and 3.9.13) to the pipfile, and that throws an error.
System details:
I am using Ubuntu 22.04 via WSL. System python is: 3.10.6 Pip version is: 22.2.2 Pipenv installed via pip (outside of any environment): 2022.10.9 Conda version is: 22.9.0 All are the latest right now
Steps to reproduce the error:
(mlzoomcamp is a conda environment with python 3.9.13 (but I also used a conda env with python 3.10 and the same issue persisted))
(base) mona@Memoona-PC:~$ pipenv --python=/home/mona/miniconda3/envs/mlzoomcamp/bin/python
# runs fine, but when I install something:
(base) mona@Memoona-PC:~/extra$ pipenv install numpy
It installs numpy correctly, but then throws this error:
Installing numpy...
Adding numpy to Pipfile's [packages]...
✔ Installation Succeeded
Pipfile.lock not found, creating...
Traceback (most recent call last):
File "/home/mona/.local/bin/pipenv", line 8, in <module>
sys.exit(cli())
File "/home/mona/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/home/mona/.local/lib/python3.10/site-packages/pipenv/cli/options.py", line 57, in main
return super().main(*args, **kwargs, windows_expand_args=False)
File "/home/mona/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/home/mona/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/mona/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/mona/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/home/mona/.local/lib/python3.10/site-packages/pipenv/vendor/click/decorators.py", line 84, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/home/mona/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/home/mona/.local/lib/python3.10/site-packages/pipenv/cli/command.py", line 236, in install
do_install(
File "/home/mona/.local/lib/python3.10/site-packages/pipenv/core.py", line 2389, in do_install
do_init(
File "/home/mona/.local/lib/python3.10/site-packages/pipenv/core.py", line 1303, in do_init
do_lock(
File "/home/mona/.local/lib/python3.10/site-packages/pipenv/core.py", line 1070, in do_lock
lockfile = project._lockfile(categories=lockfile_categories)
File "/home/mona/.local/lib/python3.10/site-packages/pipenv/project.py", line 581, in _lockfile
plette.Pipfile.load(pf), categories=categories
File "/home/mona/.local/lib/python3.10/site-packages/pipenv/vendor/plette/pipfiles.py", line 59, in load
return cls(data)
File "/home/mona/.local/lib/python3.10/site-packages/pipenv/vendor/plette/models/base.py", line 49, in __init__
self.validate(data)
File "/home/mona/.local/lib/python3.10/site-packages/pipenv/vendor/plette/pipfiles.py", line 43, in validate
klass.validate(data[key])
File "/home/mona/.local/lib/python3.10/site-packages/pipenv/vendor/plette/models/base.py", line 81, in validate
return validate(cls, data)
File "/home/mona/.local/lib/python3.10/site-packages/pipenv/vendor/plette/models/base.py", line 38, in validate
raise ValidationError(data, v)
pipenv.vendor.plette.models.base.ValidationError: {'python_version': '3.9', 'python_full_version': '3.9.13'}
python_full_version: 'python_version' must not be present with 'python_full_version'
python_version: 'python_full_version' must not be present with 'python_version'
The pipenv file at this time looks like this:
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
numpy = "*"
[dev-packages]
[requires]
python_version = "3.9"
python_full_version = "3.9.13"
I looked at the pipfile before the install command, and it has already added the 2 versions as soon as the environment was created.
I did find a fix, to manually remove the python_version line from pipfile.
Also, if I use the system python to create an environment, this issue doesn’t happen, so this is most likely a conda issue. Do I have to manually remove the python_version each time from the pipfile?
Issue Analytics
- State:
- Created a year ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
Thanks @stewartmiles – I just pushed the buttons – new release is building now.
@jerempy can you please submit this patch upstream in Plette? https://github.com/sarugaku/plette/blob/master/src/plette/models/sections.py#L20
IMHO the rule should be oneof, but I am not familiar with Cerberus. To say for 100%.