question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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'

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:20 (2 by maintainers)

github_iconTop GitHub Comments

55reactions
WillAydcommented, Feb 2, 2019

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
21reactions
willcl-arkcommented, Jan 22, 2019

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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issue while trying to run $pipenv --python 3.7
It seems this is a currently open issue with pipenv. It might worth trying what they suggest there: pip install --upgrade --pre pipenv....
Read more >
How To Fix Attribute Error: 'NoneType' Object Has ... - YouTube
Article Link: https://blog.finxter.com/how-to-fix-error- nonetype - object - has - no - attribute -group/ Email Academy: ...
Read more >
Pipenv on Windows fails AttributeError: 'NoneType' object ...
Pipenv on Windows fails AttributeError: 'NoneType' object has no attribute 'version_sort'. There is an issue with Python Pipenv on Windows.
Read more >
'NoneType' object has no attribute '_inc_path'
Basically I am getting this error. AttributeError at /admin/pages/new/wagtail_articles/articleindex/3/ 'NoneType' object has no attribute '_inc_path'
Read more >
'NoneType' object has no attribute 'GetLayer' geoPDF
AttributeError: 'NoneType' object has no attribute 'GetLayer'. As I understand the above error it means that the proj variable is empty.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found