'I was unable to install my packages from requirement.txt. I keep getting "no module named 'torch'". Please how do I resolve this

× python setup.py egg_info did not run successfully.

│ exit code: 1

╰─> [10 lines of output]

  Traceback (most recent call last):

    File "<string>", line 36, in <module>

    File "<pip-setuptools-caller>", line 34, in <module>

    File "/tmp/pip-install-s53y6nle/geomloss_b07e3b1a8878419fa7abd2c4614635b8/setup.py", line 14, in <module>

      import geomloss

    File "/tmp/pip-install-s53y6nle/geomloss_b07e3b1a8878419fa7abd2c4614635b8/geomloss/__init__.py", line 5, in <module>

      from .samples_loss import SamplesLoss

    File "/tmp/pip-install-s53y6nle/geomloss_b07e3b1a8878419fa7abd2c4614635b8/geomloss/samples_loss.py", line 1, in <module>

      import torch

  ModuleNotFoundError: No module named 'torch'

  [end of output]


Solution 1:[1]

Do you have torch installed? pip install torch

Solution 2:[2]

The first step is to install the library

pip install torch

check this out

You may need to add torch version to your requirements.txt file.

Is it something you’ve done?

if you did that. You may have entered the wrong version.

I recommend adding a requirements.txt file to your question

If you are using a tool to get app module

They may not work properly sometimes

If you do not mention the module version in requirements.txt, it will install the latest available version

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 GravoLan
Solution 2