Pipenv: TypeError: 'NoneType' object is not iterable

Created on 20 Nov 2018  Â·  8Comments  Â·  Source: pypa/pipenv

Issue description

For pipenv version 2018.11.14, the creation of Pipfile is constantly returning TypeError: 'NoneType' object is not iterable. I got this error when I issued commands pipenv install -e . or pipenv --python 3.6.7 or pipenv install numpy. For the latter, the creation of the Virtualenv location was completed. What should I do next?

Expected result

Successful creation of Pipefile and Pipfile.lock and the installation of required package in virtual environment.

Actual result

$ pipenv --version
pipenv, version 2018.11.14
$cd ~/git/mypkg
$ pipenv install -e .
Creating a virtualenv for this project…
Pipfile: ~/git/mypkg/Pipfile
Using /usr/bin/python3 (3.5.2) to create virtualenv…
â ¼ Running...Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in ~/.local/share/virtualenvs/mypkg-ZSstWkW5/bin/python3
Also creating executable in ~/.local/share/virtualenvs/mypkg-ZSstWkW5/bin/python
Installing setuptools, pip, wheel...done.
Virtualenv location: ~/.local/share/virtualenvs/mypkg-ZSstWkW5
Creating a Pipfile for this project…
✔ Complete 
Traceback (most recent call last):
  File "~/.local/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "~/.local/lib/python3.5/site-packages/pipenv/cli/command.py", line 249, in install
    editable_packages=state.installstate.editables,
  File "~/.local/lib/python3.5/site-packages/pipenv/core.py", line 1725, in do_install
    pypi_mirror=pypi_mirror,
  File "~/.local/lib/python3.5/site-packages/pipenv/core.py", line 604, in ensure_project
    validate=validate, skip_requirements=skip_requirements, system=system
  File "~/.local/lib/python3.5/site-packages/pipenv/core.py", line 320, in ensure_pipfile
    project.create_pipfile(python=python)
  File "~/.local/lib/python3.5/site-packages/pipenv/project.py", line 722, in create_pipfile
    required_python = self.which("python", self.virtualenv_location)
  File "~/.local/lib/python3.5/site-packages/pipenv/project.py", line 1074, in which
    result = next(iter(filter(None, (find(finder) for finder in self.finders))), None)
  File "~/.local/lib/python3.5/site-packages/pipenv/project.py", line 1074, in <genexpr>
    result = next(iter(filter(None, (find(finder) for finder in self.finders))), None)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 67, in which
    return self.system_path.which(exe)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 54, in system_path
    ignore_unsupported=self.ignore_unsupported,
  File "~/.local/lib/python3.5/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 "~/.local/lib/python3.5/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 116, in __attrs_post_init__
    self._setup_pyenv()
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 196, in _setup_pyenv
    version_glob_path="versions/*", ignore_unsupported=self.ignore_unsupported
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 154, in create
    sort_function=sort_function, version_glob_path=version_glob_path)
  File "<attrs generated init 513173584682552efeecee9238f4c2ee8c5c744e>", line 17, in __init__
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 98, in get_versions
    for p in self.get_version_order():
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 70, in get_version_order
    version_order = [versions[v] for v in parse_pyenv_version_order()]
TypeError: 'NoneType' object is not iterable
$ pipenv --python 3.6.7
Traceback (most recent call last):
  File "~/.local/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 1114, in invoke
    return Command.invoke(self, ctx)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "~/.local/lib/python3.5/site-packages/pipenv/cli/command.py", line 203, in cli
    clear=state.clear,
  File "~/.local/lib/python3.5/site-packages/pipenv/core.py", line 569, in ensure_project
    pypi_mirror=pypi_mirror,
  File "~/.local/lib/python3.5/site-packages/pipenv/core.py", line 489, in ensure_virtualenv
    python = ensure_python(three=three, python=python)
  File "~/.local/lib/python3.5/site-packages/pipenv/core.py", line 397, in ensure_python
    path_to_python = find_a_system_python(python)
  File "~/.local/lib/python3.5/site-packages/pipenv/core.py", line 360, in find_a_system_python
    python_entry = finder.find_python_version(line)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 113, in find_python_version
    return self.system_path.find_python_version(
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 54, in system_path
    ignore_unsupported=self.ignore_unsupported,
  File "~/.local/lib/python3.5/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 "~/.local/lib/python3.5/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 116, in __attrs_post_init__
    self._setup_pyenv()
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 196, in _setup_pyenv
    version_glob_path="versions/*", ignore_unsupported=self.ignore_unsupported
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 154, in create
    sort_function=sort_function, version_glob_path=version_glob_path)
  File "<attrs generated init ceadc4956dc4f996262dab732dae93ed2d67f457>", line 17, in __init__
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 98, in get_versions
    for p in self.get_version_order():
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 70, in get_version_order
    version_order = [versions[v] for v in parse_pyenv_version_order()]
TypeError: 'NoneType' object is not iterable
$ pipenv install numpy
Creating a virtualenv for this project…
Pipfile: ~/git/mypkg/Pipfile
Using /usr/bin/python3 (3.5.2) to create virtualenv…
â ¼ Running...Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in ~/.local/share/virtualenvs/mypkg-2z7If1d0/bin/python3
Also creating executable in ~/.local/share/virtualenvs/mypkg-2z7If1d0/bin/python
Installing setuptools, pip, wheel...done.
Virtualenv location: ~/.local/share/virtualenvs/mypkg-2z7If1d0
Creating a Pipfile for this project…
✔ Complete 
Traceback (most recent call last):
  File "~/.local/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "~/.local/lib/python3.5/site-packages/pipenv/cli/command.py", line 249, in install
    editable_packages=state.installstate.editables,
  File "~/.local/lib/python3.5/site-packages/pipenv/core.py", line 1725, in do_install
    pypi_mirror=pypi_mirror,
  File "~/.local/lib/python3.5/site-packages/pipenv/core.py", line 604, in ensure_project
    validate=validate, skip_requirements=skip_requirements, system=system
  File "~/.local/lib/python3.5/site-packages/pipenv/core.py", line 320, in ensure_pipfile
    project.create_pipfile(python=python)
  File "~/.local/lib/python3.5/site-packages/pipenv/project.py", line 722, in create_pipfile
    required_python = self.which("python", self.virtualenv_location)
  File "~/.local/lib/python3.5/site-packages/pipenv/project.py", line 1074, in which
    result = next(iter(filter(None, (find(finder) for finder in self.finders))), None)
  File "~/.local/lib/python3.5/site-packages/pipenv/project.py", line 1074, in <genexpr>
    result = next(iter(filter(None, (find(finder) for finder in self.finders))), None)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 67, in which
    return self.system_path.which(exe)
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 54, in system_path
    ignore_unsupported=self.ignore_unsupported,
  File "~/.local/lib/python3.5/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 "~/.local/lib/python3.5/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 116, in __attrs_post_init__
    self._setup_pyenv()
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 196, in _setup_pyenv
    version_glob_path="versions/*", ignore_unsupported=self.ignore_unsupported
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 154, in create
    sort_function=sort_function, version_glob_path=version_glob_path)
  File "<attrs generated init d3ce2b26408ec3fc57fcdac66b71ec7abfab6c0f>", line 17, in __init__
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 98, in get_versions
    for p in self.get_version_order():
  File "~/.local/lib/python3.5/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 70, in get_version_order
    version_order = [versions[v] for v in parse_pyenv_version_order()]
TypeError: 'NoneType' object is not iterable
Duplicate

Most helpful comment

Release is up on pypi. No idea about homebrew :(

All 8 comments

Hey @sunbearc22,

We did a quick check and this issue looks very darn similar to

This could be a coincidence, but if any of these issues solves your problem then I did a good job :smile:

If not, the maintainers will get to this issue shortly.

Cheers,
Your Friendly Neighborhood ProBot

Wow that bot is completely useless... Relevant issue: #3224 -- fixed in #3225 and #3254 (this is fixed on master and will be released today)

See #3224 for workarounds in the meantime, sorry for the trouble!

@techalchemy I believe the fixed master has not been released yet. I have just tried uninstalling and reinstalling pipenv, and pipenv is still giving the same error msg. May I know when the fix will surely be release? Cheers.

Edit:
My apologies. I realized that the fix that you had referred to was not for pipenv in PyPI but for github. I have successfully installed the fixed pipenv using the command below. Thanks.

pip3 install --prefix ~/.local -e git+https://github.com/pypa/pipenv.git#egg=pipenv

No worries, the actual fix will be released shortly (in the process of a few more fixes before we can release) -- sorry again for the trouble, I know a lot of folks are relying on pipenv for day to day processes

Hello @techalchemy! Thanks for your work on this tool! I am running pipenv in Travis CI and I am still getting the error TypeError: 'NoneType' object is not iterable when I attempt to use pipenv to, for instance, install dependencies and the run a test suite with pytest. Has this issue now been fixed? Currently, my Travis configuration file uses pipenv install --dev --three and this always crashes with the error in this issue. Is there something else that I now need to do in order to correctly run pipenv? As your schedule permits, any feedback that you can provide is greatly appreciated!

Do you happen to know if a fix will be available through homebrew in the near future, or can I try and rollback to 2018.10.13 with homebrew?

I'm new to Python and my entire workflow goes through pipenv.

Release is up on pypi. No idea about homebrew :(

Today's release did it for me. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leileigong picture leileigong  Â·  3Comments

johnjiang picture johnjiang  Â·  3Comments

bgjelstrup picture bgjelstrup  Â·  3Comments

konstin picture konstin  Â·  3Comments

ipmb picture ipmb  Â·  3Comments