FujiwaraChoki / MoneyPrinter

Automate Creation of YouTube Shorts using MoviePy.
MIT License
10.07k stars 1.35k forks source link

[BUG] playsound installation still failed after FAQ hint #253

Closed NalaGinrut closed 3 months ago

NalaGinrut commented 3 months ago

Describe the bug The playsound installation still failed after FAQ hint.

System info

To Reproduce Assuming the virtualenv process prepared successfully.

pip install -r requirements.txt

Error log

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
  ╰─> [28 lines of output]
      Traceback (most recent call last):
        File "/home/ubuntu/Project/MoneyPrinter/.local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/ubuntu/Project/MoneyPrinter/.local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/ubuntu/Project/MoneyPrinter/.local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-3ip_es08/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-3ip_es08/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-3ip_es08/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 487, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-3ip_es08/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 6, in <module>
        File "/usr/lib/python3.12/inspect.py", line 1278, in getsource
          lines, lnum = getsourcelines(object)
                        ^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.12/inspect.py", line 1260, in getsourcelines
          lines, lnum = findsource(object)
                        ^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.12/inspect.py", line 1089, in findsource
          raise OSError('could not get source code')
      OSError: could not get source code
      [end of output]

  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.

The FAQ hint doesn't work In FAQ, it's hinted:

pip install -U wheel
pip install -U playsound

However, it doesn't solve the issue. It throws the same failure.

Thanks!

FujiwaraChoki commented 3 months ago

You're probably using the wrong interpreter. Try using python -m pip {...} instead of just pip {...}.

FujiwaraChoki commented 3 months ago

If that doesn't work either, try deleting the venv folder, re-initializing it, then running pip install -U wheel first, and then install all other requirements.

NalaGinrut commented 3 months ago

I've tried python -m pip ... and remove venv then re-initializing, however, it still doesn't work.

TheBinaryGuy commented 3 months ago

This is what worked for me: https://github.com/TaylorSMarks/playsound/issues/150#issuecomment-1943173094

NalaGinrut commented 3 months ago

Thank you for all the helps! The issue was solved by python3 -m pip install wheel playsound The point is that one must make sure to upgrade the pacakage with the python in virtualenv dir.

And this part is necessary for me:

    python3 -m pip install --upgrade pip && \
    python3 -m pip install setuptools wheel && \
    python3 -m pip install --upgrade setuptools wheel && \
    python3 -m venv .venv && . .venv/bin/activate && \
    pip install -r requirements.txt
FujiwaraChoki commented 3 months ago

I thought you'd already tried that.. Well, whatever, glad it worked for you.