paperswithcode / galai

Model API for GALACTICA
Apache License 2.0
2.68k stars 276 forks source link

Failed to load PyTorch C extensions: #43

Closed ivi-42 closed 1 year ago

ivi-42 commented 1 year ago

raceback (most recent call last): File "C:\Users\user\PycharmProjects\pythonProject19\HOF.py", line 1, in import galai as gal File "C:\Users\user\PycharmProjects\pythonProject19\venv\lib\site-packages\galai__init.py", line 1, in from galai.model import Model File "C:\Users\user\PycharmProjects\pythonProject19\venv\lib\site-packages\galai\model.py", line 2, in import torch File "C:\Users\user\PycharmProjects\pythonProject19\venv\lib\site-packages\torch\init__.py", line 209, in raise ImportError(textwrap.dedent(''' ImportError: Failed to load PyTorch C extensions: It appears that PyTorch has loaded the torch/_C folder of the PyTorch repository rather than the C extensions which are expected in the torch._C namespace. This can occur when using the install workflow. e.g. $ python setup.py install && python -c "import torch"

This error can generally be solved using the `develop` workflow
    $ python setup.py develop && python -c "import torch"  # This should succeed
or by running Python from a different directory.

I get this problem eheh, what should I do? Sorry for my incompetence 
mkardas commented 1 year ago

It seems that either your pytorch installation is broken or that you're running python from the same directory where you downloaded pytorch's source code.

  1. can you check if your pytorch works correctly by running python -c "import torch"?
  2. can you make sure there's no directory named torch in the directory you run your python from?
Han-2002 commented 4 weeks ago

It seems that either your pytorch installation is broken or that you're running python from the same directory where you downloaded pytorch's source code.

  1. can you check if your pytorch works correctly by running python -c "import torch"?
  2. can you make sure there's no directory named torch in the directory you run your python from?

sir,I have a same problem,and I have checked the 1.can.. Now,the cansole shows that Traceback (most recent call last): File "", line 1, in File "/home/cxt/miniconda3/envs/chess_env/lib/pypy3.9/site-packages/torch/init.py", line 519, in raise ImportError(textwrap.dedent(''' ImportError: Failed to load PyTorch C extensions: It appears that PyTorch has loaded the torch/_C folder of the PyTorch repository rather than the C extensions which are expected in the torch._C namespace. This can occur when using the install workflow. e.g. $ python setup.py install && python -c "import torch"

This error can generally be solved using the `develop` workflow
    $ python setup.py develop && python -c "import torch"  # This should succeed
or by running Python from a different directory.