pytorch PIP and CONDA error?

2019-07-23 09:10发布

问题:

Guys I am new to python and deeplearning world

I tried to install pytorch using conda

I get this Error...

(base) C:\WINDOWS\system32>conda install pytorch

`Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  • pytorch

Current channels:

  • https://repo.continuum.io/pkgs/main/win-64
  • https://repo.continuum.io/pkgs/main/noarch
  • https://repo.continuum.io/pkgs/free/win-64

    Couldnt post all the channels due to reputation issue on stackoverflow...

Trying Pip for installing Pytorch It just opens pytorch site after this error:

(base) C:\WINDOWS\system32>pip install pytorch Collecting pytorch Using cached pytorch-0.1.2.tar.gz Building wheels for collected packages: pytorch Running setup.py bdist_wheel for pytorch ... error Complete output from command C:\ProgramData\Anaconda3\python.exe -u -c "import setuptools, tokenize;file='C:\Users\micha\AppData\Local\Temp\pip-build-t86penrg\pytorch\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d C:\Users\micha\AppData\Local\Temp\tmpqmo4j08upip-wheel- --python-tag cp36: Traceback (most recent call last): File "", line 1, in File "C:\Users\micha\AppData\Local\Temp\pip-build-t86penrg\pytorch\setup.py", line 17, in raise Exception(message) Exception: You should install pytorch from http://pytorch.org


Failed building wheel for pytorch Running setup.py clean for pytorch Failed to build pytorch Installing collected packages: pytorch Running setup.py install for pytorch ... error Complete output from command C:\ProgramData\Anaconda3\python.exe -u -c "import setuptools, tokenize;file='C:\Users\micha\AppData\Local\Temp\pip-build-t86penrg\pytorch\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record C:\Users\micha\AppData\Local\Temp\pip-vms7q49e-record\install-record.txt --single-version-externally-managed --compile: Traceback (most recent call last): File "", line 1, in File "C:\Users\micha\AppData\Local\Temp\pip-build-t86penrg\pytorch\setup.py", line 13, in raise Exception(message) Exception: You should install pytorch from http://pytorch.org

----------------------------------------

Exception: Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\pip\commands\install.py", line 342, in run prefix=options.prefix_path, File "C:\ProgramData\Anaconda3\lib\site-packages\pip\req\req_set.py", line 784, in install **kwargs File "C:\ProgramData\Anaconda3\lib\site-packages\pip\req\req_install.py", line 878, in install spinner=spinner, File "C:\ProgramData\Anaconda3\lib\site-packages\pip\utils__init__.py", line 707, in call_subprocess % (command_desc, proc.returncode, cwd)) pip.exceptions.InstallationError: Command "C:\ProgramData\Anaconda3\python.exe -u -c "import setuptools, tokenize;file='C:\Users\micha\AppData\Local\Temp\pip-build-t86penrg\pytorch\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record C:\Users\micha\AppData\Local\Temp\pip-vms7q49e-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\micha\AppData\Local\Temp\pip-build-t86penrg\pytorch\

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\pip\basecommand.py", line 215, in main status = self.run(options, args) File "C:\ProgramData\Anaconda3\lib\site-packages\pip\commands\install.py", line 385, in run requirement_set.cleanup_files() File "C:\ProgramData\Anaconda3\lib\site-packages\pip\req\req_set.py", line 729, in cleanup_files req.remove_temporary_source() File "C:\ProgramData\Anaconda3\lib\site-packages\pip\req\req_install.py", line 977, in remove_temporary_source rmtree(self.source_dir) File "C:\ProgramData\Anaconda3\lib\site-packages\pip_vendor\retrying.py", line 49, in wrapped_f return Retrying(*dargs, **dkw).call(f, *args, **kw) File "C:\ProgramData\Anaconda3\lib\site-packages\pip_vendor\retrying.py", line 212, in call raise attempt.get() File "C:\ProgramData\Anaconda3\lib\site-packages\pip_vendor\retrying.py", line 247, in get six.reraise(self.value[0], self.value[1], self.value[2]) File "C:\ProgramData\Anaconda3\lib\site-packages\six.py", line 693, in reraise raise value File "C:\ProgramData\Anaconda3\lib\site-packages\pip_vendor\retrying.py", line 200, in call attempt = Attempt(fn(*args, **kwargs), attempt_number, False) File "C:\ProgramData\Anaconda3\lib\site-packages\pip\utils__init__.py", line 102, in rmtree onerror=rmtree_errorhandler) File "C:\ProgramData\Anaconda3\lib\shutil.py", line 494, in rmtree return _rmtree_unsafe(path, onerror) File "C:\ProgramData\Anaconda3\lib\shutil.py", line 393, in _rmtree_unsafe onerror(os.rmdir, path, sys.exc_info()) File "C:\ProgramData\Anaconda3\lib\site-packages\pip\utils__init__.py", line 114, in rmtree_errorhandler func(path) PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\Users\micha\AppData\Local\Temp\pip-build-t86penrg\pytorch'

I also tried conda install -c peterjc123 pytorch=0.1.12 and soumith but I get the same error not found

Any Idea where I am going wrong

Tried other forum tips and post also reinstalled Anaconda but still the same issue

回答1:

However I found how to use Pytorch on windows here: [https://www.superdatascience.com/pytorch/]

conda install -c peterjc123 pytorch

Did the trick for me ...