pyre-check icon indicating copy to clipboard operation
pyre-check copied to clipboard

VSCode + Virtualenv

Open iandanforth opened this issue 7 years ago • 9 comments
trafficstars

Environment

OS: OSX 10.13.2 Python: 3.6.4 (in pipenv managed virtual environment) VSCode: 1.23.1

Error

After installing the extension I get the following error in the 'Output' window within VSCode

[Error - 11:58:11] Starting client failed
Launching server using command pyre failed.

Running pyre within the virtual env completes successfully and detects the sample type error.

iandanforth avatar May 11 '18 19:05 iandanforth

Have you set your virtual environment in your VS Code config?

{
  "python.pythonPath": "/opt/anaconda/envs/tf/bin/python"
}

There's a button on the bottom of the screen that you can click to has this done for you:

Ameobea avatar May 11 '18 23:05 Ameobea

I'm having this issue as well with conda environments. Using python 3.6.5.

saffrydaffry avatar May 12 '18 00:05 saffrydaffry

The python extension automatically detects pipenv virtual environments however the pyre VSCode extension calls the 'pyre' executable in a way that doesn't seem to pick up the detected environment. It behaves as if pyre is being called in the project directory but not within the venv.

For example if I use pyenv local 3.6.4 and then pip install pyre-check and then reload the pyre extension it seems to work (at least once).

iandanforth avatar May 12 '18 03:05 iandanforth

I had the same issue and as a work around, I modified the pyre command in the extension to the full path of the pyre executable. The location is in ~/.vscode/extensions/fb-pyre-check.pyre-vscode-0.0.1/out/main.js. You can find it in function activate() under serverOptions.

For whatever reason, VSCode has a hard time finding things in virtualenv. I think this is why many extensions have a config for the path of it's executable.

dkao1978 avatar May 12 '18 16:05 dkao1978

It works on my computer if I start vs code from a terminal where the venv is activated

JensMadsen avatar May 12 '18 18:05 JensMadsen

Having the same issue with virtualenv activated

SZubarev avatar May 28 '18 18:05 SZubarev

I've reproduced this when pyre-check is installed as a poetry dev group dependency as well as when it is installed via pipx

Code: 1.76.2 Poetry (version 1.4.1) Client version: 0.9.18 extension version: v0.0.1 Ubuntu 22.04.2 LTS

Spitfire1900 avatar Mar 31 '23 01:03 Spitfire1900

Also running into this issue -- it seems like the vscode extension uses the global version of pyre instead of the interpreter configured in vscode. I'd love to use pyre but this is blocking for me, as I'm working on a project with multiple environments.

rmkerr avatar Sep 01 '23 22:09 rmkerr

This is also happening for me, I am hacking around it by adding my virtualenv bin directory to the system PATH, which is not ideal.

chrisdopuch avatar Jan 30 '24 16:01 chrisdopuch