René's URL Explorer Experiment


Title: "Intermittent" import error when checking a module that import another module which imports a 3rd party package · Issue #7276 · python/mypy · GitHub

Open Graph Title: "Intermittent" import error when checking a module that import another module which imports a 3rd party package · Issue #7276 · python/mypy

X Title: "Intermittent" import error when checking a module that import another module which imports a 3rd party package · Issue #7276 · python/mypy

Description: Hi, Sorry for the title. I try to explain myself better. I have found a strange behaviour in mypy related to an import error in a imported module. That is, an error in a module 'b' importing a module 'c' while checking module 'a', which ...

Open Graph Description: Hi, Sorry for the title. I try to explain myself better. I have found a strange behaviour in mypy related to an import error in a imported module. That is, an error in a module 'b' importing a modu...

X Description: Hi, Sorry for the title. I try to explain myself better. I have found a strange behaviour in mypy related to an import error in a imported module. That is, an error in a module 'b' importin...

Opengraph URL: https://github.com/python/mypy/issues/7276

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"\"Intermittent\" import error when checking a module that import another module which imports a 3rd party package","articleBody":"Hi,\r\n\r\nSorry for the title. I try to explain myself better.\r\n\r\nI have found a strange behaviour in `mypy` related to an import error in a imported module. That is, an error in a module 'b' importing a module 'c' while checking module 'a', which imports 'b'. 'c', of course, is a 3rd party package.\r\n\r\nIn such a case, `mypy` reports nothing on a first round. But if it is run again, it reported a `error: Cannot find module named 'c'`. On a third run, nothing is reported again, while on a fourth run the error re-appears, and so on...\r\n\r\nThis happens even when the type check has been disabled in the import line.\r\n\r\nA possible scenario to reproduce this \"bug\" is as follows:\r\n\r\n1. Create a 'strange_report' package (with an empty `__init__.py`).\r\n\r\n2. Create a subpackage called 'a' inside 'strange_report' (with an empty `__init__.py` too).\r\n\r\n3. Write an `a.py` module (importer module) such as:\r\n```\r\nfrom a.b import B\r\n\r\nb = B()  # just for visually check that a.py was run\r\n```\r\n4. Write a `b.py` module (imported module)\r\n```\r\nfrom ruamel.yaml import YAMLError  # type: ignore\r\n\r\n\r\nclass B:\r\n    def __init__(self):\r\n        print(f\"New 'B' object {self} has been created\")\r\n```\r\n\r\n5. Open terminal and change to directory 'strange_report'.\r\n\r\n6. Module `a.py` can be run with `python -m a.a`\r\n\r\n7. If you run `mypy a/a.py` for the first time, you do not get any reports (however, directory '.mypy_cache' is created).\r\n\r\n8. But if you run `mypy a/a.py` once again, you get an error:\r\n\r\n```\r\nmadera:strange_error jv$ mypy a/a.py\r\na/b.py:1: error: Cannot find module named 'ruamel'\r\na/a.py:1: error: Cannot find module named 'ruamel'\r\na/a.py:1: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports\r\n```\r\n9. You can repeat 7. and 8. again and again with similar results. Same results are gotten with or without `# type: ignore`.\r\n\r\nHowever, **if cache directory '.mypy_cache' is deleted** before running mypy every time, it **does not report anything**.\r\n\r\nCuriously enough, if you check `mypy a/b.py` it consistently reports nothing.\r\n\r\nI am running on:\r\n\r\n- macOS HIgh Sierra 10.13.6\r\n- Python 3.7.4\r\n- mypy 0.720\r\n- ruamel.yaml 0.16.0 (so, yes, ruamel.yaml is installed; I use this 3rd party package because it is causing the bug in my system; no any particular purposes, I imagined that same bug can appeared with similar packages but cannot confirm that)\r\n- Any mypy configuration beyond the default one.\r\n\r\nThank for your attention. I hope that will be helpful.","author":{"url":"https://github.com/Quibi","@type":"Person","name":"Quibi"},"datePublished":"2019-07-31T11:03:05Z","url":"https://github.com/python/mypy/issues/7276"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:1088c537-c0bd-0912-2b25-ed873430b545
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA172:BACA4:2E858D4:3D9B966:6B0029CC
html-safe-noncefcfee43806eeb6c7e0fbd0b7007636cb8d67b6753a00084e821f56a34c24d715
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMTcyOkJBQ0E0OjJFODU4RDQ6M0Q5Qjk2Njo2QjAwMjlDQyIsInZpc2l0b3JfaWQiOiI2NTIwNTE0NDAzMDU2NDk1MDUyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac7522680acd95a0239fec79b22db57a92e01584e58bb381a3c8a57376c12d9579
hovercard-subject-tagissue:475078142
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/7276/issue_layout
twitter:imagehttps://opengraph.githubassets.com/5cc7df10ff8adf261fc0b03410e6cf5a307cf39053b9a4689e1a296a2b40969b/python/mypy/issues/7276
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/5cc7df10ff8adf261fc0b03410e6cf5a307cf39053b9a4689e1a296a2b40969b/python/mypy/issues/7276
og:image:altHi, Sorry for the title. I try to explain myself better. I have found a strange behaviour in mypy related to an import error in a imported module. That is, an error in a module 'b' importing a modu...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameQuibi
hostnamegithub.com
expected-hostnamegithub.com
None7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0
turbo-cache-controlno-preview
go-importgithub.com/python/mypy git https://github.com/python/mypy.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id7053637
octolytics-dimension-repository_nwopython/mypy
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id7053637
octolytics-dimension-repository_network_root_nwopython/mypy
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasef3f3a43ca095cdea3abbb394112e971f9fdb94fa
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/mypy/issues/7276#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F7276
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F7276
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fmypy
Reloadhttps://github.com/python/mypy/issues/7276
Reloadhttps://github.com/python/mypy/issues/7276
Reloadhttps://github.com/python/mypy/issues/7276
pythonhttps://github.com/python
mypyhttps://github.com/python/mypy
Codehttps://github.com/python/mypy
Issues2.7k (2.7k)https://github.com/python/mypy/issues
Pull requests547 (547)https://github.com/python/mypy/pulls
Actionshttps://github.com/python/mypy/actions
Projectshttps://github.com/python/mypy/projects
Wikihttps://github.com/python/mypy/wiki
Security and qualityhttps://github.com/python/mypy/security
Insightshttps://github.com/python/mypy/insights
https://github.com/python/mypy
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/7276
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/7276
"Intermittent" import error when checking a module that import another module which imports a 3rd party packagehttps://github.com/python/mypy/issues/7276#top
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
priority-0-highhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-0-high%22
topic-incrementalhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-incremental%22
https://github.com/Quibi
Quibihttps://github.com/Quibi
on Jul 31, 2019https://github.com/python/mypy/issues/7276#issue-475078142
https://github.com/ilevkivskyi
ilevkivskyihttps://github.com/ilevkivskyi
on Aug 12, 2019https://github.com/python/mypy/issues/7276#issuecomment-520448795
ilevkivskyihttps://github.com/ilevkivskyi
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
priority-1-normalhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-1-normal%22
topic-incrementalhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-incremental%22
on Aug 12, 2019https://github.com/python/mypy/issues/7276#event-2550397812
https://github.com/Quibi
Quibihttps://github.com/Quibi
on Sep 9, 2019https://github.com/python/mypy/issues/7276#issuecomment-529414846
documentationhttps://mypy.readthedocs.io/en/latest/command_line.html
https://github.com/jsonmcfall
jsonmcfallhttps://github.com/jsonmcfall
on Oct 3, 2019https://github.com/python/mypy/issues/7276#issuecomment-538005657
https://github.com/JukkaL
JukkaLhttps://github.com/JukkaL
on Oct 7, 2019https://github.com/python/mypy/issues/7276#issuecomment-539024920
https://github.com/Quibi
Quibihttps://github.com/Quibi
on Oct 7, 2019https://github.com/python/mypy/issues/7276#issuecomment-539089610
https://pypi.org/project/ruamel.yaml/https://pypi.org/project/ruamel.yaml/
https://github.com/Quibi
Quibihttps://github.com/Quibi
on Oct 7, 2019https://github.com/python/mypy/issues/7276#issuecomment-539092272
@JukkaLhttps://github.com/JukkaL
https://github.com/JukkaL
JukkaLhttps://github.com/JukkaL
on Oct 8, 2019https://github.com/python/mypy/issues/7276#issuecomment-539491228
JukkaLhttps://github.com/JukkaL
priority-0-highhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-0-high%22
priority-1-normalhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-1-normal%22
on Oct 8, 2019https://github.com/python/mypy/issues/7276#event-2695237358
https://github.com/Quibi
Quibihttps://github.com/Quibi
on Oct 10, 2019https://github.com/python/mypy/issues/7276#issuecomment-540640028
@JukkaLhttps://github.com/JukkaL
https://github.com/asfaltboy
asfaltboyhttps://github.com/asfaltboy
on Jan 16, 2020https://github.com/python/mypy/issues/7276#issuecomment-575272164
#7219https://github.com/python/mypy/pull/7219
https://bitbucket.org/ruamel/yaml/issues/328/mypy-complains-that-ruamel-is-missing-typehttps://bitbucket.org/ruamel/yaml/issues/328/mypy-complains-that-ruamel-is-missing-type
https://github.com/domdfcoding
domdfcodinghttps://github.com/domdfcoding
on Oct 23, 2020https://github.com/python/mypy/issues/7276#issuecomment-715574279
@asfaltboyhttps://github.com/asfaltboy
https://sourceforge.net/p/ruamel-yaml/tickets/328/https://sourceforge.net/p/ruamel-yaml/tickets/328/
hauntsaninjahttps://github.com/hauntsaninja
on Oct 24, 2020https://github.com/python/mypy/issues/7276#event-3917213181
Make --namespace-packages the defaulthttps://github.com/hauntsaninja/mypy/commit/63a93f135f6e48ea7bb6bd28aaa9ebbb6a7a6699
63a93f1https://github.com/hauntsaninja/mypy/commit/63a93f135f6e48ea7bb6bd28aaa9ebbb6a7a6699
on Dec 17, 2020https://github.com/python/mypy/issues/7276#event-4125588186
lint.sh: run mypy in non incremental modehttps://github.com/TankerHQ/sdk-python/commit/18795d2eccee754d8d4c117b322b664f3e7b0ca1
18795d2https://github.com/TankerHQ/sdk-python/commit/18795d2eccee754d8d4c117b322b664f3e7b0ca1
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
on Aug 6, 2021https://github.com/python/mypy/issues/7276#issuecomment-894489297
#10937https://github.com/python/mypy/pull/10937
hauntsaninjahttps://github.com/hauntsaninja
completedhttps://github.com/python/mypy/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Aug 6, 2021https://github.com/python/mypy/issues/7276#event-5124589305
hauntsaninjahttps://github.com/hauntsaninja
on Aug 6, 2021https://github.com/python/mypy/issues/7276#event-5125155506
Make --namespace-packages the defaulthttps://github.com/hauntsaninja/mypy/commit/6a993c5df41290f2bad64c69446e8fa86a819f6b
6a993c5https://github.com/hauntsaninja/mypy/commit/6a993c5df41290f2bad64c69446e8fa86a819f6b
SamTheisenshttps://github.com/SamTheisens
on Sep 13, 2023https://github.com/python/mypy/issues/7276#event-10354069709
[TECH-491] Attempt to solve intermittent import mypy errorhttps://github.com/Vandebron/mpyl/commit/395d6d171641caced23e322d68bf6bc0349d4881
395d6d1https://github.com/Vandebron/mpyl/commit/395d6d171641caced23e322d68bf6bc0349d4881
[TECH-491] Attempt to solve intermittent import mypy errorhttps://github.com/Vandebron/mpyl/commit/f7b800b6db875a0cbf4ee918c4c74515c9b776c2
f7b800bhttps://github.com/Vandebron/mpyl/commit/f7b800b6db875a0cbf4ee918c4c74515c9b776c2
[TECH-491] Attempt to solve intermittent import mypy errorhttps://github.com/Vandebron/mpyl/commit/1cb4a139bb083db62fcab5db08e82db67ce2ec62
1cb4a13https://github.com/Vandebron/mpyl/commit/1cb4a139bb083db62fcab5db08e82db67ce2ec62
[TECH-491] Attempt to solve intermittent import mypy errorhttps://github.com/Vandebron/mpyl/commit/6e2a00764baa25df496939984399e6c2b3b654ef
6e2a007https://github.com/Vandebron/mpyl/commit/6e2a00764baa25df496939984399e6c2b3b654ef
https://github.com/sigma67
sigma67https://github.com/sigma67
on Mar 15, 2024https://github.com/python/mypy/issues/7276#issuecomment-1999257292
dkfellowshttps://github.com/dkfellows
on Jun 20, 2024https://github.com/python/mypy/issues/7276#event-13229887374
Workaround for mypy alternating between understanding ruamel and nothttps://github.com/dkfellows/hpcflow-new/commit/6f89b1e46cc6c4e975034ff837b7df83f9ecb9d3
6f89b1ehttps://github.com/dkfellows/hpcflow-new/commit/6f89b1e46cc6c4e975034ff837b7df83f9ecb9d3
bherrerahttps://github.com/bherrera
on Jul 15, 2024https://github.com/python/mypy/issues/7276#event-13510274270
[mypy] Add `--no-incremental` flag to temporarily resolve mypy flakehttps://github.com/misttech/mist-os/commit/9b5d6807bce05e989e9f7b7afad1430ae4e385ad
9b5d680https://github.com/misttech/mist-os/commit/9b5d6807bce05e989e9f7b7afad1430ae4e385ad
[roll] Roll fuchsia [mypy] Add `--no-incremental` flag to temporarily…https://github.com/misttech/integration/commit/021160fac987a3cd2388db4f42378bd136df8f52
021160fhttps://github.com/misttech/integration/commit/021160fac987a3cd2388db4f42378bd136df8f52
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
on Mar 21, 2025https://github.com/python/mypy/issues/7276#issuecomment-2742490489
#12664https://github.com/python/mypy/issues/12664
ldbohttps://github.com/ldbo
on Aug 6, 2025https://github.com/python/mypy/issues/7276#event-19018018507
Update pre-commit hooks versionshttps://github.com/ldbo/phileas/commit/e40a135e206446465a4e549dd119b717eabbbae0
e40a135https://github.com/ldbo/phileas/commit/e40a135e206446465a4e549dd119b717eabbbae0
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/mypy/issues/7276
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/mypy/issues/7276
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
priority-0-highhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-0-high%22
topic-incrementalhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-incremental%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.