Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poor error message when pipenv couldn't be activated. #4866

Closed
ericsnowcurrently opened this issue Mar 20, 2019 · 4 comments
Closed

Poor error message when pipenv couldn't be activated. #4866

ericsnowcurrently opened this issue Mar 20, 2019 · 4 comments
Assignees
Labels
feature-request Request for new features or functionality

Comments

@ericsnowcurrently
Copy link
Member

ericsnowcurrently commented Mar 20, 2019

Screenshot from 2019-03-20 16-44-02

I have pipenv set up in my workspace folder. The extension picks it up. However, if it tries to activate the environment then I get an error pop-up. If I expand the pop-up, I see the following (formatted exactly) unhelpful message:

Workspace contains pipfile but attempt to run 'pipenv --
venv' failed with 'Traceback (most recent call last):  File 
"/home/esnow/.local/bin/pipenv", line 11, in <module> 
sys.exit(cli()) File "/home/esnow/.local/lib/python3.7/site-
packages/pipenv/vendor/click/core.py", line 764, in 
__call__ return self.main(*args, **kwargs) File 
"/home/esnow/.local/lib/python3.7/site-
packages/pipenv/vendor/click/core.py", line 717, in main
 rv = self.invoke(ctx) File 
"/home/esnow/.local/lib/python3.7/site-
packages/pipenv/vendor/click/core.py", line 1114, in 
invoke return Command.invoke(self, ctx) File 
"/home/esnow/.local/lib/python3.7/site-
packages/pipenv/vendor/click/core.py", line 956, in invoke 
return ctx.invoke(self.callback, **ctx.params) File 
"/home/esnow/.local/lib/python3.7/site-
packages/pipenv/vendor/click/core.py", line 555, in invoke 
return callback(*args, **kwargs) File 
"/home/esnow/.local/lib/python3.7/site-
packages/pipenv/vendor/click/decorators.py", lin...

The extension should fix up the error message (rather than dumping the full un-edited text).

@ericsnowcurrently ericsnowcurrently added feature-request Request for new features or functionality needs decision labels Mar 20, 2019
@ericsnowcurrently
Copy link
Member Author

Interestingly, if I copy and paste the text in the error pop-up, I get the full traceback, properly formatted:

Workspace contains pipfile but attempt to run 'pipenv --venv' failed with 'Traceback (most recent call last):
  File "/home/esnow/.local/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/home/esnow/.local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/esnow/.local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/esnow/.local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1114, in invoke
    return Command.invoke(self, ctx)
  File "/home/esnow/.local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/esnow/.local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/esnow/.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/esnow/.local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/esnow/.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/esnow/.local/lib/python3.7/site-packages/pipenv/cli/command.py", line 140, in cli
    do_py()
  File "/home/esnow/.local/lib/python3.7/site-packages/pipenv/core.py", line 1635, in do_py
    click.echo(which("python", allow_global=system))
  File "/home/esnow/.local/lib/python3.7/site-packages/pipenv/core.py", line 108, in which
    raise RuntimeError("location not created nor specified")
RuntimeError: location not created nor specified'. Make sure pipenv is on the PATH.

@microsoft microsoft deleted a comment from ericsnowcurrently Mar 20, 2019
@dlech
Copy link

dlech commented Apr 14, 2019

I created a git repo to reproduce the problem. https://github.com/dlech/vscode-python-issue4866

Using Ubuntu 18.04:

sudo apt update
sudo apt install python3-pip
pip3 install pipenv  # --user is implied so pipenv executable gets installed in /home/$USER/.local/bin/
git clone https://github.com/dlech/vscode-python-issue4866.git
code vscode-python-issue4866

Open x.py to activate the python extension. Get the error message as described in previous comments.

If I manually run pipenv --venv from a terminal, I get:

No virtualenv has been created for this project yet!
Aborted!

So I am not sure why the extension is getting a crash trace instead.

@dlech
Copy link

dlech commented Apr 15, 2019

It turns out that the failing command is pipenv --py, so I made a pull request here to fix the error message to include the correct command line argument. I also opened an issue in pipenv about not printing out the stack trace.

@Cologler
Copy link

Cologler commented May 20, 2019

#5684 same issus

@ghost ghost removed the needs decision label May 21, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

4 participants