Pipenv: lock command fail with "TypeError: 'NoneType' object has no attribute '__getitem__'"

Created on 28 Jan 2017  Â·  5Comments  Â·  Source: pypa/pipenv

Hi,

I'm just installed pipenv today and I'm also new to python so, this may be a dumb error from my side.

Every time I'm trying to create a Pipfile.lock with pipenv lock it crashes. This is the full output:

âžś  pipenvTest pipenv --version
pipenv, version 3.2.5
âžś  pipenvTest pipenv --three
Creating a Pipfile for this project...
Creating a virtualenv for this project...
Running virtualenv with interpreter /usr/local/bin/python3
Using base prefix '/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/brunoberisso/Documents/Tryolabs/pipenvTest/.venv/bin/python3.6
Also creating executable in /Users/brunoberisso/Documents/Tryolabs/pipenvTest/.venv/bin/python
Installing setuptools, pip, wheel...done.

Virtualenv location: /Users/brunoberisso/Documents/Tryolabs/pipenvTest/.venv
âžś  pipenvTest pipenv install django
Installing Django...
Collecting Django
  Using cached Django-1.10.5-py2.py3-none-any.whl
Installing collected packages: Django
Successfully installed Django-1.10.5

Adding Django to Pipfile's [packages]...
âžś  pipenvTest pipenv install scrapy
Installing Scrapy...
Collecting Scrapy
  Using cached Scrapy-1.3.0-py2.py3-none-any.whl
[quite log list of packages here]
Adding Scrapy to Pipfile's [packages]...
âžś  pipenvTest pipenv lock
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/pipenv/cli.py", line 715, in lock
    do_lock()
  File "/usr/local/lib/python2.7/site-packages/pipenv/cli.py", line 341, in do_lock
    results = get_downloads_info()
  File "/usr/local/lib/python2.7/site-packages/pipenv/cli.py", line 298, in get_downloads_info
    name, version = parse_download_fname(fname)
  File "/usr/local/lib/python2.7/site-packages/pipenv/cli.py", line 279, in parse_download_fname
    name = r['name']
TypeError: 'NoneType' object has no attribute '__getitem__'
âžś  pipenvTest

This was also happening with the 3.2.4 version.
Thanks in advance

Most helpful comment

@techalchemy Thanks for the quick answer. It was actually a encoding problem in the background.
Had to add

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

To my shell and then it worked

All 5 comments

Thanks for opening this @BrunoBerisso, this is something that we're aware of. This is tangential to #90, in that we're expecting a certain file format syntax. Twisted which is a dependency of Scrapy is providing their packages using bzip2 for compression rather than gzip like most of the other packages on PyPI.

This should be resolved when #90 is closed. I'm going to close this in favor of that ticket.

Hey I just installed pipenv and I get this problem:

❯ pipenv install --three --verbose
Warning: PYENV_ROOT is not set. New python paths will probably not be exported properly after installation.
Creating a virtualenv for this project…
Using /Users/user/.pyenv/shims/python3 to create virtualenv…
Virtualenv location:
Creating a Pipfile for this project…
Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/pipenv/cli.py", line 1735, in install
    ensure_project(three=three, python=python, system=system, warn=True, deploy=deploy)
  File "/usr/local/lib/python2.7/site-packages/pipenv/cli.py", line 618, in ensure_project
    ensure_pipfile(validate=validate)
  File "/usr/local/lib/python2.7/site-packages/pipenv/cli.py", line 333, in ensure_pipfile
    project.create_pipfile(python=python)
  File "/usr/local/lib/python2.7/site-packages/pipenv/project.py", line 388, in create_pipfile
    data[u'requires'] = {'python_version': python_version(python)[:len('2.7')]}
TypeError: 'NoneType' object has no attribute '__getitem__'

❯ pipenv --version ⏎
pipenv, version 8.2.7

MAC OSX

@eleijonmarck it looks like you have pyenv installed but as the warning says you don’t have PYENV_ROOT set. You need to set that environment variable. Based on the fact you have pyenv installed but pip and pipenv are still coming from /usr/local/bin I’m guessing you don’t have the pyenv shims directory on your path either. You will need to add that to your path to use pyenv.

@techalchemy Thanks for the quick answer. It was actually a encoding problem in the background.
Had to add

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

To my shell and then it worked

@eleijonmarck awesome and thanks for the update! I’m guessing you had the environment var for pyenv set then? If we don’t have a warning about this still I’ll see if we can get one since this will probably continue causing problems

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AkiraSama picture AkiraSama  Â·  3Comments

fbender picture fbender  Â·  3Comments

FooBarQuaxx picture FooBarQuaxx  Â·  3Comments

jeyraof picture jeyraof  Â·  3Comments

marc-fez picture marc-fez  Â·  3Comments