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.

Workspace contains pipfile but pipenv --venv failed

See original GitHub issue

This is related to #2968, but that’s closed to maintainer comments only. I can reproduce this. I haven’t noticed this bug in a while as my environments are already created and specified in my config files. I encountered this when I was setting up my remote container environment.

Environment data

  • VS Code version:Version 1.35.0-insider (1.35.0-insider)
  • Extension version (available under the Extensions sidebar): 2019.4.12954
  • OS and version: macOS 10.14.4 (18E226)/Ubuntu 19.04 (4.9.125-linuxkit)
  • Python version (& distribution if applicable, e.g. Anaconda): python 3.7.3 installed via pyenv
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): pipenv
  • Relevant/affected Python packages and their versions: N/A

Expected behaviour

pipenv --venv runs without failing allowing the extension to either create a new environment or choose the existing environment as the python interpreter

Actual behaviour

pipenv --venv fails because it cannot be found on the path

Steps to reproduce:

  1. Create a new project with a Pipfile and Pipfile.lock.
  2. Open that project in code and open a python file
  1. As the python extension loads it will run pipenv --venv this fails

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

Starting Microsoft Python language server.
Starting Jedi Python language engine.
Diagnostic Code: InvalidPythonInterpreterDiagnostic, Message: No Python interpreter is selected. You need to select a Python interpreter to enable features such as IntelliSense, linting, and debugging.


Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

Python Extension: Error in invoking PipEnv Error: Traceback (most recent call last):
  File "/root/.pyenv/versions/3.7.3/bin/pipenv", line 10, in <module>
    sys.exit(cli())
  File "/root/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/root/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/root/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1114, in invoke
    return Command.invoke(self, ctx)
  File "/root/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/root/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/root/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/root/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/root/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/root/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pipenv/cli/command.py", line 140, in cli
    do_py()
  File "/root/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pipenv/core.py", line 1635, in do_py
    click.echo(which("python", allow_global=system))
  File "/root/.pyenv/versions/3.7.3/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
	at y.invokePipenv (/root/.vscode-remote/extensions/ms-python.python-2019.4.12954/out/client/extension.js:83:656368)
	at process._tickCallback (internal/process/next_tick.js:68:7)
t.log @ workbench.main.js:238
$logExtensionHostMessage @ workbench.main.js:3180
_doInvokeHandler @ workbench.main.js:3254
_invokeHandler @ workbench.main.js:3254
_receiveRequest @ workbench.main.js:3253
_receiveOneMessage @ workbench.main.js:3251
_protocol.onMessage.e @ workbench.main.js:3250
fire @ workbench.main.js:77
a @ workbench.main.js:321
e @ workbench.main.js:321
fire @ workbench.main.js:77
_receiveMessage @ workbench.main.js:330
S._socketDisposables.push._socketReader.onMessage.e @ workbench.main.js:327
fire @ workbench.main.js:77
acceptChunk @ workbench.main.js:324
_register._socket.onData.e @ workbench.main.js:323
t @ workbench.main.js:332
emit @ events.js:182
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onread @ net.js:636
workbench.main.js:238 [Extension Host] Python Extension: Relevant Environment Variables {
    "LC_ALL": "C.UTF-8",
    "LANG": "C.UTF-8",
    "PATH": "/root/.vscode-remote/bin/6ac87465f297a9068bf767f45d6f372fc5697de9/bin:/root/.pyenv/shims:/root/.pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
}

Location of pipenv

root@9f5aa375bdf8:/workspace# which pipenv
/root/.pyenv/shims/pipenv

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15

github_iconTop GitHub Comments

2reactions
erinxoconcommented, Jun 16, 2019

@DonJayamanne I’ll give this a try sometime this week, celebrating pride this weekend 🌈🍰🌈

1reaction
SebasScriptcommented, Jul 30, 2019

After adding

python.pipenvPath python.pythonPath

manually i get a new error:

Workspace contains Pipfile but the associated virtual environment has not been setup. Setup the virtual environment manually if needed.

even though the environment is setup and works just fine??

Read more comments on GitHub >

github_iconTop Results From Across the Web

Workspace contains Pipfile but pipenv was not found
My pipenv is installed and can be found using terminal on VScode. So I changed the python.
Read more >
Set up a working environment | DataSpell Documentation
Create a pipenv environment · Press Ctrl+Alt+S to open Settings/Preferences and go to Project: workspace | Python Interpreter. · Click the Python Interpreter ......
Read more >
Frequently Encountered Pipenv Problems - Read the Docs
Pipenv is a production-ready tool that aims to bring the best of all packaging worlds to the Python world. It harnesses Pipfile, pip,...
Read more >
30371 (Use pipenv to create venv for development) - Sage Trac
I have now added a minimal pipfile including sage as an editable install. So running pipenv install results in a semi-workable virtual environment....
Read more >
Python/Virtual environment
virtualenv is a tool used to create an isolated workspace for a Python ... The binaries include python for executing scripts and pip...
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