Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

No module named 'playsound'‏‏‏‏‏‏‏‏‏‏‏‏‏‏‏‏

1,151 views
Skip to first unread message

om om

unread,
Jan 9, 2023, 9:43:14 AM1/9/23
to
I'm installing playsound pip install playsound
but it keeps saying No module named playsound
and this error occurs on other packages

MRAB

unread,
Jan 9, 2023, 10:29:19 AM1/9/23
to
What are you typing on the command line? Which operating system are you
using?

Please copy and post what you're typing (with the command prompt) and
the complete error message.

Thomas Passin

unread,
Jan 9, 2023, 10:40:52 AM1/9/23
to
On 1/9/2023 9:40 AM, om om wrote:
> I'm installing playsound pip install playsound
> but it keeps saying No module named playsound
> and this error occurs on other packages

Did the installation by pip succeed? if not, what was the error message?

"It keeps saying ...". What keeps saying that (it's not a standard error
message from pip)? What is the code or command that causes this error
message?

You would get such a message if you tried to import a package but it had
not been installed. If you used pip to install a package and it
succeeded but you could not import the package (or module), the most
likely reason is that it got installed by a different version of python
than the one that used pip to install it. You may have several
different versions of Python on your computer.

You can check versions by running

pip -V

Then use the command you normally use to run Python (i.e., python3, py,
etc.) and run

py_x -m pip -V

(don't type "py_x", use the command name you normally use to run python)

If the two outputs are different, then you will know for sure that your
packages got installed to a different version of Python. Re-install
them using "python -m pip install" instead of "pip install" - again,
make sure that you use the actual name for the python command that you
normally use.

Mats Wichmann

unread,
Jan 9, 2023, 11:59:39 AM1/9/23
to
On 1/9/23 08:30, Thomas Passin wrote:
> On 1/9/2023 9:40 AM, om om wrote:
>> I'm installing playsound pip install playsound
>> but it keeps saying No module named playsound
>> and this error occurs on other packages
>
> Did the installation by pip succeed? if not, what was the error message?
>
> "It keeps saying ...". What keeps saying that (it's not a standard error
> message from pip)? What is the code or command that causes this error
> message?
>
> You would get such a message if you tried to import a package but it had
> not been installed.  If you used pip to install a package and it
> succeeded but you could not import the package (or module), the most
> likely reason is that it got installed by a different version of python
> than the one that used pip to install it.  You may have several
> different versions of Python on your computer.
>
> You can check versions by running
>
> pip -V

As described in this reply, but to be more explicit: if a package
installed wtihout error, and then you can't import it in Python, it's
basically always a path problem.

Invoking pip the same way as you did to install, do:

pip show playsound

This will tell you where it put it. If that's not a place your Python is
looking, it won't find it.

Thomas Passin

unread,
Jan 9, 2023, 1:28:37 PM1/9/23
to

I wrote

>> "the most likely reason is that it got installed by a different
>> version of python than the one that used pip to install it."

That's not quite what I meant to say. Better:

"the most likely reason is that you are trying to import it using a
different version of python than the one that used pip to install it."


MRAB

unread,
Jan 9, 2023, 2:10:54 PM1/9/23
to
On 2023-01-09 17:11, Thomas Passin wrote:
>
> I wrote
>
>>> "the most likely reason is that it got installed by a different
>>> version of python than the one that used pip to install it."
>
> That's not quite what I meant to say. Better:
>
> "the most likely reason is that you are trying to import it using a
> different version of python than the one that used pip to install it."
>
On Windows it's best to use pip via the Python Launcher:

py -m pip show playsound

Eryk Sun

unread,
Jan 9, 2023, 3:00:25 PM1/9/23
to
On 1/9/23, MRAB <pyt...@mrabarnett.plus.com> wrote:
>
> On Windows it's best to use pip via the Python Launcher:
>
> py -m pip show playsound

Python's app distribution on the Microsoft Store doesn't include the
py launcher, and we don't (but should) have a standalone app or
desktop version of the launcher. Unlike the desktop distribution,
however, the app distribution installs a versioned name as a link,
such as "python3.11". (Note that a venv virtual environment only has a
"python" command on Windows.)

If "pip" is in PATH, a versioned name such as "pip3.11" should also be
available. If multiple versions of the app distribution are installed,
and for some reason the "python" and "pip" links are mapped to
different versions, one can match up the versioned names "pip3.11" and
"python3.11" to ensure consistency. Or simply run "python -m pip".

Thomas Passin

unread,
Jan 9, 2023, 4:22:19 PM1/9/23
to
On 1/9/2023 2:10 PM, MRAB wrote:
> On Windows it's best to use pip via the Python Launcher:
>
> py -m pip show playsound

Sure - I just didn't want to complicate the post any more, though I did
mention it in passing. py is definitely the best way. I wonder how
many people know that py can launch other versions of Python too?

Thomas Passin

unread,
Jan 9, 2023, 5:42:02 PM1/9/23
to
On 1/9/2023 3:00 PM, Eryk Sun wrote:
> On 1/9/23, MRAB <pyt...@mrabarnett.plus.com> wrote:
>>
>> On Windows it's best to use pip via the Python Launcher:
>>
>> py -m pip show playsound
>
> Python's app distribution on the Microsoft Store doesn't include the
> py launcher, and we don't (but should) have a standalone app or
> desktop version of the launcher. Unlike the desktop distribution,
> however, the app distribution installs a versioned name as a link,
> such as "python3.11". (Note that a venv virtual environment only has a
> "python" command on Windows.)
>
> If "pip" is in PATH, a versioned name such as "pip3.11" should also be
> available. If multiple versions of the app distribution are installed,
> and for some reason the "python" and "pip" links are mapped to
> different versions, one can match up the versioned names "pip3.11" and
> "python3.11" to ensure consistency. Or simply run "python -m pip".

It better be "pythonx.xx -m pip", though!

0 new messages