Python Two versions of Python at the same time and problems with PyTorch.

Colleagues, I have a rather complicated and confusing problem related to the Python language. We are not very familiar with Python yet, although I am trying to deepen my friendship with this evergreen creeping thing consisting of a head and a tail.
I have a test computer with FreeBSD 14.3. Naturally, Python version 3.11 is installed there and I do not want to change it in order to stay in the main flow.

I want to install and study the library for speech synthesis SpeakerPy. https://github.com/denisxab/speakerpy
(Why this one? There are reasons for that. Please do not start a discussion about replacing it with another one.)
Everyone says that the library synthesizes speech well. But there are problems.
Firstly, the library is documented in Russian. However, Google Translate translates everything well.
Secondly, the library is designed for Python versions up to and including 3.10. It does not want to be installed on 3.11.

I installed 3.10 at the same time as 3.11, installed venv and activated the project environment.
Next, I tried to install pytorch. It didn't work.

Code:
ogogon@devel:~# pip3.10 install pytorch
Collecting pytorch
  Using cached pytorch-1.0.2.tar.gz (689 bytes)
  Preparing metadata (setup.py) ... done
Installing collected packages: pytorch
  DEPRECATION: pytorch is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for pytorch ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for pytorch did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-9ffo3s40/pytorch_3360539b711a4397bbd5ffde88e2f555/setup.py", line 11, in <module>
          raise Exception(message)
      Exception: You tried to install "pytorch". The package named for PyTorch is "torch"
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pytorch

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
WARNING: There was an error checking the latest version of pip.
ogogon@devel:~#

What am I doing wrong?

Ogogon.
 
Code:
ogogon@devel:~# pip3.10 install pytorch
This doesn't look like your venv is active. And the whole point of using a venv is that you don't need to do this as root.

Code:
dice@fbsd-test:~ % python3.10 -m venv mytest
dice@fbsd-test:~ % cd mytest/
dice@fbsd-test:~/mytest % ll
total 11
drwxr-xr-x  2 dice dice 12 Aug  8 09:54 bin/
drwxr-xr-x  2 dice dice  2 Aug  8 09:54 include/
drwxr-xr-x  3 dice dice  3 Aug  8 09:54 lib/
lrwxr-xr-x  1 dice dice  3 Aug  8 09:54 lib64@ -> lib
-rw-r--r--  1 dice dice 77 Aug  8 09:54 pyvenv.cfg
dice@fbsd-test:~/mytest % source bin/activate.csh
(mytest) dice@fbsd-test:~/mytest % python -V
Python 3.10.18
(mytest) dice@fbsd-test:~/mytest % pip list
Package    Version
---------- -------
pip        23.0.1
setuptools 65.5.0

[notice] A new release of pip is available: 23.0.1 -> 25.2
[notice] To update, run: pip install --upgrade pip
Notice how the prompt changes when I activated the venv? Keep in mind that you need to source the activation script, not run it.
 
This doesn't look like your venv is active. And the whole point of using a venv is that you don't need to do this as root.

Code:
dice@fbsd-test:~ % python3.10 -m venv mytest
dice@fbsd-test:~ % cd mytest/
dice@fbsd-test:~/mytest % ll
total 11
drwxr-xr-x  2 dice dice 12 Aug  8 09:54 bin/
drwxr-xr-x  2 dice dice  2 Aug  8 09:54 include/
drwxr-xr-x  3 dice dice  3 Aug  8 09:54 lib/
lrwxr-xr-x  1 dice dice  3 Aug  8 09:54 lib64@ -> lib
-rw-r--r--  1 dice dice 77 Aug  8 09:54 pyvenv.cfg
dice@fbsd-test:~/mytest % source bin/activate.csh
(mytest) dice@fbsd-test:~/mytest % python -V
Python 3.10.18
(mytest) dice@fbsd-test:~/mytest % pip list
Package    Version
---------- -------
pip        23.0.1
setuptools 65.5.0

[notice] A new release of pip is available: 23.0.1 -> 25.2
[notice] To update, run: pip install --upgrade pip
Notice how the prompt changes when I activated the venv? Keep in mind that you need to source the activation script, not run it.
Unfortunately, something didn't work out for me...
Code:
root@devel:~ # cd speakerpy_project/
root@devel:~/speakerpy_project # source bin/activate.csh
(speakerpy_project) root@devel:~/speakerpy_project #  python -V
Python 3.10.18
(speakerpy_project) root@devel:~/speakerpy_project # pip list
Package    Version
---------- -------
pip        23.0.1
setuptools 65.5.0

[notice] A new release of pip is available: 23.0.1 -> 25.2
[notice] To update, run: pip install --upgrade pip
(speakerpy_project) root@devel:~/speakerpy_project # pip3.10 list
Package    Version
---------- -------
pip        23.0.1
setuptools 65.5.0

[notice] A new release of pip is available: 23.0.1 -> 25.2
[notice] To update, run: pip install --upgrade pip
(speakerpy_project) root@devel:~/speakerpy_project # pip3.10 install pytorch
Collecting pytorch
  Using cached pytorch-1.0.2.tar.gz (689 bytes)
  Preparing metadata (setup.py) ... done
Installing collected packages: pytorch
  DEPRECATION: pytorch is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for pytorch ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for pytorch did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-4p0y5938/pytorch_ff7ec733ae894fe9aa2893f4019c7717/setup.py", line 11, in <module>
          raise Exception(message)
      Exception: You tried to install "pytorch". The package named for PyTorch is "torch"
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pytorch

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

[notice] A new release of pip is available: 23.0.1 -> 25.2
[notice] To update, run: pip install --upgrade pip
(speakerpy_project) root@devel:~/speakerpy_project # pip3.10 install --use-pep517 pytorch
Collecting pytorch
  Using cached pytorch-1.0.2.tar.gz (689 bytes)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pytorch
  Building wheel for pytorch (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for pytorch (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [19 lines of output]
      Traceback (most recent call last):
        File "/root/speakerpy_project/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/root/speakerpy_project/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/root/speakerpy_project/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "/tmp/pip-build-env-m0xtniq9/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 435, in build_wheel
          return _build(['bdist_wheel', '--dist-info-dir', str(metadata_directory)])
        File "/tmp/pip-build-env-m0xtniq9/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 423, in _build
          return self._build_with_temp_dir(
        File "/tmp/pip-build-env-m0xtniq9/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 404, in _build_with_temp_dir
          self.run_setup()
        File "/tmp/pip-build-env-m0xtniq9/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 512, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-m0xtniq9/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 317, in run_setup
          exec(code, locals())
        File "<string>", line 15, in <module>
      Exception: You tried to install "pytorch". The package named for PyTorch is "torch"
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pytorch
Failed to build pytorch
ERROR: Could not build wheels for pytorch, which is required to install pyproject.toml-based projects

[notice] A new release of pip is available: 23.0.1 -> 25.2
[notice] To update, run: pip install --upgrade pip
(speakerpy_project) root@devel:~/speakerpy_project #
 
Last edited by a moderator:
#1: Im not sure but now you can use uv - i think its "new" pip in rust. I think you can have it with python 3.11 .
#2: pip install torch / if you are in venv if not you can try pip install --user torch .. See - not pytorch but torch.
#3: find out what torch version you need as im looking at the code
Code:
[tool.poetry.dependencies]
python = "^3.10"
silero = "^0.4.1"
sounddevice = "^0.4.6"
num2words = "^0.5.12"
transliterate = "^1.10.2"
soundfile = "^0.12.1"
pydub = "^0.25.1"
tqdm = "^4.65.0"
nltk = "^3.8.1"
numpy = "^1.24.2"
dont see any requirements for torch or even listed.
Have you tried to create python 3.10 venv and use pip install speakerpy ?
I can read russian language and i dont see anywhere torch needed nor requirements.txt file in repo.
Reading from PyTorch website this is the command to install PyTorch with CPU
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cpu
So you just try to change pip3 to pip as these commands are for linux.
 
dont see any requirements for torch or even listed.
Have you tried to create python 3.10 venv and use pip install speakerpy ?
Just in case, I will quote this sad story in full.
Code:
root@devel:~ # cd speakerpy_project/
root@devel:~/speakerpy_project # ls
bin        include        lib        lib64        pyvenv.cfg    speakerpy_venv
root@devel:~/speakerpy_project # source bin/activate.csh
(speakerpy_project) root@devel:~/speakerpy_project # python -V
Python 3.10.18
(speakerpy_project) root@devel:~/speakerpy_project # pip install speakerpy
Collecting speakerpy
 Downloading speakerpy-0.1.2-py3-none-any.whl (161 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 161.4/161.4 kB 1.7 MB/s eta 0:00:00
Collecting transliterate<2.0.0,>=1.10.2
 Downloading transliterate-1.10.2-py2.py3-none-any.whl (45 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 45.8/45.8 kB 1.8 MB/s eta 0:00:00
Collecting num2words<0.6.0,>=0.5.12
 Downloading num2words-0.5.14-py3-none-any.whl (163 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 163.5/163.5 kB 3.4 MB/s eta 0:00:00
Collecting numpy<2.0.0,>=1.24.2
 Downloading numpy-1.26.4.tar.gz (15.8 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 15.8/15.8 MB 6.7 MB/s eta 0:00:00
 Installing build dependencies ... done
 Getting requirements to build wheel ... done
 Preparing metadata (pyproject.toml) ... done
Collecting pydub<0.26.0,>=0.25.1
 Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB)
Collecting silero<0.5.0,>=0.4.1
 Downloading silero-0.4.1-py3-none-any.whl (20 kB)
Collecting soundfile<0.13.0,>=0.12.1
 Downloading soundfile-0.12.1-py2.py3-none-any.whl (24 kB)
Collecting nltk<4.0.0,>=3.8.1
 Downloading nltk-3.9.1-py3-none-any.whl (1.5 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 4.8 MB/s eta 0:00:00
Collecting tqdm<5.0.0,>=4.65.0
 Downloading tqdm-4.67.1-py3-none-any.whl (78 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.5/78.5 kB 2.6 MB/s eta 0:00:00
Collecting sounddevice<0.5.0,>=0.4.6
 Downloading sounddevice-0.4.7-py3-none-any.whl (32 kB)
Collecting click
 Downloading click-8.2.1-py3-none-any.whl (102 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 102.2/102.2 kB 4.2 MB/s eta 0:00:00
Collecting joblib
 Downloading joblib-1.5.1-py3-none-any.whl (307 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 307.7/307.7 kB 4.5 MB/s eta 0:00:00
Collecting regex>=2021.8.3
 Downloading regex-2025.7.34.tar.gz (400 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 400.7/400.7 kB 2.7 MB/s eta 0:00:00
 Installing build dependencies ... done
 Getting requirements to build wheel ... done
 Preparing metadata (pyproject.toml) ... done
Collecting docopt>=0.6.2
 Downloading docopt-0.6.2.tar.gz (25 kB)
 Preparing metadata (setup.py) ... done
INFO: pip is looking at multiple versions of pydub to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of numpy to determine which version is compatible with other requirements. This could take a while.
Collecting numpy<2.0.0,>=1.24.2
 Downloading numpy-1.26.3.tar.gz (15.7 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 15.7/15.7 MB 7.1 MB/s eta 0:00:00
 Installing build dependencies ... done
 Getting requirements to build wheel ... done
 Preparing metadata (pyproject.toml) ... done
INFO: pip is looking at multiple versions of num2words to determine which version is compatible with other requirements. This could take a while.
Collecting num2words<0.6.0,>=0.5.12
 Downloading num2words-0.5.13-py3-none-any.whl (143 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.3/143.3 kB 1.2 MB/s eta 0:00:00
INFO: pip is looking at multiple versions of nltk to determine which version is compatible with other requirements. This could take a while.
Collecting nltk<4.0.0,>=3.8.1
 Downloading nltk-3.9-py3-none-any.whl (1.5 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 4.1 MB/s eta 0:00:00
INFO: pip is looking at multiple versions of <Python from Requires-Python> to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of speakerpy to determine which version is compatible with other requirements. This could take a while.
Collecting speakerpy
 Downloading speakerpy-0.1.1-py3-none-any.whl (161 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 161.2/161.2 kB 3.8 MB/s eta 0:00:00
 Downloading speakerpy-0.1.0-py3-none-any.whl (11 kB)
ERROR: Ignored the following versions that require a different python version: 2.3.0 Requires-Python >=3.11; 2.3.1 Requires-Python >=3.11; 2.3.2 Requires-Python >=3.11
ERROR: Could not find a version that satisfies the requirement torch>=1.10.0 (from silero) (from versions: none)
ERROR: No matching distribution found for torch>=1.10.0

[notice] A new release of pip is available: 23.0.1 -> 25.2
[notice] To update, run: pip install --upgrade pip
(speakerpy_project) root@devel:~/speakerpy_project # pip install torch
ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
ERROR: No matching distribution found for torch

[notice] A new release of pip is available: 23.0.1 -> 25.2
[notice] To update, run: pip install --upgrade pip
(speakerpy_project) root@devel:~/speakerpy_project #

I don't understand anything. Now he wants 3.11 and more? On Friday he himself refused to install on these versions of Python. Is this the mysterious Russian soul?
However, he definitely requires torch as a necessary component.

I can read russian language and i dont see anywhere torch needed nor requirements.txt file in repo.
Reading from PyTorch website this is the command to install PyTorch with CPU
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cpu
Code:
(speakerpy_project) root@devel:~/speakerpy_project # pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cpu
Looking in indexes: https://download.pytorch.org/whl/cpu
ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
ERROR: No matching distribution found for torch

[notice] A new release of pip is available: 23.0.1 -> 25.2
[notice] To update, run: pip install --upgrade pip
(speakerpy_project) root@devel:~/speakerpy_project #
 
I just created quickly 3.11 environment. got error
Code:
     󱂵                                                                      󱑃  09:09    python v3.11.13 testas 2s 
   pip install speakerpy
Collecting speakerpy
  Downloading speakerpy-0.1.2-py3-none-any.whl.metadata (14 kB)
Collecting regex>=2021.8.3 (from nltk<4.0.0,>=3.8.1->speakerpy)
  Downloading regex-2025.7.34.tar.gz (400 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 400.7/400.7 kB 5.5 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting docopt>=0.6.2 (from num2words<0.6.0,>=0.5.12->speakerpy)
  Downloading docopt-0.6.2.tar.gz (25 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
INFO: pip is looking at multiple versions of silero to determine which version is compatible with other requirements. This could take a while.
Collecting speakerpy
  Downloading speakerpy-0.1.1-py3-none-any.whl.metadata (13 kB)
  Downloading speakerpy-0.1.0-py3-none-any.whl.metadata (13 kB)
ERROR: Ignored the following versions that require a different python version: 1.21.2 Requires-Python >=3.7,<3.11; 1.21.3 Requires-Python >=3.7,<3.11; 1.21.4 Requires-Python >=3.7,<3.11; 1.21.5 Requires-Python >=3.7,<3.11; 1.21.6 Requires-Python >=3.7,<3.11
ERROR: Could not find a version that satisfies the requirement torch>=1.10.0 (from silero) (from versions: none)
ERROR: No matching distribution found for torch>=1.10.0

[notice] A new release of pip is available: 24.0 -> 25.2
[notice] To update, run: pip install --upgrade pip
PIP
Code:
pip install torch==1.10.0
ERROR: Could not find a version that satisfies the requirement torch==1.10.0 (from versions: none)
ERROR: No matching distribution found for torch==1.10.0

[notice] A new release of pip is available: 24.0 -> 25.2
[notice] To update, run: pip install --upgrade pip

pip install torch
ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
ERROR: No matching distribution found for torch

New Python tool UV
Code:
uv tool install torch
  × No solution found when resolving dependencies:
  ╰─▶ Because only the following versions of torch are available:
          torch==1.0.0
          torch==1.0.1
          torch==1.1.0
          torch==1.2.0
          torch==1.3.0
          torch==1.3.1
          torch==1.4.0
          torch==1.5.0
          torch==1.5.1
          torch==1.6.0
          torch==1.7.0
          torch==1.7.1
          torch==1.8.0
          torch==1.8.1
          torch==1.9.0
          torch==1.9.1
          torch==1.10.0
          torch==1.10.1
          torch==1.10.2
          torch==1.11.0
          torch==1.12.0
          torch==1.12.1
          torch==1.13.0
          torch==1.13.1
          torch==2.0.0
          torch==2.0.1
          torch==2.1.0
          torch==2.1.1
          torch==2.1.2
          torch==2.2.0
          torch==2.2.1
          torch==2.2.2
          torch==2.3.0
          torch==2.3.1
          torch==2.4.0
          torch==2.4.1
          torch==2.5.0
          torch==2.5.1
          torch==2.6.0
          torch==2.7.0
          torch==2.7.1
          torch==2.8.0
      and torch<=1.12.1 has no wheels with a matching Python ABI tag (e.g., `cp311`), we can conclude that torch<=1.12.1
      cannot be used.
      And because torch>=1.13.0 has no wheels with a matching platform tag (e.g., `freebsd_14_2_RELEASE_x86_64`) and you
      require torch, we can conclude that your requirements are unsatisfiable.

      hint: You require CPython 3.11 (`cp311`), but we only found wheels for `torch` (v1.12.1) with the following Python
      ABI tags: `cp37m`, `cp38`, `cp39`, `cp310`

      hint: Wheels are available for `torch` (v2.8.0) on the following platforms: `manylinux_2_28_aarch64`,
      `manylinux_2_28_x86_64`, `macosx_11_0_arm64`, `win_amd64`
As you can see :
Code:
      And because torch>=1.13.0 has no wheels with a matching platform tag (e.g., `freebsd_14_2_RELEASE_x86_64`) and you
      require torch, we can conclude that your requirements are unsatisfiable.

      hint: You require CPython 3.11 (`cp311`), but we only found wheels for `torch` (v1.12.1) with the following Python
      ABI tags: `cp37m`, `cp38`, `cp39`, `cp310`

I would try this:
Create python 3.10 environment , pip install torch==1.12.1 , and then try again pip install speakerpy
Or just try pip install speakerpy - but everything in python 3.10 environment.
Have a look if there is pip for 3.10 as i dont know much with pip`s etc. but if you have 3.10 environment and activated PIP will use python 3.10 as its core.

Your error for 3.11
These requirements i think its not for speakerpy but for torch. and torch is a dependency for something there.
 
Back
Top