Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Python module not found despite being installed.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
allan
n00b
n00b


Joined: 24 Feb 2003
Posts: 48
Location: Ann Arbor,Michigan

PostPosted: Sat Oct 12, 2024 11:56 pm    Post subject: Python module not found despite being installed. Reply with quote

I'm trying to install vosk_autosrt ( https://github.com/botbahlul/vosk_autosrt ) to generate subtitles for some videos.

I setup a virtual environment to install it into:

Code:
python -m venv ./vosk_autosrt


Then I activated the environment and run the install command:

Code:
cd vosk_autosrt
source bin/activate
pip install vosk_autosrt


But the install fails with this error:

Code:
Collecting vosk_autosrt
  Using cached vosk_autosrt-0.1.7.tar.gz (21.5 MB)
  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
  ╰─> [26 lines of output]
      /tmp/pip-install-f0jvlqqb/vosk-autosrt_c447e9e93ea64378aefad19f6e233e78/vosk_autosrt/__init__.py:2036: SyntaxWarning: invalid escape sequence '\:'
        scale_switch = "'trunc(iw/2)*2'\:'trunc(ih/2)*2'"
      /tmp/pip-install-f0jvlqqb/vosk-autosrt_c447e9e93ea64378aefad19f6e233e78/vosk_autosrt/__init__.py:2686: SyntaxWarning: invalid escape sequence '\:'
        scale_switch = "'trunc(iw/2)*2'\:'trunc(ih/2)*2'"
      Traceback (most recent call last):
        File "/home/xxxxx/vosk_autosrt/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/xxxxx/vosk_autosrt/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/xxxxx/vosk_autosrt/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-moiix8ly/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 332, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-moiix8ly/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 302, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-moiix8ly/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 503, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-moiix8ly/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 318, in run_setup
          exec(code, locals())
        File "<string>", line 18, in <module>
        File "/tmp/pip-install-f0jvlqqb/vosk-autosrt_c447e9e93ea64378aefad19f6e233e78/vosk_autosrt/__init__.py", line 12, in <module>
          import requests
      ModuleNotFoundError: No module named 'requests'
      [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.



After extensive googling, I verified that I only have one version of python installed (version 3.12), and that the output of pip list shows that the module is installed in the virtual environment.

Code:
Package            Version
------------------ ---------
certifi            2024.8.30
cffi               1.17.1
chardet            5.2.0
charset-normalizer 3.3.2
idna               3.10
pip                24.2
progressbar2       4.5.0
pycparser          2.22
pysrt              1.1.2
python-utils       3.9.0
requests           2.32.3
six                1.16.0
sounddevice        0.5.0
srt                3.5.3
tqdm               4.66.5
typing_extensions  4.12.2
urllib3            2.2.3
vosk               0.3.45
websockets         13.1
wheel              0.44.0


I also tried adding the virtual environment's bin and lib directories to the PATH, which was suggested on a couple of sites, but that didn't help.

Does anyone have any thoughts on how I can resolve this?
Back to top
View user's profile Send private message
kgdrenefort
Guru
Guru


Joined: 19 Sep 2023
Posts: 314
Location: Somewhere in the 77

PostPosted: Sun Oct 13, 2024 7:51 am    Post subject: Reply with quote

Hello,

To me it's the code you install that is deprecated, see this chunk:

Quote:
SyntaxWarning: invalid escape sequence '\:'


For file:
Quote:
/tmp/pip-install-f0jvlqqb/vosk-autosrt_c447e9e93ea64378aefad19f6e233e78/vosk_autosrt/__init__.py:2036


Google result: https://adamj.eu/tech/2022/11/04/why-does-python-deprecationwarning-invalid-escape-sequence/

I'm not dev, but so far I would say this code isn't compatible with Python 3.12.

You could update it, install a version that is compatible with it or look out for another project doing such.

Regards,
GASPARD DE RENEFORT Kévin
_________________
Traduction wiki, pour praticiper.
Custom logos/biz card/website.
Back to top
View user's profile Send private message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 407

PostPosted: Sun Oct 13, 2024 9:03 am    Post subject: Reply with quote

Unlike you, I got the error that audioop is missing. That package actually does not exist.
Besides the README, the package does not seem maintained. Or even used for that matter.
The git history does not inspire confidence in the developer either.
The actual repository contains things like libgcc_s_seh-1.dll and a bunch of other libraries that should either be compiled, or come with your toolchain.
LICENSE says that's an MIT licensed project, except most of it is distributed a git-versioned dynamic library, and not in the format that cpython extension modules are in.

I would not trust that project.
Back to top
View user's profile Send private message
eschwartz
Developer
Developer


Joined: 29 Oct 2023
Posts: 240

PostPosted: Mon Oct 14, 2024 3:31 am    Post subject: Re: Python module not found despite being installed. Reply with quote

allan wrote:

After extensive googling, I verified that I only have one version of python installed (version 3.12), and that the output of pip list shows that the module is installed in the virtual environment.


Note that what you have installed in the virtual environment is totally irrelevant, since pip install will create *another* virtual environment, install more packages into that, and use that to build the project. It then discards that virtual environment, and adds the built copy to the first virtual environment.

This means that the project you tried to install would have to declare "requests" as one of its own build dependencies, which it probably didn't do...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum