Skip to content

IDLE 3.10.4 cannot import external package but everything work in cmd window #93449

@jdai

Description

@jdai

Bug report

I installed Python 3.10.4 on three laptops with two W10 one W11 all of latest OS per May 2022. Two work fine one has above problem.
Somehow the W10 has multiple Python versions on two folders, as Uninstall Python doesn't remove reg and folders, I manually removed a few reg items and all folders, then reboot and reinstall Python, and added pathsduring and after installation(3.10 and 3.10\Scripts).
In cmd window I use pip to installed a few package (see below list), in cmd window everything work fine and *.py run well.
But in IDLE, import any external package gives error, say "import visa" leads to:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in
import visa
ModuleNotFoundError: No module named 'visa'

I tried to turn on debug and turn on global vars then click Step. I found that there is no visa or other ext module shown, and at 'importlab_bootstrap'.get_module_lock(),line 188 starts to show "KeyError:'visa'".

How to trace it deeply? it might be residue reg items. All three laptops use same steps of installation. Note it is purely IDLE problem as python and all package/lib work well. IDLE is really a poor tool, say search window is a block.

Your environment

Thinkpad T470s with Feature update to Windows 10, version 21H2, Feb 17,2022. 500G M.2 with 32G RAM.
System/local path both have correct path, but path string has length 1527 bytes.

C:\Users\YingzhouDai\pycode>pip list
Package Version


altgraph 0.17.2
certifi 2022.5.18.1
charset-normalizer 2.0.12
cycler 0.11.0
et-xmlfile 1.1.0
fonttools 4.33.3
future 0.18.2
idna 3.3
kiwisolver 1.4.2
matplotlib 3.5.2
numpy 1.22.4
openpyxl 3.0.10
packaging 21.3
pefile 2022.5.30
Pillow 9.1.1
pip 22.1.1
psgdemos 1.10.0
psutil 5.9.1
pyinstaller 5.1
pyinstaller-hooks-contrib 2022.6
pyparsing 3.0.9
PySimpleGUI 4.60.1
python-dateutil 2.8.2
python-forecastio 1.4.0
pywin32-ctypes 0.2.0
requests 2.27.1
responses 0.21.0
scipy 1.8.1
setuptools 58.1.0
six 1.16.0
urllib3 1.26.9
visa 1.0.0
wheel 0.37.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions