vscode-python: Log the user's environment when the attempt to execute pipenv returns ENOENT
Environment data
- VS Code version: 1.21.1
- Extension version (available under the Extensions sidebar): 2018.3.1
- OS and version: Solus 3.999 (Linux)
- Python version (& distribution if applicable, e.g. Anaconda): 3.6.4
- Type of virtual environment used (N/A | venv | virtualenv | conda | …):
pipenv
Actual behavior
Getting a warning saying pipenv
is not on path.
Workspace contains pipfile but attempt to run 'pipenv --venv' failed with Error: spawn pipenv ENOENT. Make sure pipenv is on the PATH.
which pipenv
$HOME/.local/bin/pipenv
pipenv
installed using pip3 install pipenv --user
Expected behavior
Don’t show a warning because it it clearly on my PATH
Steps to reproduce:
pip3 install pipenv --user
export PATH=$PATH:$HOME/.local/bin
Logs
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
No output shown
Output from Console
under the Developer Tools
panel (toggle Developer Tools on under Help
)
No output shown
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 46 (13 by maintainers)
Commits related to this issue
- Add LC_ALL and LANG environment variables Due to Python weirdness such as: https://github.com/Microsoft/vscode-python/issues/1338 — committed to kbd/setup by kbd 6 years ago
- Log env info when the existence of pipenv cannot be determined (#1962) Fixes #1338 — committed to microsoft/vscode-python by deleted user 6 years ago
Installing the release version of the extension should work. We released a new version yesterday.
Having exactly the same issue here. VSCode Windows 1.22.2 x64, Shell 1.7.12 Message : “Workspace contains pipfile but attempt to run ‘pipenv --venv’ failed with Error: spawn pipenv ENOENT. Make sure pipenv is on the PATH.”
I don’t think this can be made to work automatically for everyone everywhere, as there’s just too much variety in the kinds of setups people use, especially on Unix-like systems. But I do think users could be made more aware of this type of issues, and they could be given more convenient tools to address them, so I submitted a report to that effect upstream Microsoft/vscode#50465 😃 You’re more than welcome to chime in!
@dlukes thanks for all the exploration! We obviously don’t control the
code
command, so feel free to report that upstream to VS Code if you would like to see this changed.And as for the locale issues, we plan to at least log if not warn users when we discover their locale isn’t set such that
click
will have an issue.One last thing: I was also getting a
UnicodeDecodeError: 'ascii' codec can't decode byte...
on a different box running macOS (fromclick
, when VSCode was trying to runpipenv
). This pointed to a misconfigured locale, i.e. another type of environment problem. I ranchsh
, which informed me that my login shell wasbash
, and the crux of the biscuit was that I hadn’t bothered to properly configure the locale inbash
because I usezsh
on that system. Troubleshooting:code
from azsh
command line, the error goes awayzsh
(usingchsh
) makes the problem go away, irrespective of how VSCode is startedIn any case, getting rid of this type of error is about running VSCode in the proper environment, i.e. the one you use in your interactive terminal sessions. These last two posts of mine are just a laundry list of things you might want to check and tweak in order to make that happen 😃
So I just ran into this same issue on Windows 10 and the problem was that VS Code was not picking up the change I made to my
$env:PATH
in myProfile.ps1
file. If you’re on Windows, make sure that the directory containing pipenv is on your system-level PATH (which can be set by runningsysdm.cpl
, going toAdvanced
,Environment Variables...
, and then check yourPath
value).Please try re-starting VS Code, ensure you have quit VS Code completely for the VS Code process to load the new environment variable. Once done, please test once again.