vpython file missing

18 views
Skip to first unread message

Louis King

unread,
Mar 6, 2026, 10:39:16 PMMar 6
to vpytho...@googlegroups.com
When I "import vpython"  python ends with  ModuleNotFoundError: No module named 'pkg_resources'

I am running python 3.12.12 on linux. I installed the vpython module with pip3.

Running from the shell I get:
$ python -v
.
.
Python 3.12.12 (main, Jan 21 2026, 19:03:12) [GCC 11.5.0 20240719 (Red Hat 11.5.0-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import vpython
# /home/kqgpxvmy/.local/lib/python3.12/site-packages/vpython/__pycache__/__init__.cpython-312.pyc matches /home/kqgpxvmy/.local/lib/python3.12/site-packages/vpython/__init__.py
# code object from '/home/kqgpxvmy/.local/lib/python3.12/site-packages/vpython/__pycache__/__init__.cpython-312.pyc'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/kqgpxvmy/.local/lib/python3.12/site-packages/vpython/__init__.py", line 1, in <module>
    from pkg_resources import get_distribution, DistributionNotFound
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'pkg_resources'
>>>

Suggestions for getting the missing pkg_resources module? 
--
Lou
Say what you will about Sisyphus. He always has work.

Louis King

unread,
Mar 6, 2026, 11:45:05 PMMar 6
to vpytho...@googlegroups.com
Ross Koningstein Saw your suggestion.
In my case when I comment out line 1 in  __init__.py it chokes on the next line and with another # it quits on the <try> because it did not load "get_distribution"

from pkg_resources import get_distribution, DistributionNotFound

from .gs_version import glowscript_version

try:
    __version__ = get_distribution(__name__).version


At this point I will try anything. 

Louis King

unread,
Mar 6, 2026, 11:49:44 PMMar 6
to vpytho...@googlegroups.com
Ross with more careful reading I will try again. 

Louis King

unread,
Mar 7, 2026, 7:30:34 PMMar 7
to vpytho...@googlegroups.com
The 'pkg_resources' module requested by vpython's __init__.py file, line 1 is of course deprecated.
On Feb 6, Ross Koningstein, suggested changes to the __init__ file using the module importlib.detadata instead of pkg_resources.

With those changes python now imports vpython without errors.
However, when executing the python app remotely from a browser the graphics data goes into the ether and the link finely times out (no input/output for 5 min).
When I execute from the shell  python main.py  putty does switch to the ELink browser -- which is not a graphics browser.

If running this thing on Windows, from a browser, hadn't been so eazy, I may not have gone down this rabbit hole.

On Fri, Mar 6, 2026 at 8:39 PM Louis King <ag20...@gmail.com> wrote:
Changeto__init__.txt

Louis King

unread,
Mar 7, 2026, 7:36:52 PMMar 7
to vpytho...@googlegroups.com
Typing error:  Above line #2 should be importlib.metadata
Reply all
Reply to author
Forward
0 new messages