1

My 11-year-old son is trying to follow Carol Vorderman's "Python Games for Kids" book, but is hitting a fundamental problem installing then using Actors module (p.52-onwards of book), on Windows 10. No instructions are provided for installing or importing this. We installed 'actors' (0.5.1b1) using pip:

pip install actors

The install "works" happily, no error is reported, and a (basic) actors installation appears. (We also tried python -m pip install actors, with exactly the same result).

However, any attempt to import actors; e.g.,

from actors import Actor

fails with:

ModuleNotFoundError: no module name 'actors.internal'

of line 29 of actors\__init__.py . Which is fair enough, because it does try to import messages from actors.internal, which does not seem to exist.

Things I checked following the import:

  • the downloaded .tar.gz file includes a load of subdirectories, including internal; but this doesn't make it into the disc. So it looks like pip isn't handling the .tar.gz file correctly? But it seems hard to believe that such a basic failure has gone undetected.
  • the disc has 116G free, so it's not running outta space.
  • I checked other answers (python pip install not working on windows, pip install on a shared directory (windows)), but they do not seem to apply here.
smci
  • 32,567
  • 20
  • 113
  • 146
user3416536
  • 1,429
  • 9
  • 20

2 Answers2

2

This is a bug in the distribution. It lists packages=['actors'], but it must list all subpackages (internal and utils) too.

The bug was reported in 2016 and still is unresolved. So we can guess the package is abandoned and there is not much you can do to fix it (other than forking and fixing it yourself).

phd
  • 82,685
  • 13
  • 120
  • 165
1

You need to run your program through Pygame Zero, since it adds a few things for you (like opening a window, handling OS events, defining what an Actor or a Sprite are, etc).

Install it with: pip install pgzero

And then instead of running your file normally via python my_file.py

You should run it with: pgzrun my_file.py


If that doesn't work you can try putting import pgzrun on first line of the program and pgzrun.go() on the last line and then running the file normally with: python my_file.py.

Source for the fixes

ruohola
  • 21,987
  • 6
  • 62
  • 97
  • 1
    Thank you for this. I can confirm that running with pgzrun on the command-line didn't help - but importing pgzrun and using `pgzrun.go()` did. Your assistance is much appreciated! – user3416536 May 06 '19 at 10:39
  • @user3416536 Glad I could help! Feel free to mark this as accepted and upvote it if you feel like it was a valuable answer :) – ruohola May 06 '19 at 10:40
  • 1
    and now you've taught me something else (about use/protocol of stackoverflow) :-) – user3416536 May 07 '19 at 06:58