run-llama / llama_index

LlamaIndex is a data framework for your LLM applications
https://docs.llamaindex.ai
MIT License
35.47k stars 5.01k forks source link

[Bug]: showing errro during import of torch package in python jupyter notebook: verison of torch installed is 2.4.0..and i had also tried for the command "!pip install --upgrade torch", bt still showing the error #15799

Open alishashajahan opened 2 weeks ago

alishashajahan commented 2 weeks ago

Bug Description


OSError Traceback (most recent call last) Cell In[16], line 1 ----> 1 import torch

File ~\anaconda3\Lib\site-packages\torch__init__.py:148 146 err = ctypes.WinError(ctypes.get_last_error()) 147 err.strerror += f' Error loading "{dll}" or one of its dependencies.' --> 148 raise err 150 kernel32.SetErrorMode(prev_error_mode) 153 def _preload_cuda_deps(lib_folder, lib_name):

OSError: [WinError 126] The specified module could not be found. Error loading "C:\Users\D E L L\anaconda3\Lib\site-packages\torch\lib\fbgemm.dll" or one of its dependencies.

Version

0.11.1

Steps to Reproduce

import torch after installig torch for the version of the torch is 2.4.0

Relevant Logs/Tracbacks

No response

dosubot[bot] commented 2 weeks ago

The error you're encountering, OSError: [WinError 126] The specified module could not be found, typically indicates that a required DLL file is missing or not found in the expected location. Here are some steps to troubleshoot and resolve this issue:

  1. Ensure All Dependencies are Installed: Make sure that all dependencies required by PyTorch are installed. You can do this by running:

    conda install mkl mkl-include
  2. Reinstall PyTorch: Sometimes, reinstalling PyTorch can resolve missing dependency issues. Run the following commands in your Anaconda Prompt:

    pip uninstall torch
    pip cache purge
    pip install torch
  3. Check for Conflicting Libraries: Ensure there are no conflicting versions of libraries. You can create a new conda environment and install PyTorch there to avoid conflicts:

    conda create -n new_env python=3.9
    conda activate new_env
    pip install torch
  4. Update Anaconda and Conda: Make sure your Anaconda and Conda are up to date:

    conda update conda
    conda update anaconda
  5. Set Environment Variables: For Windows users, setting specific environment variables can help resolve such issues. Open Anaconda Prompt and set the following:

    set CONDA_DLL_SEARCH_MODIFICATION_ENABLE=1
  6. Verify DLL Files: Ensure that the fbgemm.dll file exists in the torch\lib directory. If it is missing, reinstalling PyTorch should typically resolve this.

If the issue persists after trying these steps, you might want to check the PyTorch installation guide for any additional platform-specific instructions.

To continue talking to Dosu, mention @dosu.