Pipenv: AttributeError: 'NoneType' object has no attribute 'pythons' when creating new pipfile

Created on 12 Jan 2019  Â·  20Comments  Â·  Source: pypa/pipenv

Issue description

I tried to run pipenv install --verbose and it failed.

Expected result

I expected a virtualenv to be set up, a pipfile to be created, and no errors to pop up.

Actual result (ran with --verbose)

Creating a virtualenv for this project…
Pipfile: /Users/******/Pipfile
Using /usr/local/Cellar/pipenv/2018.11.26/libexec/bin/python3.7 (3.7.2) to create virtualenv…
â Ź Creating virtual environment...Already using interpreter /usr/local/Cellar/pipenv/2018.11.26/libexec/bin/python3.7
Using real prefix '/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7'
New python executable in /Users/******/.local/share/virtualenvs/******/bin/python3.7
Also creating executable in /Users/******/.local/share/virtualenvs/******/bin/python
Installing setuptools, pip, wheel...
done.

âś” Successfully created virtual environment!
Virtualenv location: /Users/******/.local/share/virtualenvs/******/
Creating a Pipfile for this project…
Traceback (most recent call last):
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/bin/pipenv", line 11, in <module>
    load_entry_point('pipenv==2018.11.26', 'console_scripts', 'pipenv')()
  File "/usr/local/Cellar/pipenv/2018.11.26/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.11.26/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.11.26/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.11.26/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.11.26/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.11.26/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.11.26/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.11.26/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.11.26/libexec/lib/python3.7/site-packages/pipenv/cli/command.py", line 254, in install
    editable_packages=state.installstate.editables,
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/core.py", line 1741, in do_install
    pypi_mirror=pypi_mirror,
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/core.py", line 609, in ensure_project
    validate=validate, skip_requirements=skip_requirements, system=system
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/core.py", line 320, in ensure_pipfile
    project.create_pipfile(python=python)
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/project.py", line 726, in create_pipfile
    required_python = self.which("python", self.virtualenv_location)
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/project.py", line 1083, in which
    result = next(iter(filter(None, (find(finder) for finder in self.finders))), None)
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/project.py", line 1083, in <genexpr>
    result = next(iter(filter(None, (find(finder) for finder in self.finders))), None)
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 67, in which
    return self.system_path.which(exe)
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 54, in system_path
    ignore_unsupported=self.ignore_unsupported,
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 451, in create
    ignore_unsupported=ignore_unsupported,
  File "<attrs generated init 75e45f144e3d5510d54dd5fca6730b98fa0220a9>", line 38, in __init__
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 116, in __attrs_post_init__
    self._setup_pyenv()
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 196, in _setup_pyenv
    version_glob_path="versions/*", ignore_unsupported=self.ignore_unsupported
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 156, in create
    sort_function=sort_function, version_glob_path=version_glob_path)
  File "<attrs generated init e10e89ae41c3b673beaf8c9439cf2f48dc63d342>", line 21, in __init__
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 147, in get_pythons
    pythons.update(p.pythons)
AttributeError: 'NoneType' object has no attribute 'pythons'

Steps to replicate

Provide the steps to replicate (which usually at least includes the commands and the Pipfile).

pipenv install --verbose on macOS with pyenv installed.

$ pipenv --support

Pipenv version: '2018.11.26'

Pipenv location: '/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv'

Python location: '/usr/local/Cellar/pipenv/2018.11.26/libexec/bin/python3.7'

Python installations found:

Traceback (most recent call last):
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/bin/pipenv", line 11, in <module>
    load_entry_point('pipenv==2018.11.26', 'console_scripts', 'pipenv')()
  File "/usr/local/Cellar/pipenv/2018.11.26/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.11.26/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.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1114, in invoke
    return Command.invoke(self, ctx)
  File "/usr/local/Cellar/pipenv/2018.11.26/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.11.26/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.11.26/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.11.26/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.11.26/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.11.26/libexec/lib/python3.7/site-packages/pipenv/cli/command.py", line 146, in cli
    get_pipenv_diagnostics()
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/help.py", line 33, in get_pipenv_diagnostics
    python_paths = finder.find_all_python_versions()
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 122, in find_all_python_versions
    python_version_dict = getattr(self.system_path, "python_version_dict")
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 54, in system_path
    ignore_unsupported=self.ignore_unsupported,
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 451, in create
    ignore_unsupported=ignore_unsupported,
  File "<attrs generated init 75e45f144e3d5510d54dd5fca6730b98fa0220a9>", line 38, in __init__
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 116, in __attrs_post_init__
    self._setup_pyenv()
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 196, in _setup_pyenv
    version_glob_path="versions/*", ignore_unsupported=self.ignore_unsupported
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 156, in create
    sort_function=sort_function, version_glob_path=version_glob_path)
  File "<attrs generated init bc0428324c02997e1f41dd7925001d6ab66b13b8>", line 21, in __init__
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 147, in get_pythons
    pythons.update(p.pythons)
AttributeError: 'NoneType' object has no attribute 'pythons'
Vendored Dependencies

Most helpful comment

Had a similar issue and the problem for me was that macOS had created a .DS_Store file in the versions folder for pyenv, which Pipfile was choking on. A quick workaround is to simply remove that file, so

rm /Users/YOUR_USER_NAME/.pyenv/versions/.DS_Store

All 20 comments

Looks like a bug in pythonfinders.

Hi, thanks for the awesome tool. Looks like I ran into the same problem. Is there an earlier version pf pipenv that can create new packages on Unix systems?

Creating a Pipfile for this project…
Traceback (most recent call last):
  File "<user>.pyenv/versions/original/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "<user>.pyenv/versions/3.6.7/envs/original/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "<user>.pyenv/versions/3.6.7/envs/original/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "<user>.pyenv/versions/3.6.7/envs/original/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "<user>.pyenv/versions/3.6.7/envs/original/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "<user>.pyenv/versions/3.6.7/envs/original/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "<user>.pyenv/versions/3.6.7/envs/original/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "<user>.pyenv/versions/3.6.7/envs/original/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "<user>.pyenv/versions/3.6.7/envs/original/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "<user>.pyenv/versions/3.6.7/envs/original/lib/python3.6/site-packages/pipenv/cli/command.py", line 254, in install
    editable_packages=state.installstate.editables,
  File "<user>.pyenv/versions/3.6.7/envs/original/lib/python3.6/site-packages/pipenv/core.py", line 1741, in do_install
    pypi_mirror=pypi_mirror,
  File "<user>.pyenv/versions/3.6.7/envs/original/lib/python3.6/site-packages/pipenv/core.py", line 609, in ensure_project
    validate=validate, skip_requirements=skip_requirements, system=system
  File "<user>.pyenv/versions/3.6.7/envs/original/lib/python3.6/site-packages/pipenv/core.py", line 320, in ensure_pipfile
    project.create_pipfile(python=python)
  File "<user>.pyenv/versions/3.6.7/envs/original/lib/python3.6/site-packages/pipenv/project.py", line 726, in create_pipfile
    required_python = self.which("python", self.virtualenv_location)
  File "<user>.pyenv/versions/3.6.7/envs/original/lib/python3.6/site-packages/pipenv/project.py", line 1083, in which
    result = next(iter(filter(None, (find(finder) for finder in self.finders))), None)
  File "<user>.pyenv/versions/3.6.7/envs/original/lib/python3.6/site-packages/pipenv/project.py", line 1083, in <genexpr>
    result = next(iter(filter(None, (find(finder) for finder in self.finders))), None)
  File "<user>.pyenv/versions/3.6.7/envs/original/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 67, in which
    return self.system_path.which(exe)
  File "<user>.pyenv/versions/3.6.7/envs/original/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 54, in system_path
    ignore_unsupported=self.ignore_unsupported,
  File "<user>.pyenv/versions/3.6.7/envs/original/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 451, in create
    ignore_unsupported=ignore_unsupported,
  File "<attrs generated init 75e45f144e3d5510d54dd5fca6730b98fa0220a9>", line 38, in __init__
  File "<user>.pyenv/versions/3.6.7/envs/original/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 116, in __attrs_post_init__
    self._setup_pyenv()
  File "<user>.pyenv/versions/3.6.7/envs/original/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 196, in _setup_pyenv
    version_glob_path="versions/*", ignore_unsupported=self.ignore_unsupported
  File "<user>.pyenv/versions/3.6.7/envs/original/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 156, in create
    sort_function=sort_function, version_glob_path=version_glob_path)
  File "<attrs generated init bd56ac5da1059b9f7a032263a61829782162e769>", line 21, in __init__
  File "<user>.pyenv/versions/3.6.7/envs/original/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 147, in get_pythons
    pythons.update(p.pythons)
AttributeError: 'NoneType' object has no attribute 'pythons'

I am encountering the same issue here I think, using pyenv 1.2.9 (via homebrew) and pipenv 2018.11.26 (via homebrew) on OSX 10.14.3. I have a difference in that I was using already setup venv (using pyenv).

`>$ pipenv --support
Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.

$ pipenv --support

Pipenv version: '2018.11.26'

Pipenv location: '/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv'

Python location: '/usr/local/Cellar/pipenv/2018.11.26/libexec/bin/python3.7'

Python installations found:

Traceback (most recent call last):
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 112, in get_versions
version = PythonVersion.parse(p.name)
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 359, in parse
version_dict = parse_python_version(str(version))
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/utils.py", line 86, in parse_python_version
raise InvalidPythonVersion("%s is not a python version" % version_str)
pipenv.vendor.pythonfinder.exceptions.InvalidPythonVersion: venv372 is not a python version

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/bin/pipenv", line 11, in
load_entry_point('pipenv==2018.11.26', 'console_scripts', 'pipenv')()
File "/usr/local/Cellar/pipenv/2018.11.26/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.11.26/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.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1114, in invoke
return Command.invoke(self, ctx)
File "/usr/local/Cellar/pipenv/2018.11.26/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.11.26/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.11.26/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.11.26/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.11.26/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.11.26/libexec/lib/python3.7/site-packages/pipenv/cli/command.py", line 146, in cli
get_pipenv_diagnostics()
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/help.py", line 33, in get_pipenv_diagnostics
python_paths = finder.find_all_python_versions()
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 122, in find_all_python_versions
python_version_dict = getattr(self.system_path, "python_version_dict")
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 54, in system_path
ignore_unsupported=self.ignore_unsupported,
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 451, in create
ignore_unsupported=ignore_unsupported,
File "", line 38, in __init__
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 116, in __attrs_post_init__
self._setup_pyenv()
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 196, in _setup_pyenv
version_glob_path="versions/*", ignore_unsupported=self.ignore_unsupported
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 156, in create
sort_function=sort_function, version_glob_path=version_glob_path)
File "", line 17, in __init__
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 114, in get_versions
entry = next(iter(version_path.find_all_python_versions()), None)
AttributeError: 'NoneType' object has no attribute 'find_all_python_versions'`

Interestingly I spot that it is looking at a python with (invalid) name "venv372" which is not what I named my venv using pyenv... although version 3.7.2 would be correct.

After a little more playing, I have found that it doesn't work either when using pipenv install to creat the venv, e.g.:

`>$ pipenv install
Creating a virtualenv for this project…
Pipfile: /Users/will/Documents/src/xxxx-xxxxxx/Pipfile
Using /usr/local/Cellar/pipenv/2018.11.26/libexec/bin/python3.7 (3.7.2) to create virtualenv…
â ą Creating virtual environment...Already using interpreter /usr/local/Cellar/pipenv/2018.11.26/libexec/bin/python3.7
Using real prefix '/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7'
New python executable in /Users/will/.local/share/virtualenvs/xxxx-xxxxxx-wtCyu9vb/bin/python3.7
Also creating executable in /Users/will/.local/share/virtualenvs/xxxx-xxxxxx-wtCyu9vb/bin/python
Installing setuptools, pip, wheel...
done.

âś” Successfully created virtual environment!
Virtualenv location: /Users/will/.local/share/virtualenvs/xxxx-xxxxxx-wtCyu9vb
requirements.txt found, instead of Pipfile! Converting…
Traceback (most recent call last):
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 112, in get_versions
version = PythonVersion.parse(p.name)
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 359, in parse
version_dict = parse_python_version(str(version))
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/utils.py", line 86, in parse_python_version
raise InvalidPythonVersion("%s is not a python version" % version_str)
pipenv.vendor.pythonfinder.exceptions.InvalidPythonVersion: xxxx-xxxxxx-3.7.2 is not a python version

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/bin/pipenv", line 11, in
load_entry_point('pipenv==2018.11.26', 'console_scripts', 'pipenv')()
File "/usr/local/Cellar/pipenv/2018.11.26/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.11.26/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.11.26/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.11.26/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.11.26/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.11.26/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.11.26/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.11.26/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.11.26/libexec/lib/python3.7/site-packages/pipenv/cli/command.py", line 254, in install
editable_packages=state.installstate.editables,
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/core.py", line 1741, in do_install
pypi_mirror=pypi_mirror,
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/core.py", line 609, in ensure_project
validate=validate, skip_requirements=skip_requirements, system=system
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/core.py", line 294, in ensure_pipfile
project.create_pipfile(python=python)
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/project.py", line 726, in create_pipfile
required_python = self.which("python", self.virtualenv_location)
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/project.py", line 1083, in which
result = next(iter(filter(None, (find(finder) for finder in self.finders))), None)
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/project.py", line 1083, in
result = next(iter(filter(None, (find(finder) for finder in self.finders))), None)
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 67, in which
return self.system_path.which(exe)
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 54, in system_path
ignore_unsupported=self.ignore_unsupported,
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 451, in create
ignore_unsupported=ignore_unsupported,
File "", line 38, in __init__
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 116, in __attrs_post_init__
self._setup_pyenv()
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 196, in _setup_pyenv
version_glob_path="versions/*", ignore_unsupported=self.ignore_unsupported
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 156, in create
sort_function=sort_function, version_glob_path=version_glob_path)
File "", line 17, in __init__
File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 114, in get_versions
entry = next(iter(version_path.find_all_python_versions()), None)
AttributeError: 'NoneType' object has no attribute 'find_all_python_versions'`

What strikes me as strange about this, and also my previous error posted above, is that xxxx-xxxxxx-3.7.2 is not a python version refers to venv which I created previously (using pyenv), but had deleted fully from ~/.pyenv/versions/... (both symlink and actual venv folder) before running the pipenv install command. Similarly above in my first post, venv372 was the first name I gave to my first venv which I was trying this out with... It seems like somehow this is sticking around even after I delete the venv. In the second instance, even when pipenv creates it's own venv it seems to have found an (old and already deleted) name of a pyenv-created venv...

Sorry if that sounds confusing.

Sorry I have one more update: I changed the pipenv command and managed to get things working again! What I was doing before:
pyenv global 3.7.2
pipenv install
= Fail
pyenv global 3.7.2
pipenv install --python=~/.pyenv/versions/3.7.2/bin/python
= Fail
pyenv global 3.7.2
pipenv install --python=/Users/Will/.pyenv/versions/3.7.2/bin/python
= Success! pythonfinder does not appear to like the tilde path perhaps?

Had a similar issue and the problem for me was that macOS had created a .DS_Store file in the versions folder for pyenv, which Pipfile was choking on. A quick workaround is to simply remove that file, so

rm /Users/YOUR_USER_NAME/.pyenv/versions/.DS_Store

@WillAyd Oh man, I _did_ have a .DS_Store file in ~/.pyenv/versions/, and I was hoping that was the issue, but removing it didn't work for me. After removing it, here's my pipenv --three output:

callen@hostname ~/Desktop/test $ pipenv --version
pipenv, version 2018.11.26
callen@hostname ~/Desktop/test $ pipenv --three
['Traceback (most recent call last):\n', '  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/vistir/misc.py", line 160, in _create_subprocess\n    combine_stderr=combine_stderr)\n', '  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/vistir/misc.py", line 134, in _spawn_subprocess\n    return subprocess.Popen(cmd, **options)\n', '  File "/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 775, in __init__\n    restore_signals, start_new_session)\n', '  File "/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1522, in _execute_child\n    raise child_exception_type(errno_num, err_msg, err_filename)\n', "FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/bin/pythonz': '/usr/local/bin/pythonz'\n", '\nDuring handling of the above exception, another exception occurred:\n\n', 'Traceback (most recent call last):\n', '  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/vistir/contextmanagers.py", line 150, in spinner\n    yield _spinner\n', '  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/vistir/misc.py", line 314, in run\n    write_to_stdout=True\n', '  File "/usr/local/lib/python3.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: write() takes exactly one argument (3 given)\n']
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/vistir/misc.py", line 160, in _create_subprocess
    combine_stderr=combine_stderr)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/vistir/misc.py", line 134, in _spawn_subprocess
    return subprocess.Popen(cmd, **options)
  File "/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1522, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/bin/pythonz': '/usr/local/bin/pythonz'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1114, in invoke
    return Command.invoke(self, ctx)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/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/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/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/lib/python3.7/site-packages/pipenv/cli/command.py", line 208, in cli
    clear=state.clear,
  File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 574, in ensure_project
    pypi_mirror=pypi_mirror,
  File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 494, in ensure_virtualenv
    python = ensure_python(three=three, python=python)
  File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 397, in ensure_python
    path_to_python = find_a_system_python(python)
  File "/usr/local/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/lib/python3.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 "/usr/local/lib/python3.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 "/usr/local/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 279, in get_pythons
    reverse=True
  File "/usr/local/lib/python3.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 "/usr/local/lib/python3.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 "/usr/local/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/utils.py", line 251, in unnest
    for el in target:
  File "/usr/local/lib/python3.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 "/usr/local/lib/python3.7/site-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.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 531, in pythons
    for path, entry in self.children.items():
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/cached_property.py", line 35, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 501, in children
    for child_key, child_val in self._gen_children():
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 493, in _gen_children
    entry = PathEntry.create(path=child, **pass_args)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 575, in create
    _new = cls(**creation_args)
  File "<attrs generated init 006bcb916ef7666bd69c45d2bf2e5793db25a453>", line 16, in __init__
  File "/usr/local/lib/python3.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 "/usr/local/lib/python3.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 "/usr/local/lib/python3.7/site-packages/pipenv/vendor/pythonfinder/utils.py", line 68, in get_python_version
    combine_stderr=False, write_to_stdout=False)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/vistir/misc.py", line 314, in run
    write_to_stdout=True
  File "/usr/local/lib/python3.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: write() takes exactly one argument (3 given)
callen@hostname ~/Desktop/test $ 

This output looks different from the original issue, but there sure seems to be something fishy going on with creating virtualenvs with pipenv. It's been busted for me since last year :(

In my case, I had a zip file in the .pyenv/versions/ directory (long story: my compiler is broken on one machine, so I have to copy new python versions across).

Removing the zip file(s) means it works.

In case anybody winds up here from Google, I had this issue and the reason was a symlink in my .pyenv/versions folder. Upon removal of the symlink all was well.

It appears that plonking anything other than exactly what pyenv expects in the versions dir causes unexpected behavior. :smiley:

I ran into this even though my ~/.pyenv/versions folder looked just fine at first glance. Following the suggestions in this thread I dug a bit more and found that one of my python versions was missing a bin/ folder inside it, probably a botched install; removing that folder/install fixed my pipenv issues.

p.s. the way I figured out something was wrong with that particular version (it wasn't the version I was trying to use btw) was that the 3.6.3 folder was slightly smaller than all the other ones, and upon inspection the corruption became obvious

I ran into the same issue with the pythonfinder acting up, none of this seemed to work.

I found a workaround that helped me:

  1. Remove the pipenv executable from ~/.local/bin/ (or wherever it's located)
  2. Use pyenv to download a fresh python 3.6.5 and setting it as my global python version
  3. Installing pipenv in that and rebuilding the virtual-environment from the Pipfile

I'm still not sure what was the problem but this helped me get the work done

Further explanation of @dammitjim 's solution. For me, the issue was due to a dead symlink in my ~/.pyenv/versions folder. Earlier, I deleted the symlink target but forgot to remove the symlink itself. Removing the symlink fixed it.

The culprit symlink:

my-test-venv -> ~/.pyenv/versions/3.6.0/envs/my-test-venv

I think the problem started for me when I added the virtualenv plugin to pyenv. It created symlinks in the versions folder.

getting this error below when running:

pipenv --python 3.7.4

where python 3.7.4 is the global python set so by pyenv

ATN-M-user:repo_test user$ pipenv install
Creating a Pipfile for this project…
Traceback (most recent call last):
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/lib/python3.8/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 112, in get_versions
    version = PythonVersion.parse(p.name)
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/lib/python3.8/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 359, in parse
    version_dict = parse_python_version(str(version))
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/lib/python3.8/site-packages/pipenv/vendor/pythonfinder/utils.py", line 86, in parse_python_version
    raise InvalidPythonVersion("%s is not a python version" % version_str)
pipenv.vendor.pythonfinder.exceptions.InvalidPythonVersion: .DS_Store is not a python version

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/bin/pipenv", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/lib/python3.8/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.11.26_3/libexec/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/lib/python3.8/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.11.26_3/libexec/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/lib/python3.8/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.11.26_3/libexec/lib/python3.8/site-packages/pipenv/cli/command.py", line 235, in install
    retcode = do_install(
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/lib/python3.8/site-packages/pipenv/core.py", line 1734, in do_install
    ensure_project(
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/lib/python3.8/site-packages/pipenv/core.py", line 608, in ensure_project
    ensure_pipfile(
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/lib/python3.8/site-packages/pipenv/core.py", line 320, in ensure_pipfile
    project.create_pipfile(python=python)
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/lib/python3.8/site-packages/pipenv/project.py", line 726, in create_pipfile
    required_python = self.which("python", self.virtualenv_location)
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/lib/python3.8/site-packages/pipenv/project.py", line 1083, in which
    result = next(iter(filter(None, (find(finder) for finder in self.finders))), None)
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/lib/python3.8/site-packages/pipenv/project.py", line 1083, in <genexpr>
    result = next(iter(filter(None, (find(finder) for finder in self.finders))), None)
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/lib/python3.8/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 67, in which
    return self.system_path.which(exe)
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/lib/python3.8/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 50, in system_path
    self._system_path = SystemPath.create(
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/lib/python3.8/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 445, in create
    return cls(
  File "<attrs generated init 75e45f144e3d5510d54dd5fca6730b98fa0220a9>", line 38, in __init__
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/lib/python3.8/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 116, in __attrs_post_init__
    self._setup_pyenv()
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/lib/python3.8/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 194, in _setup_pyenv
    self.pyenv_finder = PythonFinder.create(
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/lib/python3.8/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 155, in create
    return cls(root=root, ignore_unsupported=ignore_unsupported,
  File "<attrs generated init 2084c70614ac964875c38eeb8eca94989e0b8cbd>", line 17, in __init__
  File "/usr/local/Cellar/pipenv/2018.11.26_3/libexec/lib/python3.8/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 114, in get_versions
    entry = next(iter(version_path.find_all_python_versions()), None)
AttributeError: 'NoneType' object has no attribute 'find_all_python_versions'

from the above it sounds like this should either have already been resolved, or is due to symlinks in the .pyenv/versions/X.X.X/bin/ directory

I re-installed everything, i.e. pyenv, virtualenv, and pipenv today and the issue is still coming up. So it's not due to an older version.

got it to work by setting the python version explicitly by path:

pipenv --python ~/.pyenv/versions/3.7.4/bin/python3.7

The vendored pythonfinder package has a bug in it: https://github.com/sarugaku/pythonfinder/issues/79

I got things working by patching pythonfinder. I've written more in that ticket, including what I did to workaround the bug. It might not work for all situations though.

I had the same issue on linux.
it was found that removing the eval "$(pyenv init -)" directive from my ~.bashrc solved it

to those struggling with this issue -- can you confirm whether it is resolved using the prelease version? You can install the prerelease via pip install --upgrade --pre pipenv

@techalchemy It seems to resolve the issue for me. Thanks for a lot for your work, looks like I can finally move away from those requirements.txt files. (Checked on Ubuntu 16,18 and Debian 9, using pyenv on all of them)

On a related note when is the next release (or just the tentative dates)?

@techalchemy I seem to have an issue with namespace packages

Installing dependencies from Pipfile.lock (ed62ac)…
Traceback (most recent call last):
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 808, in setup_info
    self.setup_info = self.get_setup_info()
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 797, in get_setup_info
    setup_info = SetupInfo.from_ireq(self.ireq)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 778, in ireq
    self.parse_ireq()
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 925, in parse_ireq
    if self.requirement is not None and self._ireq.req is None:
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 485, in requirement
    self.parse_requirement()
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 1064, in parse_requirement
    self.parse_name()
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 1018, in parse_name
    name = self._parse_name_from_path()
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 987, in _parse_name_from_path
    parsed_setup_cfg = self.parsed_setup_cfg
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/cached_property.py", line 35, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 872, in parsed_setup_cfg
    return parse_setup_cfg(setup_content, base_dir)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 321, in parse_setup_cfg
    name, version = get_name_and_version_from_setupcfg(parser, package_dir)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 276, in get_name_and_version_from_setupcfg
    version = parse_special_directives(parser.get("metadata", "version"), package_dir)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 190, in parse_special_directives
    rv = ast_parse_attribute_from_file(path, attribute)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 939, in ast_parse_attribute_from_file
    analyzer = ast_parse_file(path)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 960, in ast_parse_file
    tree = ast.parse(read_source(path))
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/utils.py", line 1024, in read_source
    with open(path, "r", encoding=encoding) as fp:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/me/myproject/find_namespace:/eai/training'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/me/.pyenv/versions/3.7.2/bin/pipenv", line 10, in <module>
    sys.exit(cli())
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 73, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/cli/command.py", line 251, in install
    site_packages=state.site_packages
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/core.py", line 2053, in do_install
    keep_outdated=keep_outdated
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/core.py", line 1308, in do_init
    pypi_mirror=pypi_mirror,
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/core.py", line 839, in do_install_dependencies
    deps_list = list(lockfile.get_requirements(dev=dev, only=requirements))
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/lockfile.py", line 273, in get_requirements
    yield Requirement.from_pipfile(k, v)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 2688, in from_pipfile
    r = FileRequirement.from_pipfile(name, pipfile)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 1784, in from_pipfile
    arg_dict["setup_info"] = arg_dict["parsed_line"].setup_info
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 811, in setup_info
    self.setup_info = self.get_setup_info()
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 821, in setup_info
    self.specifier = setup_info.version
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 423, in specifier
    self.specifiers = SpecifierSet(spec)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 468, in specifiers
    if self.requirement is not None:
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 485, in requirement
    self.parse_requirement()
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 1064, in parse_requirement
    self.parse_name()
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 1018, in parse_name
    name = self._parse_name_from_path()
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 987, in _parse_name_from_path
    parsed_setup_cfg = self.parsed_setup_cfg
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/cached_property.py", line 35, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 872, in parsed_setup_cfg
    return parse_setup_cfg(setup_content, base_dir)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 321, in parse_setup_cfg
    name, version = get_name_and_version_from_setupcfg(parser, package_dir)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 276, in get_name_and_version_from_setupcfg
    version = parse_special_directives(parser.get("metadata", "version"), package_dir)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 190, in parse_special_directives
    rv = ast_parse_attribute_from_file(path, attribute)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 939, in ast_parse_attribute_from_file
    analyzer = ast_parse_file(path)
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 960, in ast_parse_file
    tree = ast.parse(read_source(path))
  File "/Users/me/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/utils.py", line 1024, in read_source
    with open(path, "r", encoding=encoding) as fp:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/me/myproject/find_namespace:/myproject'

I fixed the problem with the following:

brew uninstall pipenv
brew uninstall pyenv
sudo rm -rf .pyenv               # sudo is required somehow

brew install pipenv
pipenv install                      # works!

My errors were:

$ pipenv install
Warning: the environment variable LANG is not set!
We recommend setting this in ~/.profile (or equivalent) for proper expected behavior.
Traceback (most recent call last):
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/bin/pipenv", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/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.11.26_4/libexec/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/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.11.26_4/libexec/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/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.11.26_4/libexec/lib/python3.8/site-packages/pipenv/cli/command.py", line 235, in install
    retcode = do_install(
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/core.py", line 1734, in do_install
    ensure_project(
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/core.py", line 570, in ensure_project
    ensure_virtualenv(
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/core.py", line 494, in ensure_virtualenv
    python = ensure_python(three=three, python=python)
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/core.py", line 397, in ensure_python
    path_to_python = find_a_system_python(python)
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/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.11.26_4/libexec/lib/python3.8/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 113, in find_python_version
    return self.system_path.find_python_version(
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 50, in system_path
    self._system_path = SystemPath.create(
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 445, in create
    return cls(
  File "<attrs generated init 75e45f144e3d5510d54dd5fca6730b98fa0220a9>", line 38, in __init__
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 116, in __attrs_post_init__
    self._setup_pyenv()
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 194, in _setup_pyenv
    self.pyenv_finder = PythonFinder.create(
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 155, in create
    return cls(root=root, ignore_unsupported=ignore_unsupported,
  File "<attrs generated init 0e1c3b545161b8d7ddefe5b30dc455370bfb916f>", line 21, in __init__
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 147, in get_pythons
    pythons.update(p.pythons)
AttributeError: 'NoneType' object has no attribute 'pythons'
Was this page helpful?
0 / 5 - 0 ratings

Related issues

AkiraSama picture AkiraSama  Â·  3Comments

ansrivas picture ansrivas  Â·  3Comments

jeyraof picture jeyraof  Â·  3Comments

hynek picture hynek  Â·  3Comments

leileigong picture leileigong  Â·  3Comments