Rextein
Rextein

Reputation: 31

Error happend when import torch (pytorch)

Try to use pytorch, when I do

import torch

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-2-eb42ca6e4af3> in <module>
----> 1 import torch

C:\Big_Data_app\Anaconda3\lib\site-packages\torch\__init__.py in <module>
    124                 err = ctypes.WinError(last_error)
    125                 err.strerror += f' Error loading "{dll}" or one of its dependencies.'
--> 126                 raise err
    127             elif res is not None:
    128                 is_loaded = True

OSError: [WinError 182] <no description> Error loading "C:\Big_Data_app\Anaconda3\lib\site-packages\torch\lib\shm.dll" or one of its dependencies.

Not sure what happend.

The truth is, I installed pytorch around the end of last year.(I think) I don't remember how, I installed it because I want try to use it.

But I guess I never used it after I installed. don't remember running some script with pytorch.

And now I start to use it, get this error. Have no clue What I should check first.

That means, I don't know what module, framework, driver, app are related with pytorch.

So I don't know where to beginning, check is there any other module might cause this Error.

If anyone knows how to solve this. Or where to start the problem checking. Please let me know.

Thank you.

My pytorch version is 1.11.0 OS: window 10

Upvotes: 2

Views: 6439

Answers (4)

Wojciech Fornal
Wojciech Fornal

Reputation: 1553

In my case PyTorch broke after playing around with TensorFlow (installing different CPU and CUDA versions). I've just run Anaconda Prompt (with administrative privileges) and ordered Anaconda to update all possible packages by running following command:

conda update --all

After that the problem with PyTorch disappeared.

Upvotes: 3

Amir Zare
Amir Zare

Reputation: 583

My problem was solved by creating a new conda environment and installing PyTorch there. Everything worked perfectly on the first try in the new environment. Reinstalling Anaconda will work too, but this solution is less costly.

Upvotes: 1

Rextein
Rextein

Reputation: 31

I solved the problem. Just reinstall your Anaconda.

!!Warning!!: you will lose your lib.

Referring solution: Problem with Torch 1.11

Upvotes: 1

hac81acnh
hac81acnh

Reputation: 82

The version may not be exactly as same as yours, but maybe this question asked on 2020-09-04 helps.

Upvotes: 0

Related Questions