Pipenv: Pipenv fails to create python 2 environment in WSL

Created on 24 Nov 2019  路  3Comments  路  Source: pypa/pipenv

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

If you're requesting a new feature, please use the PEEP process:

https://github.com/pypa/pipenv/blob/master/peeps/PEEP-000.md

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

Not able to create python 2.7 environment using pipenv in WSL.

raj@Home:~/test$ pipenv --python 2.7
['Traceback (most recent call last):\n', '  File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/vistir/contextmanagers.py", line 150, in spinner\n    yield _spinner\n', '  File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/vistir/misc.py", line 314, in run\n    write_to_stdout=True\n', '  File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/vistir/misc.py", line 162, in _create_subprocess\n    sys.stderr.write("Error %s while executing command %s", exc, " ".join(cmd._parts))\n', 'TypeError: function takes exactly 1 argument (3 given)\n']
Traceback (most recent call last):
  File "/home/linuxbrew/.linuxbrew/bin/pipenv", line 8, in <module>
    sys.exit(cli())
  File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 1114, in invoke
    return Command.invoke(self, ctx)
  File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/cli/command.py", line 208, in cli
    clear=state.clear,
  File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/core.py", line 574, in ensure_project
    pypi_mirror=pypi_mirror,
  File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/core.py", line 494, in ensure_virtualenv
    python = ensure_python(three=three, python=python)
  File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/core.py", line 397, in ensure_python
    path_to_python = find_a_system_python(python)
  File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/core.py", line 360, in find_a_system_python
    python_entry = finder.find_python_version(line)
  File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/backports/functools_lru_cache.py", line 137, in wrapper
    result = user_function(*args, **kwds)
  File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-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 "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 396, in find_python_version
    ver = next(iter(self.get_pythons(sub_finder)), None)
  File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 279, in get_pythons
    reverse=True
  File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 277, in <genexpr>
    (p for p in self._filter_paths(finder) if p.is_python),
  File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-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 "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/utils.py", line 251, in unnest
    for el in target:
  File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-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 "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/mixins.py", line 121, in find_python_version
    for child in unnest(self.pythons.values())
  File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 531, in pythons
    for path, entry in self.children.items():
  File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/cached_property.py", line 35, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 501, in children
    for child_key, child_val in self._gen_children():
  File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 493, in _gen_children
    entry = PathEntry.create(path=child, **pass_args)
  File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 575, in create
    _new = cls(**creation_args)
  File "<attrs generated init 831bd1ca3699fe5f37069591d0f5fbdbbc85bebf>", line 16, in __init__
  File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 518, in get_py_version
    py_version = PythonVersion.from_path(path=self, name=self.name)
  File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 395, in from_path
    py_version = get_python_version(path.path.absolute().as_posix())
  File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/backports/functools_lru_cache.py", line 137, in wrapper
    result = user_function(*args, **kwds)
  File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/utils.py", line 68, in get_python_version
    combine_stderr=False, write_to_stdout=False)
  File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/vistir/misc.py", line 314, in run
    write_to_stdout=True
  File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/vistir/misc.py", line 162, in _create_subprocess
    sys.stderr.write("Error %s while executing command %s", exc, " ".join(cmd._parts))
TypeError: function takes exactly 1 argument (3 given)

Expected result

Environment should be created

Actual result

Environment creation failed.

Steps to replicate

Run pipenv environment creation command.

pipenv --python 2.7


Please run $ pipenv --support, and paste the results here. Don't put backticks (`) around it! The output already contains Markdown formatting.

$ pipenv --support

Pipenv version: '2018.11.26'

Pipenv location: '/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv'

Python location: '/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/bin/python'

Python installations found:

['Traceback (most recent call last):\n', ' File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/vistir/contextmanagers.py", line 150, in spinner\n yield _spinner\n', ' File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/vistir/misc.py", line 314, in run\n write_to_stdout=True\n', ' File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/vistir/misc.py", line 162, in _create_subprocess\n sys.stderr.write("Error %s while executing command %s", exc, " ".join(cmd._parts))\n', 'TypeError: function takes exactly 1 argument (3 given)\n']
Traceback (most recent call last):
File "/home/linuxbrew/.linuxbrew/bin/pipenv", line 8, in
sys.exit(cli())
File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
return self.main(args, kwargs)
File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 1114, in invoke
return Command.invoke(self, ctx)
File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, *
ctx.params)
File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(args, *kwargs)
File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, args, *kwargs)
File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(args, *kwargs)
File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
return f(get_current_context(), args, *kwargs)
File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/cli/command.py", line 146, in cli
get_pipenv_diagnostics()
File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/help.py", line 33, in get_pipenv_diagnostics
python_paths = finder.find_all_python_versions()
File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/backports/functools_lru_cache.py", line 137, in wrapper
result = user_function(args, *kwds)
File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 136, in find_all_python_versions
major=major, minor=minor, patch=patch, pre=pre, dev=dev, arch=arch, name=name
File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 328, in find_all_python_versions
values = list(self.get_pythons(sub_finder))
File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 279, in get_pythons
reverse=True
File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 277, in
(p for p in self._filter_paths(finder) if p.is_python),
File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 264, in
pth for pth in unnest(finder(p) for p in self.path_entries if p is not None)
File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/utils.py", line 251, in unnest
for el in target:
File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 264, in
pth for pth in unnest(finder(p) for p in self.path_entries if p is not None)
File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/mixins.py", line 76, in find_all_python_versions
path_filter = filter(None, (sub_finder(p) for p in self.children.values()))
File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/cached_property.py", line 35, in __get__
value = obj.__dict__[self.func.__name__] = self.func(obj)
File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 501, in children
for child_key, child_val in self._gen_children():
File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 493, in _gen_children
entry = PathEntry.create(path=child, *pass_args)
File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 575, in create
_new = cls(
creation_args)
File "", line 16, in __init__
File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 518, in get_py_version
py_version = PythonVersion.from_path(path=self, name=self.name)
File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 395, in from_path
py_version = get_python_version(path.path.absolute().as_posix())
File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/backports/functools_lru_cache.py", line 137, in wrapper
result = user_function(
args, **kwds)
File "/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.17/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/utils.py", line 68, in get_python_version
combine_stderr=False, write_to_stdout=False)
File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/vistir/misc.py", line 314, in run
write_to_stdout=True
File "/home/linuxbrew/.linuxbrew/lib/python2.7/site-packages/pipenv/vendor/vistir/misc.py", line 162, in _create_subprocess
sys.stderr.write("Error %s while executing command %s", exc, " ".join(cmd._parts))
TypeError: function takes exactly 1 argument (3 given)

triage

Most helpful comment

Welp, I got this working, I think what did it was running install like this:

PATH=$(echo $PATH | sed -e 's/:\/mnt\/c\/WINDOWS.*:/:/g') pipenv --three install

Removes the Windows bin directories from the path for this one command.

All 3 comments

Possible duplicate of #4016

Welp, I got this working, I think what did it was running install like this:

PATH=$(echo $PATH | sed -e 's/:\/mnt\/c\/WINDOWS.*:/:/g') pipenv --three install

Removes the Windows bin directories from the path for this one command.

Welp, I got this working, I think what did it was running install like this:

PATH=$(echo $PATH | sed -e 's/:\/mnt\/c\/WINDOWS.*:/:/g') pipenv --three install

Removes the Windows bin directories from the path for this one command.

check the casing of the Windows directory ;-)

Was this page helpful?
0 / 5 - 0 ratings