Unable to find types in separate `lib[64]` directories
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
I'm having issues with mypy correctly finding type stubs.
After creating a virtual environment on my Fedora machine using virtualenv, I install the following packages:
pip install mypy protobuf types-protobuf
Using mypy to check the following code
import google.protobuf
I get the error messsage:
my_file.py:1: error: Skipping analyzing "google": module is installed, but missing library stubs or py.typed marker [import-untyped]
my_file.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)
The reason for this seems that in the virtual environment there are two independent lib directories (my_env/lib and my_env/lib64). One google directory containing code of the protobuf package is in lib64/google and the types (types-protobuf) are installed to lib/google-stubs.
Either moving the google-stubs directory to the lib64 variant or creating an (empty) google directory in lib resolves the issue.
It seems mypy is unable to find the corresponding type stubs in the respectively other lib directory.
Has anybody an idea on how to approach this? I do not even know whether the respective installation locations of either the protobuf or the types-protobuf package are correct or whether this is an issue with mypy resolving types?!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the report on Fedora with a virtualenv, installing mypy, protobuf, and types-protobuf, then check the google.protobuf import while comparing the separate lib and lib64 directories. The issue does not name a mypy file or test; completion would require determining whether mypy should resolve stubs across those directories and documenting or validating the resulting behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100