functorch icon indicating copy to clipboard operation
functorch copied to clipboard

Installation "functorch" on Windows 11 failed.

Open mzhen77 opened this issue 2 years ago • 11 comments

My OS:

Edition Windows 11 Pro Version 21H2 Installed on ‎12/‎23/‎2021 OS build 22000.556 Experience Windows Feature Experience Pack 1000.22000.556.0

 >>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Sun_Aug_15_21:18:57_Pacific_Daylight_Time_2021
Cuda compilation tools, release 11.4, V11.4.120
Build cuda_11.4.r11.4/compiler.30300941_0

The first try (Installing functorch beta):

torch.version = "1.11.0"

>> pip install functorch==0.1.0

ERROR: Could not find a version that satisfies the requirement functorch (from versions: none)
ERROR: No matching distribution found for functorch

The second try (from source):

torch.version = "1.12.0.dev20220228+cu111"

>>pip install --user "git+https://github.com/pytorch/functorch.git" error_log.txt

Any help would be appreciated. Thanks!

mzhen77 avatar Mar 18 '22 03:03 mzhen77

Thanks for reporting @mzhen77 , unfortunately currently there is no binaries for windows: https://pypi.org/project/functorch/#files

I'm not sure if functorch building from source on Windows was solved since https://github.com/pytorch/functorch/issues/331 Which msvc version you are using ?

The error you have is:

AttributeError: 'MSVCCompiler' object has no attribute 'compiler_so'

which means that functorch does not support standard Windows build environment. We can try to follow same suggestions as for building pytorch from source: https://github.com/pytorch/pytorch#from-source

vfdev-5 avatar Mar 18 '22 08:03 vfdev-5

Thanks for the quick response @vfdev-5 My version of msvc:

Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30133

mzhen77 avatar Mar 18 '22 18:03 mzhen77

I'm not sure if my question is appropriate here, but I also experience the same problem on a Mac.

Currently, I am using the Apple M1 pro chip with Monterey 12.3.1.

Whenever I try to install the package from pip install functorch, it gives an error:

ERROR: Could not find a version that satisfies the requirement functorch (from versions: none)
ERROR: No matching distribution found for functorch

functorch instruction page said that "We currently support manylinux and MacOS, please reach out on GitHub for other platforms."

In this case, does Mac OS include M1 chips or only for Intel chips?

I really want to try vmap and any help would be appreciated!

Thank you in advance!

kyoungseoun-chung avatar Apr 05 '22 08:04 kyoungseoun-chung

Currently, I am using the Apple M1 pro chip with Monterey 12.3.1.

@kyoungseoun-chung I assume that you have PyTorch installed and working for your hardware. Can you try install functorch from source using following command:

pip install git+https://github.com/pytorch/functorch

and report if there is an error or things are working. Thanks

vfdev-5 avatar Apr 05 '22 11:04 vfdev-5

Currently, I am using the Apple M1 pro chip with Monterey 12.3.1.

@kyoungseoun-chung I assume that you have PyTorch installed and working for your hardware. Can you try install functorch from source using following command:

pip install git+https://github.com/pytorch/functorch

and report if there is an error or things are working. Thanks

(Just for the clarification, I am working with PyTorch 1.11.0)

With suggested command, I received lengthy error message. (Seems like compilation failure.)

I am not able to copy all of the messages but the last part of the error message is following:

".../site-packages/torch/utils/cpp_extension.py", line 1756, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> functorch

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

However, if I install PyTorch-nightly version (1.12.0.dev20220405) and use the command you suggest, I can install functorch without problem.

Should I stick to nightly version? I am working on multiple devices (one is M1 mac and other is intel CPU with NVIDIA GPU). Therefore, I'd like to avoid use of nightly version as much as possible. (do not want to pip install different version of PyTorch depends on availability of CUDA device...)

Thank you in advance!

kyoungseoun-chung avatar Apr 05 '22 12:04 kyoungseoun-chung

@kyoungseoun-chung sorry I had to mention in my previous comment that installing from source requires pytorch nightly. Sounds good that you could compile and install functorch with pytorch nightly on your hardware.

However If you wish to use stable pytorch v1.11.0, you can compile corresponding functorch v0.1.0:

pip install --upgrade git+https://github.com/pytorch/[email protected]

vfdev-5 avatar Apr 05 '22 13:04 vfdev-5

@kyoungseoun-chung sorry I had to mention in my previous comment that installing from source requires pytorch nightly. Sounds good that you could compile and install functorch with pytorch nightly on your hardware.

However If you wish to use stable pytorch v1.11.0, you can compile corresponding functorch v0.1.0:

pip install --upgrade git+https://github.com/pytorch/[email protected]

Thank you so much. Your solution is working now. I can confirm that with --upgrade flag, I can successfully install functorch.

Really appreciate your kind consideration to me.

Have a great day!

kyoungseoun-chung avatar Apr 05 '22 14:04 kyoungseoun-chung

Great that could help you ! Just a detail about --upgrade, this option just reinstalls previous version, key ingredient to install compatible version was @v0.1.0 :)

vfdev-5 avatar Apr 05 '22 14:04 vfdev-5

@mzhen77 We now support building from source on Windows. Could you please try that again and let us know how it goes?

zou3519 avatar Apr 15 '22 14:04 zou3519

Thank you very much @zou3519, I was able to install it. I did not play much but the "hello world" works.

mzhen77 avatar Apr 15 '22 18:04 mzhen77

Awesome. Please do let us know if you run into problems using functorch on Windows (we haven't done any stress testing yet but all of our test cases pass)

zou3519 avatar Apr 15 '22 18:04 zou3519