jra3 / lsp-pyre

An Emacs LSP client for python using lsp-mode and pyre.
GNU General Public License v3.0
2 stars 2 forks source link

Error in `pyre::stderr` Cannot find any source files to analyze. Either `source_directories` or `targets` must be specified. #1

Closed dhilst closed 8 months ago

dhilst commented 8 months ago

I'm trying to use pyre in a new project but I always get the same error in pyre::stderr buffer

How to reproduce:

stack trace in pyre::stderr buffer

ƛ Reading Pyre server configurations...
ƛ Uncaught error in persistent.run

Traceback (most recent call last):
  File "/home/geckos/.venv/pyretest/lib/python3.11/site-packages/pyre_check/client/commands/persistent.py", line 309, in run
    return asyncio.get_event_loop().run_until_complete(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/geckos/.venv/pyretest/lib/python3.11/site-packages/pyre_check/client/commands/persistent.py", line 233, in run_persistent
    initial_server_options = pyre_server_options.read_server_options(
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/geckos/.venv/pyretest/lib/python3.11/site-packages/pyre_check/client/commands/pyre_server_options.py", line 129, in read_server_options
    return server_options_reader()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/geckos/.venv/pyretest/lib/python3.11/site-packages/pyre_check/client/commands/pyre_server_options.py", line 114, in read
    return PyreServerOptions.create(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/geckos/.venv/pyretest/lib/python3.11/site-packages/pyre_check/client/commands/pyre_server_options.py", line 94, in create
    start_arguments = start.create_server_arguments(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/geckos/.venv/pyretest/lib/python3.11/site-packages/pyre_check/client/commands/start.py", line 308, in create_server_arguments
    source_paths = backend_arguments.get_source_path_for_server(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/geckos/.venv/pyretest/lib/python3.11/site-packages/pyre_check/client/backend_arguments.py", line 363, in get_source_path_for_server
    return get_source_path(configuration, artifact_root_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/geckos/.venv/pyretest/lib/python3.11/site-packages/pyre_check/client/backend_arguments.py", line 345, in get_source_path
    raise configuration_module.InvalidConfiguration(
pyre_check.client.configuration.exceptions.InvalidConfiguration: Invalid configuration: Cannot find any source files to analyze. Either `source_directories` or `targets` must be specified.

requirements.txt

astroid==3.0.3
autopep8==2.0.4
click==8.1.7
dataclasses-json==0.6.4
dill==0.3.8
docstring-to-markdown==0.15
flake8==7.0.0
importlib-metadata==7.0.1
intervaltree==3.1.0
isort==5.13.2
jedi==0.19.1
libcst==1.2.0
marshmallow==3.21.0
mccabe==0.7.0
mypy-extensions==1.0.0
packaging==23.2
parso==0.8.3
platformdirs==4.2.0
pluggy==1.4.0
psutil==5.9.8
pycodestyle==2.11.1
pydocstyle==6.3.0
pyflakes==3.2.0
Pygments==2.17.2
pylint==3.0.4
pyre-check==0.9.19
pyre-extensions==0.0.30
python-lsp-jsonrpc==1.1.2
python-lsp-pyre==0.1.3
python-lsp-server==1.10.0
pytoolconfig==1.3.1
PyYAML==6.0.1
rope==1.12.0
snowballstemmer==2.2.0
sortedcontainers==2.4.0
tabulate==0.9.0
TestSlide==2.7.1
tomli==2.0.1
tomlkit==0.12.4
typeguard==2.13.3
typing-inspect==0.9.0
typing_extensions==4.10.0
ujson==5.9.0
whatthepatch==1.0.5
yapf==0.40.2
zipp==3.17.0

.pyre_configuration

{
  "site_package_search_strategy": "pep561",
  "source_directories": [
    "."
  ]
}

I tried other variations of configurations but I always had the same error

dhilst commented 8 months ago

Okay, the problem was with the lsp workspace and also I had to install watchman, here is how I did it

In the terminal

# Install watchman 
yay -S watchman-bin # I'm using archlinux
# browse to the project folder
cd pyretest
# remove old config
rm -rf .pyre_configuration .pyre .watchmanconfig
# init again
pyre init
# I needed that too
watchman watch .

After this I: