(test_pytorch) C:\Users\kuntal chowdhury>python
Python 3.8.3 (default, May 19 2020, 06:50:17) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
import torch
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\kuntal chowdhury\Anaconda3\envs\test_pytorch\lib\site-packages\torch__init__.py", line 81, in
ctypes.CDLL(dll)
File "C:\Users\kuntal chowdhury\Anaconda3\envs\test_pytorch\lib\ctypes__init__.py", line 373, in init
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\Users\kuntal chowdhury\Anaconda3\envs\test_pytorch\lib\site-packages\torch\lib\caffe2_nvrtc.dll' (or one of its dependencies). Try using the full path with constructor syntax.
See this answer here
TL;DR, I suspect you are trying to run torch from an environment that does not have CUDA installed. Thus, you must install the cpu version of torch:
conda install pytorch torchvision cpuonly -c pytorch
Related
I downloaded and installed CUDA10.0 pyhton3.6 pytorch1.2. , also loaded cuda/cuda-10.0-x86_6 envirnment.
Commands like below
module load cuda/cuda-10.0-x86_64
# CUDA 10.0
conda install pytorch==1.2.0 torchvision==0.4.0 cudatoolkit=10.0 -c pytorch
Because it needs to be installed on a NO-NETWOEK centOs server! Therefore, all pakages need be downloaded in advance and run command like below.
conda install --offline pytorch-1.2.0-cuda100py36h938c94c_0.tar.bz2
......
The error occured below.
Python 3.6.0 |Anaconda 4.3.0 (64-bit)| (default, Dec 23 2016, 12:22:00)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/data/users/CHDHPC/2020224009/anaconda3/lib/python3.6/site-packages/torch/__init__.py", line 81, in <module>
from torch._C import *
ImportError: libmkl_gnu_thread.so: cannot open shared object file: No such file or directory
I have no idea to solve it! Anyone can help me! Thank you!!
Finally I fixed this issue by changing Python version to 3.6.2 and re-installing the cuda and cudnn.
Pecfect!
I have some issues with Anaconda3 on windows 10 64bit
Installing version Anaconda3-2019.07-Windows-x86_64 and launching python on the command line (anaconda prompt) the following message appears :
(base) C:\>python
Python 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
It's actually a 64bit version but the message above displays " Anaconda, Inc. on win32". which is strange...
And then, when the ssl module is imported the following error appears :
>>> import ssl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\u00178980\anaconda3\lib\ssl.py", line 98, in <module>
import _ssl # if we can't import it, let the error propagate
ImportError: DLL load failed: %1 not a valid Win32 application.
It seems that there is some mixing out of 64 and 32 bit versions?
Information:
OS: Windows 8.1 64-bit
Python: 3.7.3 64-bit
Anaconda: 64-bit
Agenda:
To make sure python -c "import torch" works without any errors.
Process:
I have created my environment using conda create -n myenv
After which with great difficulty I have further installed conda install pytorch torchvision cudatoolkit -c pytorch
When the above command was executed, it was interrupted midway due to HTTPRequest failure
After several such failures, I have installed pytorch using conda install pytorch -c pytorch
When I type python -c "import torch" I get OSError like the one below
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\sanpj\.conda\envs\myenv\lib\site-packages\torch\__init__.py", line 42, in <module>
import numpy as _np # noqa: F401
File "C:\Users\sanpj\AppData\Roaming\Python\Python37\site-packages\numpy\__init__.py", line 142, in <module>
from . import core
File "C:\Users\sanpj\AppData\Roaming\Python\Python37\site-packages\numpy\core\__init__.py", line 23, in <module>
WinDLL(os.path.abspath(filename))
File "C:\Users\sanpj\.conda\envs\myenv\lib\ctypes\__init__.py", line 356, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
But the output should not be as such.
When I type in python, I get some information as mentioned below
Python 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
Solved it!
Actually, I downgraded to older versions of torch, torchvision & numpy as well.
That actually solved this issue.
After installing pandas am able to import in cmd as below :
C:\Users\me\Desktop\Django_Project>python
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
>>>
But when am importing pandas in Spyder in IPython 6.5.0 console I get below error:
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.
IPython 6.5.0 -- An enhanced Interactive Python.
c:\program files (x86)\python37-32\lib\site-packages\ipykernel\parentpoller.py:116: UserWarning: Parent poll failed. If the frontend dies,
the kernel may be left running. Please let us know
about your system (bitness, Python, etc.) at
ipython-dev#scipy.org
ipython-dev#scipy.org""")
In [1] : import pandas
Traceback (most recent call last):
File "<ipython-input-1-38d4b0363d82>", line 1, in <module>
import pandas
ModuleNotFoundError: No module named 'pandas'
In [2] :
Note: I have installed python in "C:\Users\me\AppData\Local\Programs\Python\Python37\" path and environment variables is set as "C:\Users\me\AppData\Local\Programs\Python\Python37;"
And I installed pandas using PIP
Please suggest the solution to resolve this issue.I have tried reinstalling the pandas package almost 6-7 times.
I think you should open anaconda command prompt by searching it in windows search bar . Now write there "conda install -c anaconda pandas" and try again to run the program
I'm using Python 3.6.4 with pillow 5.0.0, through Anaconda.
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import Image
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "F:\Anaconda2\envs\py3\lib\site-packages\PIL\Image.py", line 58, in <module>
from . import _imaging as core
ImportError: DLL load failed: The specified module could not be found.
Probably the same as this question. But that was 10 months ago and the answer says it was fixed with Python 3.6.1.
If you're using the Anaconda distribution, try removing it with Conda:
conda uninstall pillow
and installing it using pip:
pip install pillow
You can test that it's working:
python -c "from PIL import Image"