fairseq icon indicating copy to clipboard operation
fairseq copied to clipboard

pip install on Windows gives permission errors accessing a temp folder through an Admin console

Open munael opened this issue 4 years ago • 18 comments

🐛 Bug

pip install [-U [--force-reinstall]] fairseq currently gives PermissionError: [WinError 5] Access is denied: 'fairseq\\examples'. I have 0.9 installed, and trying to install 0.10.

To Reproduce

Steps to reproduce the behavior (always include the command you ran):

  1. Open an admin console.
  2. Run cmd pip install -U fairseq
  3. See error. fairseq/examples is under:
cwd: $HOME\AppData\Local\Temp\pip-install-18nls8px\fairseq

Stack trace:

  ERROR: Command errored out with exit status 1:
   command: '$HOME\AppData\Local\Continuum\anaconda3\envs\dev\python.exe' '$HOME\AppData\Local\Continuum\anaconda3\envs\dev\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel '$HOME\AppData\Local\Temp\tmpprijkq_f'
       cwd: $HOME\AppData\Local\Temp\pip-install-18nls8px\fairseq
  Complete output (31 lines):
  Traceback (most recent call last):
    File "setup.py", line 214, in <module>
      do_setup(package_data)
    File "setup.py", line 191, in do_setup
      zip_safe=False,
    File "$HOME\AppData\Local\Temp\pip-build-env-yuwvot27\overlay\Lib\site-packages\setuptools\__init__.py", line 152, in setup
      _install_setup_requires(attrs)
    File "$HOME\AppData\Local\Temp\pip-build-env-yuwvot27\overlay\Lib\site-packages\setuptools\__init__.py", line 147, in _install_setup_requires
      dist.fetch_build_eggs(dist.setup_requires)
    File "$HOME\AppData\Local\Temp\pip-build-env-yuwvot27\overlay\Lib\site-packages\setuptools\build_meta.py", line 60, in fetch_build_eggs
      raise SetupRequirementsError(specifier_list)
  setuptools.build_meta.SetupRequirementsError: ['cython', 'numpy', 'setuptools>=18.0']

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "$HOME\AppData\Local\Continuum\anaconda3\envs\dev\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 280, in <module>
      main()
    File "$HOME\AppData\Local\Continuum\anaconda3\envs\dev\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "$HOME\AppData\Local\Continuum\anaconda3\envs\dev\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "$HOME\AppData\Local\Temp\pip-build-env-yuwvot27\overlay\Lib\site-packages\setuptools\build_meta.py", line 150, in get_requires_for_build_wheel
      config_settings, requirements=['wheel'])
    File "$HOME\AppData\Local\Temp\pip-build-env-yuwvot27\overlay\Lib\site-packages\setuptools\build_meta.py", line 130, in _get_build_requires
      self.run_setup()
    File "$HOME\AppData\Local\Temp\pip-build-env-yuwvot27\overlay\Lib\site-packages\setuptools\build_meta.py", line 145, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 217, in <module>
      os.unlink(fairseq_examples)
  PermissionError: [WinError 5] Access is denied: 'fairseq\\examples'
  ----------------------------------------
ERROR: Command errored out with exit status 1: '$HOME\AppData\Local\Continuum\anaconda3\envs\dev\python.exe' '$HOME\AppData\Local\Continuum\anaconda3\envs\dev\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel '$HOME\AppData\Local\Temp\tmpprijkq_f' Check the logs for full command output.

Log under $HOME\AppData\Local\Temp\tmpprijkq_f are inaccessible as the temp folder is auto deleted.

Code sample

Expected behavior

Updates normally.

Environment

  • fairseq Version (e.g., 1.0 or master): 0.9.0
  • PyTorch Version (e.g., 1.0) 1.7
  • OS (e.g., Linux): Windows 10
  • How you installed fairseq (pip, source): pip
  • Build command you used (if compiling from source): N/A
  • Python version: 3.7.7
  • CUDA/cuDNN version: N/A
  • GPU models and configuration: N/A
  • Any other relevant information: N/A

Additional context

munael avatar Feb 01 '21 15:02 munael

I don't have a Windows machine to repro this on, but this SO answer says to either use a project environment (ex: conda or virtualenv) or run with administrator privileges

lematt1991 avatar Feb 01 '21 18:02 lematt1991

I have similar issue. I referred to @lematt1991 's answer, but it was not solved. In my case, there is a problem with the 10.2 and 10.1 versions and 10.0 is installed.

fspanda avatar Feb 03 '21 01:02 fspanda

Using symlinks is generally not a cross-platform solution. I normally comment out the symlink lines in the setup.py @munael @fspanda.

erip avatar Feb 08 '21 22:02 erip

@lematt1991, I've created a simple pull request to show how this issue can be solved. I'm just starting to work with fairseq, so not sure if this patch is good enough. LMK

sierkov avatar Mar 20 '21 13:03 sierkov

This seems like it should be on for the 10.3 milestone. Updating on Windows is currently broken :/ Only recourse (which I've yet to try) is to install from a clone of a fixed branch. But that'll just mess up updates later on...

Edit: Installing from conda (with -c conda-forge) seems to work for now.

munael avatar May 08 '21 18:05 munael

Hi everybody !!

This problem has solved. Try to run this pip install -v --no-cache-dir fairseq

Thanks

tanujdhiman avatar Jul 28 '21 17:07 tanujdhiman

pip install -v --no-cache-dir fairseq

Although I no longer see the access denied error running this I cannot import fairseq in any python script, it says that no such module exists.

Lukecn1 avatar Jul 29 '21 09:07 Lukecn1

Hi @Lukecn1 Please try first in a fresh env.

tanujdhiman avatar Jul 29 '21 13:07 tanujdhiman

@tanujdhiman - Note that this "works" by trying to install 0.10.2, 0.10.1, then 0.10.0. It fails on the first two.

munael avatar Aug 16 '21 09:08 munael

@munael Is your issue resolved ?

tanujdhiman avatar Aug 16 '21 12:08 tanujdhiman

@tanujdhiman It seems to reappear on 0.10.1 and 0.10.2. 0.10.0 installs fine, but only after pip tries the later patches first and fails with the same error.

munael avatar Aug 16 '21 13:08 munael

pip install fairseq==0.10.0

PC1617 avatar Mar 15 '22 06:03 PC1617

pip install fairseq==0.10.0

Yep ! This is working on this cmd but doubt is why it doesn't work with other versions like 0.10.1 and 0.10.2.

tanujdhiman avatar Mar 15 '22 18:03 tanujdhiman

install fairseq and develop locally:

git clone https://github.com/pytorch/fairseq cd fairseq

activate venv(your env) pip install --editable .

rami-Khrais avatar Mar 20 '22 18:03 rami-Khrais

git clone https://github.com/pytorch/fairseq cd fairseq

activate venv(your env) pip install --editable .

Is it working on all Operating Systems (Mac, Linux and specially Windows) ?

tanujdhiman avatar Mar 21 '22 06:03 tanujdhiman

git clone https://github.com/pytorch/fairseq cd fairseq activate venv(your env) pip install --editable .

Is it working on all Operating Systems (Mac, Linux and specially Windows) ?

Yes, Tested on Windows 10 and Ubuntu 20.04

rami-Khrais avatar Mar 21 '22 06:03 rami-Khrais

I don't have a Windows machine to repro this on, but this SO answer says to either use a project environment (ex: conda or virtualenv) or run with administrator privileges

Thanks ! I confirm running the following command on Windows 10 with Git bash started as administrator and in a conda env worked : pip install . --use-feature=in-tree-build

ismael-elatifi avatar Apr 17 '22 11:04 ismael-elatifi

This is still a relevant issue today.

BramVanroy avatar Sep 05 '22 17:09 BramVanroy