Pipenv: Bug with fresh install/upgrade

Created on 24 Oct 2018  ·  8Comments  ·  Source: pypa/pipenv

Hello ! Just upgraded pipenv from the AUR and then from pip, and I always get the same issue :
(PS : the previous version worked)

$ pipenv install numpy
Traceback (most recent call last):
  File "/home/pierrelg/.local/lib/python3.7/site-packages/pipenv/project.py", line 509, in _parse_pipfile
    return contoml.loads(contents)
  File "/home/pierrelg/.local/lib/python3.7/site-packages/pipenv/patched/contoml/__init__.py", line 15, in loads
    elements = parse_tokens(tokens)
  File "/home/pierrelg/.local/lib/python3.7/site-packages/pipenv/patched/prettytoml/parser/__init__.py", line 17, in parse_tokens
    return _parse_token_stream(TokenStream(tokens))
  File "/home/pierrelg/.local/lib/python3.7/site-packages/pipenv/patched/prettytoml/parser/__init__.py", line 32, in _parse_token_stream
    raise ParsingError('Failed to parse line {}'.format(pending.head.row))
prettytoml.parser.errors.ParsingError: Failed to parse line 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pierrelg/.local/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/home/pierrelg/.local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/pierrelg/.local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/pierrelg/.local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/pierrelg/.local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/pierrelg/.local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/pierrelg/.local/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/pierrelg/.local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/pierrelg/.local/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/pierrelg/.local/lib/python3.7/site-packages/pipenv/cli/command.py", line 249, in install
    editable_packages=state.installstate.editables,
  File "/home/pierrelg/.local/lib/python3.7/site-packages/pipenv/core.py", line 1724, in do_install
    pypi_mirror=pypi_mirror,
  File "/home/pierrelg/.local/lib/python3.7/site-packages/pipenv/core.py", line 565, in ensure_project
    pypi_mirror=pypi_mirror,
  File "/home/pierrelg/.local/lib/python3.7/site-packages/pipenv/core.py", line 488, in ensure_virtualenv
    python = ensure_python(three=three, python=python)
  File "/home/pierrelg/.local/lib/python3.7/site-packages/pipenv/core.py", line 398, in ensure_python
    python = project.required_python_version
  File "/home/pierrelg/.local/lib/python3.7/site-packages/pipenv/project.py", line 230, in required_python_version
    required = self.parsed_pipfile.get("requires", {}).get(
  File "/home/pierrelg/.local/lib/python3.7/site-packages/pipenv/project.py", line 470, in parsed_pipfile
    parsed = self._parse_pipfile(contents)
  File "/home/pierrelg/.local/lib/python3.7/site-packages/pipenv/project.py", line 512, in _parse_pipfile
    return toml.loads(contents)
  File "/home/pierrelg/.local/lib/python3.7/site-packages/pipenv/vendor/toml/decoder.py", line 187, in loads
    " Reached end of line.", original, i)
toml.decoder.TomlDecodeError: Key name found without value. Reached end of line. (line 1 column 6 char 5)

Most helpful comment

RESOLVED (after reinstalling from the AUR):
I removed everything from the virtualenvs folder [pierrelg@pierre-HP ~]$ cd /home/pierrelg/.local/share/virtualenvs/ and then rm -r ./the_folder
And now it works !

All 8 comments

What is your Pipfile

Hello @uranusjr , thanks for the answer.
My current Pipfile is this (he is here just for testing) :

[requires]
python_version = '3.7.0'

Hmm, I cannot seem to produce this. The error message indicates the TOML file (Pipfile) is invalid, but everything seems to be fine. Can you try deleting the Pipfile and run the command again, to make sure there are no invisible characters in the file?

I tried to delete it completely and then to start without Pipfile = same issue.
I reinstalled pipenv after a complete purge and it still happens.
Any other insights please ?

Unfortunately no, it is really strange, I am stumped :(

Still trying to figure it out.
When I create a pipenv in a random folder it works:

[pierrelg@pierre-HP test]$ pipenv install numpy
Creating a virtualenv for this project…
Pipfile: /home/pierrelg/Pipfile
Using /home/pierrelg/miniconda3/bin/python3.7 (3.7.0) to create virtualenv…
⠦Running virtualenv with interpreter /home/pierrelg/miniconda3/bin/python3.7
Using base prefix '/home/pierrelg/miniconda3'
/home/pierrelg/.local/lib/python3.7/site-packages/virtualenv.py:1041: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp
New python executable in /home/pierrelg/.local/share/virtualenvs/pierrelg-0pCqQ6b1/bin/python3.7
Also creating executable in /home/pierrelg/.local/share/virtualenvs/pierrelg-0pCqQ6b1/bin/python
Installing setuptools, pip, wheel...done.

Virtualenv location: /home/pierrelg/.local/share/virtualenvs/pierrelg-0pCqQ6b1
Installing numpy…
Collecting numpy
  Using cached https://files.pythonhosted.org/packages/f2/1f/a05544224706463a1c28589db5900247c7e85a077a0d254e7db012fbb008/numpy-1.15.3-cp37-cp37m-manylinux1_x86_64.whl
Installing collected packages: numpy
Successfully installed numpy-1.15.3

Adding numpy to Pipfile's [packages]…
Pipfile.lock (2cfc5e) out of date, updating to (a65489)…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (2cfc5e)!
Installing dependencies from Pipfile.lock (2cfc5e)…
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 1/1 — 00:00:01
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.

But when I try again in my project without Pipfile, I get this:

[pierrelg@pierre-HP equipe-p---projetalgo2018]$ pipenv install
Creating a virtualenv for this project…
Pipfile: /home/pierrelg/Documents/git/equipe-p---projetalgo2018/Pipfile
Using /usr/bin/python (3.7.0) to create virtualenv…
⠹Already using interpreter /usr/bin/python
Using base prefix '/usr'
/home/pierrelg/.local/lib/python3.7/site-packages/virtualenv.py:1041: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp
Overwriting /home/pierrelg/.local/share/virtualenvs/equipe-p---projetalgo2018-gntIZZ-d/lib/python3.7/orig-prefix.txt with new content
New python executable in /home/pierrelg/.local/share/virtualenvs/equipe-p---projetalgo2018-gntIZZ-d/bin/python
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/pierrelg/.local/lib/python3.7/site-packages/virtualenv.py", line 2343, in <module>
    main()
  File "/home/pierrelg/.local/lib/python3.7/site-packages/virtualenv.py", line 712, in main
    symlink=options.symlink)
  File "/home/pierrelg/.local/lib/python3.7/site-packages/virtualenv.py", line 927, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "/home/pierrelg/.local/lib/python3.7/site-packages/virtualenv.py", line 1233, in install_python
    shutil.copyfile(executable, py_executable)
  File "/usr/lib/python3.7/shutil.py", line 121, in copyfile
    with open(dst, 'wb') as fdst:
OSError: [Errno 40] Too many levels of symbolic links: '/home/pierrelg/.local/share/virtualenvs/equipe-p---projetalgo2018-gntIZZ-d/bin/python'

Traceback (most recent call last):
  File "/usr/bin/pipenv", line 11, in <module>
    load_entry_point('pipenv==2018.10.14.dev0', 'console_scripts', 'pipenv')()
  File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/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/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/lib/python3.7/site-packages/pipenv/cli/command.py", line 249, in install
    editable_packages=state.installstate.editables,
  File "/usr/lib/python3.7/site-packages/pipenv/core.py", line 1724, in do_install
    pypi_mirror=pypi_mirror,
  File "/usr/lib/python3.7/site-packages/pipenv/core.py", line 565, in ensure_project
    pypi_mirror=pypi_mirror,
  File "/usr/lib/python3.7/site-packages/pipenv/core.py", line 500, in ensure_virtualenv
    python=python, site_packages=site_packages, pypi_mirror=pypi_mirror
  File "/usr/lib/python3.7/site-packages/pipenv/core.py", line 901, in do_create_virtualenv
    click.echo(crayons.blue("{0}".format(c.err)), err=True)
  File "/usr/lib/python3.7/site-packages/pipenv/vendor/delegator.py", line 146, in err
    return self._pexpect_out
  File "/usr/lib/python3.7/site-packages/pipenv/vendor/delegator.py", line 114, in _pexpect_out
    result += self.subprocess.after
TypeError: can only concatenate str (not "type") to str

RESOLVED (after reinstalling from the AUR):
I removed everything from the virtualenvs folder [pierrelg@pierre-HP ~]$ cd /home/pierrelg/.local/share/virtualenvs/ and then rm -r ./the_folder
And now it works !

Got same error and seams to be that the single quote is not accepted.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marc-fez picture marc-fez  ·  3Comments

ipmb picture ipmb  ·  3Comments

fbender picture fbender  ·  3Comments

konstin picture konstin  ·  3Comments

xi picture xi  ·  3Comments