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

[Python] When I import PyArrow and use Pyright linter CLI, it reports: Stub file not found for "pyarrow" #36113

Open
joao-parana opened this issue Jun 15, 2023 · 3 comments
Labels
Component: Python Type: usage Issue is a user question

Comments

@joao-parana
Copy link

Describe the usage question you have. Please include as many useful details as possible.

When I import PyArrow and use Pyright linter CLI, it reports: Stub file not found for "pyarrow"

from pyarrow import parquet as pq
# . . .
# some python code here
pyright main.py

show this:

Stub file not found for "pyarrow" (reportMissingTypeStubs)

By the way, pyright is a Type Checker for Python. See : `https://github.com/microsoft/pyright

Any suggestion to solve this?

Tanks.

Component(s)

Python

@joao-parana joao-parana added the Type: usage Issue is a user question label Jun 15, 2023
@SChakravorti21
Copy link
Contributor

Seconding this. In my experience, mypy is not able to type-check code that uses PyArrow, either.

@raulcd raulcd changed the title When I import PyArrow and use Pyright linter CLI, it reports: Stub file not found for "pyarrow" [Python] When I import PyArrow and use Pyright linter CLI, it reports: Stub file not found for "pyarrow" Jun 16, 2023
@gowtham-source
Copy link

Solution 1 : Install PyArrow type stubs
You can try installing the PyArrow type stubs separately using the following command:

pip install pyarrow-stubs

This package contains the necessary type annotations for PyArrow, allowing Pyright to understand the library's API and perform accurate type checking.

Solution 2 : Use an alternative linter
If installing the PyArrow type stubs doesn't resolve the issue, consider using a different linter that supports PyArrow or provides more flexible type checking. Mypy and PyLint are popular alternatives that you can install and configure to check your code.

Solution 3 : Ignore the Pyright error
If you are confident in the correctness of your PyArrow usage and want to continue using Pyright without type checking for PyArrow, you can configure Pyright to ignore the specific error related to the missing stub file. Create a pyrightconfig.json file in your project's root directory and add the following content:

{
  "reportMissingTypeStubs": "none"
}

This configuration will prevent Pyright from reporting the missing stub file error for "pyarrow".

Please note that the availability and compatibility of type stubs can vary across different libraries, and not all libraries may have dedicated stub files. If none of the above solutions work, consider reaching out to the PyArrow community or raising an issue on the Pyright GitHub repository for further assistance.

@rmorshea
Copy link

rmorshea commented Aug 2, 2023

Duplicate of #32609

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Python Type: usage Issue is a user question
Projects
None yet
Development

No branches or pull requests

4 participants