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...
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 #
 
Back
Top