Open rogit85 opened 1 year ago
As playsound is nowhere in your stacktrace, I’d assume this issue has to do with either your Python installation or pip, not playsound.TaylorOn May 1, 2023, at 07:14, rogit85 @.> wrote:
Hello, I'm trying to install playsound on my mac running Python 3.9 and getting the following error. Any suggestions how to fix?
@. ~ % pip install playsound
Collecting playsound
Using cached playsound-1.3.0.tar.gz (7.7 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [29 lines of output]
Traceback (most recent call last):
File "/Users/chrisrogers/.pyenv/versions/3.11.3/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in
note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>
I found something interesting in setup.py
.
https://github.com/TaylorSMarks/playsound/blob/9cf4af20caa5ae8586f88b65659681b24f0c4e69/setup.py#L6
This doesn't work the way you think it does. getsource()
will return the relevant source code of the given object. In this case, here = abspath(dirname(getsource(lambda:0)))
. When passed to dirname()
, it returns an empty string, which when passed to abspath()
, it will always return the current directory.
Unfortunately, getsource()
breaks when it isn't in a file (pip runs exec
when building wheels).
To demonstrate, see the following snippet. When you run via cat | python
or python -c "$(cat)"
, it breaks completely. The error it creates looks very familiar.
from inspect import getsource
src = getsource(lambda: 0)
print(src)
$ python < script.py
$ python -c "$(cat script.py)"
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
File "/usr/lib/python3.10/inspect.py", line 1147, in getsource
lines, lnum = getsourcelines(object)
File "/usr/lib/python3.10/inspect.py", line 1129, in getsourcelines
lines, lnum = findsource(object)
File "/usr/lib/python3.10/inspect.py", line 958, in findsource
raise OSError('could not get source code')
OSError: could not get source code
Have a look at https://github.com/TaylorSMarks/playsound/issues/145 !
Hello, I'm trying to install playsound on my mac running Python 3.9 and getting the following error. Any suggestions how to fix?