NeMo won't install, no module named torch
State: open | Pull request: no
Labels: name: bug

**Describe the bug**

Hello! I performed the following list of commands to install NeMo:

```
python -m venv .venv
.venv/bin/python --version
>> Python 3.12.3
.venv/bin/python -m pip install torch torchvision torchaudio Cython packaging
.venv/bin/python -m pip install nemo_toolkit['all']
```

The last command output:

```
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      Traceback (most recent call last):
        File "/home/oleg/yodas_conversion/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/oleg/yodas_conversion/.venv/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/oleg/yodas_conversion/.venv/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-3uiwo19z/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 334, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-3uiwo19z/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 304, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-3uiwo19z/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 522, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-3uiwo19z/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 320, in run_setup
          exec(code, locals())
        File "<string>", line 19, in <module>
      ModuleNotFoundError: No module named 'torch'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
```

For me the error is confusing since torch is installed. Any ideas of how to fix of debug this problem?

**Environment overview (please complete the following information)**

Ubuntu 24.04, CUDA 12.4

When I download the latest NeMo container from [here](https://catalog.ngc.nvidia.com/orgs/nvidia/containers/nemo/tags):
```bash
docker pull nvcr.io/nvidia/nemo:24.12
```

I see a version of Python of 3.10.12, rather than 3.12.3. There may be a compatibility issue with the later version of Python.

When I use the [PyTorch Configurator](https://pytorch.org/get-started/locally/), and select Stable (2.5.1), Linux, Pip, Python, and CUDA 12.4, this is the command to run:
```bash
pip3 install torch torchvision torchaudio
```

When I then run 
```bash
pip3 install nemo_toolkit['all']
```

I don't seem to run into the errors you stated, but I do run into other errors when it comes to a requirement of the mamba, fasttext and texterrors modules. The end of my error shows this:
```plaintext
Successfully built mamba-ssm progress clip jieba kaldi-python-io pesq rouge-score sox wget distance docopt intervaltree asciitree cdifflib
Failed to build fasttext texterrors
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (fasttext, texterrors)
``` 

For now, I would suggest just using the Docker container if you can. Here are NVIDIA's instructions: https://docs.nvidia.com/nemo-framework/user-guide/latest/installation.html.

My summary:
1. Pull the docker container (takes about 10 min):
```bash
docker pull nvcr.io/nvidia/nemo:24.12
```

2. Get the docker image ID
```bash
docker images
```
```plaintext
REPOSITORY            TAG       IMAGE ID       CREATED       SIZE
nvcr.io/nvidia/nemo   24.12     684e6b41c9d2   12 days ago   88.8GB
```

3. Run the docker container interactively to test nemo inside:
```bash
docker run -it --gpus all <docker_image_id> /bin/bash
```


I am running on WSL Ubuntu-22.04 and CUDA 12.4.