Title: Caching bug with `--incremental --cache-dir` combination causes `AssertionError: Cannot find module` · Issue #16214 · python/mypy · GitHub
Open Graph Title: Caching bug with `--incremental --cache-dir` combination causes `AssertionError: Cannot find module` · Issue #16214 · python/mypy
X Title: Caching bug with `--incremental --cache-dir` combination causes `AssertionError: Cannot find module` · Issue #16214 · python/mypy
Description: Crash Report There appears to be a caching bug in mypy 1.2.0 (compiled: yes). This started occurring recently after we upgraded from 1.0.0 to 1.2.0. I am running mypy with these parameters: mypy --config ./mypy.ini --incremental --cache-...
Open Graph Description: Crash Report There appears to be a caching bug in mypy 1.2.0 (compiled: yes). This started occurring recently after we upgraded from 1.0.0 to 1.2.0. I am running mypy with these parameters: mypy --...
X Description: Crash Report There appears to be a caching bug in mypy 1.2.0 (compiled: yes). This started occurring recently after we upgraded from 1.0.0 to 1.2.0. I am running mypy with these parameters: mypy --...
Opengraph URL: https://github.com/python/mypy/issues/16214
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Caching bug with `--incremental --cache-dir` combination causes `AssertionError: Cannot find module`","articleBody":"**Crash Report**\r\n\r\nThere appears to be a caching bug in `mypy 1.2.0 (compiled: yes)`.\r\n\r\nThis started occurring recently after we upgraded from `1.0.0` to `1.2.0`.\r\n\r\nI am running mypy with these parameters:\r\n```\r\nmypy --config ./mypy.ini --incremental --cache-dir ./.local/mypy_cache/app --no-install-types --follow-imports=skip ./app\r\n```\r\n\r\nand very frequently getting the error:\r\n```\r\nAssertionError: Cannot find module for google\r\n```\r\n(There is no package in our application called simply `google`; but there are a bunch that start with that name, and have import paths starting with `google.`; see below.)\r\n\r\nIf I delete the contents of `.local/mypy_cache`, then the error goes away momentarily, but quickly comes back on the next run.\r\n\r\nFor example:\r\n1. I'm on `branch_a`, I run the `mypy` invocation above, and get that error.\r\n2. `rm -rf .local/mypy_cache`\r\n3. Run `mypy` again, it passes without error (`Success: no issues found in N source files`).\r\n4. Switch to `branch_b`, run `mypy` again – errors again.\r\n5. Repeat steps 2 and 3 – no errors.\r\n6. Switch back to `branch_a`, errors again, etc.\r\n\r\n**Traceback**\r\n(file paths user `/Users/*` modified from original)\r\n```\r\nTraceback (most recent call last):\r\n File \"/Users/myname/.pyenv/versions/my-venv-path/bin/mypy\", line 8, in \u003cmodule>\r\n sys.exit(console_entry())\r\n File \"/Users/myname/.pyenv/versions/3.10.11/envs/my-venv-path/lib/python3.10/site-packages/mypy/__main__.py\", line 15, in console_entry\r\n main()\r\n File \"mypy/main.py\", line 95, in main\r\n File \"mypy/main.py\", line 174, in run_build\r\n File \"mypy/build.py\", line 194, in build\r\n File \"mypy/build.py\", line 277, in _build\r\n File \"mypy/build.py\", line 2930, in dispatch\r\n File \"mypy/build.py\", line 3321, in process_graph\r\n File \"mypy/build.py\", line 3402, in process_fresh_modules\r\n File \"mypy/build.py\", line 2121, in fix_cross_refs\r\n File \"mypy/fixup.py\", line 53, in fixup_module\r\n File \"mypy/fixup.py\", line 122, in visit_symbol_table\r\n File \"mypy/lookup.py\", line 31, in lookup_fully_qualified\r\nAssertionError: Cannot find module for google\r\n```\r\n\r\n**Your Environment**\r\n\r\n- Python 3.10.11\r\n- mypy 1.2.0 (compiled: yes)\r\n- OS: MacOS Ventura 13.5.2\r\n\r\n(see `mypy` parameters used above)\r\n\r\nGiven the error about `google`, this is the output of `pip freeze | grep google`:\r\n```\r\napache-airflow-providers-google==10.7.0\r\ngoogle-ads==21.3.0\r\ngoogle-api-core==2.11.1\r\ngoogle-api-python-client==2.97.0\r\ngoogle-auth==2.22.0\r\ngoogle-auth-httplib2==0.1.0\r\ngoogle-auth-oauthlib==1.0.0\r\ngoogle-cloud-aiplatform==1.31.1\r\ngoogle-cloud-appengine-logging==1.3.1\r\ngoogle-cloud-audit-log==0.2.5\r\ngoogle-cloud-automl==2.11.2\r\ngoogle-cloud-batch==0.16.0\r\ngoogle-cloud-bigquery==3.11.4\r\ngoogle-cloud-bigquery-datatransfer==3.12.0\r\ngoogle-cloud-bigquery-storage==2.22.0\r\ngoogle-cloud-bigtable==2.21.0\r\ngoogle-cloud-build==3.20.0\r\ngoogle-cloud-compute==1.14.0\r\ngoogle-cloud-container==2.30.0\r\ngoogle-cloud-core==2.3.3\r\ngoogle-cloud-datacatalog==3.15.0\r\ngoogle-cloud-dataflow-client==0.8.4\r\ngoogle-cloud-dataform==0.5.2\r\ngoogle-cloud-dataplex==1.6.2\r\ngoogle-cloud-dataproc==5.4.3\r\ngoogle-cloud-dataproc-metastore==1.12.0\r\ngoogle-cloud-dlp==3.12.2\r\ngoogle-cloud-kms==2.19.1\r\ngoogle-cloud-language==2.11.0\r\ngoogle-cloud-logging==3.6.0\r\ngoogle-cloud-memcache==1.7.2\r\ngoogle-cloud-monitoring==2.15.1\r\ngoogle-cloud-orchestration-airflow==1.9.1\r\ngoogle-cloud-os-login==2.10.0\r\ngoogle-cloud-pubsub==2.18.3\r\ngoogle-cloud-redis==2.13.1\r\ngoogle-cloud-resource-manager==1.10.3\r\ngoogle-cloud-run==0.9.1\r\ngoogle-cloud-secret-manager==2.16.3\r\ngoogle-cloud-spanner==3.40.1\r\ngoogle-cloud-speech==2.21.0\r\ngoogle-cloud-storage==2.10.0\r\ngoogle-cloud-storage-transfer==1.9.1\r\ngoogle-cloud-tasks==2.14.1\r\ngoogle-cloud-texttospeech==2.14.1\r\ngoogle-cloud-translate==3.12.0\r\ngoogle-cloud-videointelligence==2.11.3\r\ngoogle-cloud-vision==3.4.4\r\ngoogle-cloud-workflows==1.11.0\r\ngoogle-crc32c==1.5.0\r\ngoogle-re2==1.1\r\ngoogle-resumable-media==2.5.0\r\ngoogleapis-common-protos==1.60.0\r\ngrpc-google-iam-v1==0.12.6\r\npydata-google-auth==1.8.2\r\n```\r\n\r\nThank you!","author":{"url":"https://github.com/benbuckman","@type":"Person","name":"benbuckman"},"datePublished":"2023-10-02T03:58:41Z","url":"https://github.com/python/mypy/issues/16214"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:38ab1066-13d7-b420-153d-70ba8e9192a7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E370:27AD12:3F42A9:551C19:6B002B95 |
| html-safe-nonce | 92cfd4509e8ca742433b9039b7e85f1667e23d54661597fc8bcc669a3545d28f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzcwOjI3QUQxMjozRjQyQTk6NTUxQzE5OjZCMDAyQjk1IiwidmlzaXRvcl9pZCI6IjU1Mjk0NTQ1NjQ5NzUwNjE5MDkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9579fdd20187b6ad5ea915784feec6a1e4d5921c93cd1cc6077b0617095b6eb3 |
| hovercard-subject-tag | issue:1921206094 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/16214/issue_layout |
| twitter:image | https://opengraph.githubassets.com/63c9bf405863ff0a16be1258111c5b6b11e11ec907438953c55e0eb3bc1ce0a6/python/mypy/issues/16214 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/63c9bf405863ff0a16be1258111c5b6b11e11ec907438953c55e0eb3bc1ce0a6/python/mypy/issues/16214 |
| og:image:alt | Crash Report There appears to be a caching bug in mypy 1.2.0 (compiled: yes). This started occurring recently after we upgraded from 1.0.0 to 1.2.0. I am running mypy with these parameters: mypy --... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | benbuckman |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width