facebookresearch / fairseq

Facebook AI Research Sequence-to-Sequence Toolkit written in Python.
MIT License
30.57k stars 6.41k forks source link

Unable to pip install fairseq. #5517

Closed Valerie9696 closed 4 months ago

Valerie9696 commented 4 months ago

I have been constantly trying to resolve this for 5 days now (only today decided to make this post). I finally managed to install fairseq. For anyone with a similiar problem, this is how I did it: Starting from the venv inside my cmd.exe git clone https://github.com/pytorch/fairseq cd fairseq set LIB=%LIB%;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\ATLMFC\lib\x86;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\lib\x86;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\lib\onecore\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.26100.0\um\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.26100.0\ucrt\x64

set LIBPATH=%LIBPATH%;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\ATLMFC\lib\x86;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\lib\x86;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\lib\x86\store\references;C:\Windows\Microsoft.NET\Framework\v4.0.30319

set INCLUDE=%INCLUDE%;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\include;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\ATLMFC\include;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include;C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\shared;C:\Program Files (x86)\Microsoft

set Path=%Path%;C:\Program Files (x86)\Windows Kits\10\bin\x64

then I copied rc.exe and rcdll.dll from here C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64 to here C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.40.33807\bin\Hostx86\x64 (which is where the link.exe is sitting)

pip install --editable .\

Now, fairseq is finally installed at last.


I ran this to install fairseq: git clone https://github.com/pytorch/fairseq cd fairseq pip install fairseq

But this error keeps popping up and I have been unable to find a solution for it:

Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [16 lines of output] Traceback (most recent call last): File "C:\Users\v\PycharmProjects\CausalAI\lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in main() File "C:\Users\v\PycharmProjects\CausalAI\lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "C:\Users\v\PycharmProjects\CausalAI\lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) File "C:\Users\v\AppData\Local\Temp\pip-build-env-xw_hib4s\overlay\Lib\site-packages\setuptools\build_meta.py", line 327, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=[]) File "C:\Users\v\AppData\Local\Temp\pip-build-env-xw_hib4s\overlay\Lib\site-packages\setuptools\build_meta.py", line 297, in _get_build_requires self.run_setup() File "C:\Users\v\AppData\Local\Temp\pip-build-env-xw_hib4s\overlay\Lib\site-packages\setuptools\build_meta.py", line 313, in run_setup exec(code, locals()) File "", line 27, in File "", line 18, in write_version_py FileNotFoundError: [Errno 2] No such file or directory: 'fairseq\version.txt' [end of output]

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

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.

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

I have found the MANIFEST.in which is supposed to resolve this via include fairseq/version.txt, but for me it does nothing. I also tried changing the path to fairseq\version.txt and several other path variations (even absolute from root). No results.

Environment:

Windows 11 Python 3.9 pytorch 2.3.1+cu118

I have tried to install fairseq 0.10.2, 0.11.1 and 0.12.2 - all to no avail. Same error. I would be really thankfull for help.

EDIT 1: I keep trying to find a workaround:

using pip install git+https://github.com/pytorch/fairseq runs into this:

ERROR: Cannot install fairseq and fairseq==0.12.2 because these package versions have conflicting dependencies.

The conflict is caused by: fairseq 0.12.2 depends on omegaconf<2.1 hydra-core 1.0.7 depends on omegaconf<2.1 and >=2.0.5

EDIT 2:

I switched over to Microsoft Visual Studio and their Developer Command Prompt. Now pip install fairseq results in :

LINK : fatal error LNK1104: Cannot open file "kernel32.lib". error: command 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX86\x86\link.exe' failed with exit code 1104

No matter which route I take, I find no way to install this package. At this point, I would gladly take a precompiled wheel for windows 11.

AchillesPlight commented 3 months ago

Same problem.