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

Provide a setting for the path to pipenv #2139

Closed
gabriellima opened this issue Jul 12, 2018 · 4 comments
Closed

Provide a setting for the path to pipenv #2139

gabriellima opened this issue Jul 12, 2018 · 4 comments
Labels
feature-request Request for new features or functionality

Comments

@gabriellima
Copy link

Environment data

  • VS Code version: 1.26.0-insider (Commit 7e992cab07f6...)
  • Extension version (available under the Extensions sidebar): Python 2018.6.0
  • OS and version: Windows 7 64bits
  • Python version (& distribution if applicable, e.g. Anaconda): Miniconda3 and conda 4.5.5 and Python 3.6.5
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): pipenv

Actual behavior

Open workspace folder, and receives Python extension notification:
Workspace contains pipfile but attempt to run 'pipenv --venv' failed with 'spawn pipenv ENOENT'. Make sure pipenv is on the PATH.

On developer tools, process.env.Path does not include anything related to python (neither from anaconda nor from my virtual environment)

Expected behavior

Open workspace folder, have VS Code activate my virtual environment as default for all python related interactions (intellisense, terminal, go_to_function, ...), as it has found my Pipefile

Steps to reproduce:

  1. Open my workspace folder containing a Pipfile created with pipenv
  2. VS Code alerts that pipenv --venv failed
  3. Check Developer tools, and found that PATH doesn't have anything related to python
    "Path": "C:\\WINDOWS\\system32;.........;C:\\...\\VSCodeInsiders\\bin"

Logs

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

Starting the classic analysis engine.

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

[Extension Host] Error: spawn jupyter ENOENT
	at exports._errnoException (util.js:1050:11)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
	at onErrorNT (internal/child_process.js:367:16)
	at _combinedTickCallback (internal/process/next_tick.js:80:11)
	at process._tickCallback (internal/process/next_tick.js:104:9) (at procUtils_1.execPythonFileSync.then.catch.error (C:\...\.vscode-insiders\extensions\donjayamanne.jupyter-1.1.4\out\src\kernel-manager.js:216:21))


/C:/...../VSCodeInsiders/resources/app/out/vs/workbench/workbench.main.js:272 [Extension Host] Python Extension: Relevant Environment Variables {
    "Path": "C:\\WINDOWS\\system32;.........;C:\\...\\VSCodeInsiders\\bin"
} 

[Extension Host] Failed to get interpreter information for 'python' Error: spawn python ENOENT
	at exports._errnoException (util.js:1050:11)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
	at onErrorNT (internal/child_process.js:367:16)
	at _combinedTickCallback (internal/process/next_tick.js:80:11)
	at process._tickCallback (internal/process/next_tick.js:104:9) (at PythonExecutionService.<anonymous> (C:\...\.vscode-insiders\extensions\ms-python.python-2018.6.0\out\client\common\process\pythonProcess.js:53:25))

/C:/.../VSCodeInsiders/resources/app/out/vs/workbench/workbench.main.js:272 [Extension Host] Python Extension: Failed to get conda environment list from conda Error: spawn conda ENOENT
	at exports._errnoException (util.js:1050:11)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
	at onErrorNT (internal/child_process.js:367:16)
	at _combinedTickCallback (internal/process/next_tick.js:80:11)
	at process._tickCallback (internal/process/next_tick.js:104:9) (at Logger.logInformation (C:\...\.vscode-insiders\extensions\ms-python.python-2018.6.0\out\client\common\logger.js:31:21))

Regarding python settings, only my usersettings json have relevant configuration:

"python.venvFolders": [
        "envs",
        ".pyenv",
        ".direnv",
        ".virtualenvs",
        "C:\...\\AppData\\Local\\Continuum\\anaconda3\\envs",
    ],

    "terminal.integrated.shellArgs.windows": [
        "/k", "%localappdata%\\Continuum\\anaconda3\\Scripts\\activate.bat", 
         "C:\\...\\AppData\\Local\\Continuum\\anaconda3",
     ],
    "python.venvPath": "C:\\...\\AppData\\Local\\Continuum\\anaconda3\\Scripts",

I tried to select a Python interpreter, i.e., setting the python.pythonPath variable to either Anaconda or the virtualenv python.exe, but neither of those solved the issue of not being able to run Pipenv.

The terminal.integrated.shellArgs.windows solved at least the issue that I was not being able to open terminal with anaconda configuration.
Before that setting, if I opened the terminal, I would have the error: activate is not a terminal command.... (something similar to that)

So, I forced VS Code to run the activation of anaconda, so as to populate the PATH for terminal.

My windows default PATH, indeed, does not include anything related to anaconda. On my windows Terminal, I have to first run the Activate.bat command, so as to include relevant folders on PATH before being able to run "pipenv".

@d3r3kk d3r3kk added bug Issue identified by VS Code Team member as probable bug needs verification labels Jul 12, 2018
@d3r3kk
Copy link

d3r3kk commented Jul 12, 2018

Thank you for taking the time to send us this report! We will attempt to reproduce the issue and prioritize accordingly.

That said, I have experienced this as well with Pipenv virtual environment while busy doing other things. I should be able to reproduce fairly simply.

@brettcannon brettcannon added feature-request Request for new features or functionality needs decision and removed needs verification bug Issue identified by VS Code Team member as probable bug labels Jul 12, 2018
@brettcannon
Copy link
Member

This is currently by design as pipenv is a CLI app and so we don't look for it installed in a virtual environment (its ability to be executed with -m for instance is only a couple of months old after I requested the feature). But we could think about checking your active environment for the command as well (or provide a way to specify the path to pipenv).

@brettcannon brettcannon changed the title Pipenv ENOENT with Anaconda Pipenv not search for in the current environment Jul 12, 2018
@gabriellima
Copy link
Author

gabriellima commented Jul 12, 2018

May I suggest you to use the python.venvPath setting?
Or the windows terminal VS Code presents when doing: Open Terminal?

Because that command prompt indeed have a pipenv executable, as its PATH is changed.

Or, maybe, use the "Python Command Prompt", as it does have PATH changed too.

In fact, the only PATH that remained inaltered was the one used by VS Code Python extension, trying to find pipenv.
It even "ignored" my python.venvPath setting, where pipenv.exe resides.

@brettcannon brettcannon changed the title Pipenv not search for in the current environment Pipenv is not searched for in a virtual environment Jul 16, 2018
@brettcannon brettcannon changed the title Pipenv is not searched for in a virtual environment Provide a setting for the path to pipenv Aug 27, 2018
@DonJayamanne
Copy link

Duplicate of #978

@ghost ghost removed the needs PR label Jan 2, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 31, 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