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

VSCode + Virtualenv #6

Closed
iandanforth opened this issue May 11, 2018 · 9 comments
Closed

VSCode + Virtualenv #6

iandanforth opened this issue May 11, 2018 · 9 comments
Assignees

Comments

@iandanforth
Copy link

iandanforth commented May 11, 2018

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.

@Ameobea
Copy link

Ameobea commented May 11, 2018

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:

@saffrydaffry
Copy link

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

@iandanforth
Copy link
Author

iandanforth commented May 12, 2018

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).

@dkao1978
Copy link

dkao1978 commented May 12, 2018

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.

@JensMadsen
Copy link

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

@sinancepel sinancepel self-assigned this May 14, 2018
@SZubarev
Copy link

Having the same issue with virtualenv activated

@Spitfire1900
Copy link

Spitfire1900 commented Mar 31, 2023

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

@rmkerr
Copy link

rmkerr commented Sep 1, 2023

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.

@chrisdopuch
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants