No such file or directory error when installing types with mypy
还没有人认领这个 Issue。
评估
调研方向
首先,使用提供的 Python 3.10 环境和 [tool.mypy] 设置复现 poetry run mypy --config-file pyproject.toml,尤其关注 files、exclude、install_types 和 non_interactive 选项。跟踪生成 /site-packages//google 参数的类型安装路径;当所需的 stub 包能够在不使用该无效路径的情况下安装,并且静态分析在 GitLab CI 中完成时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Bug Report
When running the command poetry run mypy --config-file pyproject.toml in GitLab CI, MyPy starts installing types as expected, but then throws an error:
mypy: can't read file '/root/.cache/pypoetry/virtualenvs/our-package-d4xTn211-py3.10/lib/python3.10/site-packages//google': No such file or directory
Expected Behavior
I would expect MyPy to install the required types and run the static analysis check.
Actual Behavior
Installing collected packages: types-PyYAML, types-pytz, types-PyMySQL, urllib3, types-protobuf, pycparser, types-requests, cffi, cryptography, types-pyOpenSSL, types-redis
Attempting uninstall: urllib3
Found existing installation: urllib3 1.26.18
Uninstalling urllib3-1.26.18:
Successfully uninstalled urllib3-1.26.18
Successfully installed cffi-1.16.0 cryptography-41.0.7 pycparser-2.21 types-PyMySQL-1.1.0.1 types-PyYAML-6.0.12.12 types-protobuf-4.24.0.20240106 types-pyOpenSSL-23.3.0.20240106 types-pytz-2023.3.1.1 types-redis-4.6.0.20240106 types-requests-2.31.0.20240106 urllib3-2.1.0
[notice] A new release of pip is available: 23.3.1 -> 23.3.2
[notice] To update, run: pip install --upgrade pip
mypy: can't read file '/root/.cache/pypoetry/virtualenvs/our-package-d4xTn211-py3.10/lib/python3.10/site-packages//google': No such file or directory
Installing missing stub packages:
/root/.cache/pypoetry/virtualenvs/our-package-d4xTn211-py3.10/bin/python -m pip install types-PyMySQL types-PyYAML types-protobuf types-pytz types-redis types-requests
Your Environment
This error occurs when running the mypy command in GitLab CI.
- Mypy version used: 1.8.0 (also tried with 1.7.0)
- Mypy command-line flags: --config-file pyproject.toml
- Mypy configuration options from
mypy.ini(and other config files):[tool.mypy] disallow_untyped_defs = true allow_any_unimported = true no_implicit_optional = true check_untyped_defs = true warn_return_any = true warn_unused_ignores = true show_error_codes = true warn_unused_configs = true disallow_incomplete_defs = true ignore_missing_imports = true files = ["our_package", "examples"] exclude = [".venv", ".cache", "build"] install_types = false non_interactive = true pretty = true - Python version used: 3.10
- 主要语言
- Python
- 星标
- 20.6k
- 派生
- 3.3k
- 平均合并
- 1 天 18 小时
- 30 天内合并 PR
- 54
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python/mypy 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
-
documentation
难度 2/5 1-3 小时 新手友好度 72/100
-
bug topic-configuration topic-error-reporting
难度 2/5 1-3 小时 新手友好度 68/100
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 86/100
zostera/django-bootstrap4#894 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
use-agent-os/agent-os#3276 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
难度 2/5 1-3 小时 新手友好度 88/100
NousResearch/hermes-agent#117848 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
zilliztech/memsearch#759 ·