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

pyre crashes in virtualenv #326

Open
gruszczy opened this issue Oct 14, 2020 · 3 comments
Open

pyre crashes in virtualenv #326

gruszczy opened this issue Oct 14, 2020 · 3 comments
Labels

Comments

@gruszczy
Copy link

This used to work with pyre 0.0.52, but started failing on 0.0.56. When I run pyre inside virtualenv it fails with the following:

ƛ Traceback (most recent call last):
File "/Users/gru/.venvs/towngen/lib/python3.8/site-packages/pyre_check/client/pyre.py", line 102, in run_pyre
configuration = configuration_module.Configuration.from_arguments(
File "/Users/gru/.venvs/towngen/lib/python3.8/site-packages/pyre_check/client/configuration.py", line 647, in from_arguments
return Configuration(
File "/Users/gru/.venvs/towngen/lib/python3.8/site-packages/pyre_check/client/configuration.py", line 626, in init
self._read(project_configuration)
File "/Users/gru/.venvs/towngen/lib/python3.8/site-packages/pyre_check/client/configuration.py", line 991, in _read
site_roots = site.getsitepackages()
AttributeError: module 'site' has no attribute 'getsitepackages'

I am using virtualenv==20.0.34.

@xmo-odoo
Copy link
Contributor

@gruszczy pypa/virtualenv#737 seems relevant, might be worth commenting over there?

It pointed at mhammond/pywin32#1439 but you don't seem to be using windows (per your path, unless this is wsl and pywin works?)

@gruszczy
Copy link
Author

Thanks @xmo-odoo I'm on mac. I can try using some of the workarounds if necessary.

facebook-github-bot pushed a commit that referenced this issue Oct 17, 2020
…lenv

Summary:
It turns out that there's a very annoying virtualenv bug: `site.getsitepackages()` is not always available on all python releases and all platforms. See github issue #326. The sad downstream impact for us is that we are affected by it even in cases where we actually don't need to invoke this function.

This diff tries to work around that issue by catching the `AttributeError` and fall back to empty site root with a warning printed.

Reviewed By: pradeep90

Differential Revision: D24365599

fbshipit-source-id: 05363cc2440c8437e2e50652fadd4ee897b6a4a5
@MaggieMoss
Copy link
Contributor

@gruszczy Are you still seeing this error?

@MaggieMoss MaggieMoss added the bug label Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants