fairseq icon indicating copy to clipboard operation
fairseq copied to clipboard

Cannot install fairseq==0.10.2 with python 3.9

Open louismartin opened this issue 3 years ago • 23 comments

I don't seem to be able to install fairseq==0.10.2 with python 3.9 on macOS 11.3

$ pip install fairseq==0.10.2
Collecting fairseq==0.10.2
  Using cached fairseq-0.10.2.tar.gz (938 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/louismartin/miniconda3/envs/dev3.9/bin/python /Users/louismartin/miniconda3/envs/dev3.9/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /var/folders/_4/yxn93yzn14g0_0k2rmctcc1x8lvpn4/T/tmpok_9kdi5
       cwd: /private/var/folders/_4/yxn93yzn14g0_0k2rmctcc1x8lvpn4/T/pip-install-c4qbk_3i/fairseq_751efca8a5d547ada5c29fe71ec11ded
  Complete output (31 lines):
  Traceback (most recent call last):
    File "setup.py", line 214, in <module>
      do_setup(package_data)
    File "setup.py", line 136, in do_setup
      setup(
    File "/private/var/folders/_4/yxn93yzn14g0_0k2rmctcc1x8lvpn4/T/pip-build-env-gi7j5w4c/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 152, in setup
      _install_setup_requires(attrs)
    File "/private/var/folders/_4/yxn93yzn14g0_0k2rmctcc1x8lvpn4/T/pip-build-env-gi7j5w4c/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 147, in _install_setup_requires
      dist.fetch_build_eggs(dist.setup_requires)
    File "/private/var/folders/_4/yxn93yzn14g0_0k2rmctcc1x8lvpn4/T/pip-build-env-gi7j5w4c/overlay/lib/python3.9/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 "/Users/louismartin/miniconda3/envs/dev3.9/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
      main()
    File "/Users/louismartin/miniconda3/envs/dev3.9/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/Users/louismartin/miniconda3/envs/dev3.9/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/private/var/folders/_4/yxn93yzn14g0_0k2rmctcc1x8lvpn4/T/pip-build-env-gi7j5w4c/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 154, in get_requires_for_build_wheel
      return self._get_build_requires(
    File "/private/var/folders/_4/yxn93yzn14g0_0k2rmctcc1x8lvpn4/T/pip-build-env-gi7j5w4c/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 135, in _get_build_requires
      self.run_setup()
    File "/private/var/folders/_4/yxn93yzn14g0_0k2rmctcc1x8lvpn4/T/pip-build-env-gi7j5w4c/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 150, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 217, in <module>
      os.unlink(fairseq_examples)
  PermissionError: [Errno 1] Operation not permitted: 'fairseq/examples'
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/02/59/1f466d82d64482e2809a167e0067979c23057b3752e668537d5ff24453c9/fairseq-0.10.2.tar.gz#sha256=45b90d8ccc3f5a4623a523fe2d0465f54413d03fd1ec9a9d7af0461148ca1a68 (from https://pypi.org/simple/fairseq/). Command errored out with exit status 1: /Users/louismartin/miniconda3/envs/dev3.9/bin/python /Users/louismartin/miniconda3/envs/dev3.9/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /var/folders/_4/yxn93yzn14g0_0k2rmctcc1x8lvpn4/T/tmpok_9kdi5 Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement fairseq==0.10.2
ERROR: No matching distribution found for fairseq==0.10.2

Seems to be due to this line

louismartin avatar May 05 '21 16:05 louismartin

I reproduced the issue on ubuntu 20.04 with python 3.9

The error does not occur with ubuntu 20.04 and python 3.8 so it is probably due to python 3.9.

louismartin avatar May 05 '21 19:05 louismartin

Hi @myleott any news on when a new pip version will be released fixing compatibility for python 3.9? I'm asking because I get issues on my repo about python 3.9 compatibility.

louismartin avatar Jun 16 '21 08:06 louismartin

It's not just a problem with python 3.9. It appears even for 3.8, 3.7, 3.6.

leeway00 avatar Jun 24 '21 10:06 leeway00

Facing the same issue with python 3.6 . Any updates on this? @leeway00 @louismartin

jung-youjin avatar Aug 05 '21 02:08 jung-youjin

Facing the same issue with python 3.6 . Any updates on this? @leeway00 @louismartin

I had a problem while using alpine image in Docker. I solved it by using torch image.

leeway00 avatar Aug 05 '21 12:08 leeway00

Facing the same issue with python 3.6 . Any updates on this? @leeway00 @louismartin

저는 도커 alpine에서 돌리다 문제가 발생했었는데, torch 이미지로 도커파일 바꿔서 해결했어요.. 같은 상황이실지는 모르겠네요

Ah! I'm unfortunately in a different situation. I'm on conda env. Anyways, thank you for your help. :)

jung-youjin avatar Aug 06 '21 01:08 jung-youjin

Having the same issue. Would love to hear if you have any solution for this? @louismartin

kurtisxx avatar Sep 13 '21 09:09 kurtisxx

Hi, I have the same issue and would love to hear any solutions! I am using Python 3.8 on Windows.

annagansen22 avatar Sep 30 '21 14:09 annagansen22

Hi, with python=3.9 ,ubuntu=20.04 , the same issue informs and conda also failed to install -c conda-forge or search -c pytorch.

% pip install fairseq==0.10.2 Collecting fairseq==0.10.2 Downloading fairseq-0.10.2.tar.gz (938 kB) |████████████████████████████████| 938 kB 268 kB/s
Installing build dependencies ... done Getting requirements to build wheel ... error ERROR: Command errored out with exit status 1: command: /opt/envs/ml/bin/python3.9 /opt/envs/ml/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpi9h33vpp cwd: /tmp/pip-install-580ty_am/fairseq_9a2162ba544347ea84244836281ffd3e Complete output (33 lines): /tmp/pip-build-env-bwv17z0g/overlay/lib/python3.9/site-packages/setuptools/init.py:148: SetuptoolsDeprecationWarning: setup_requires is deprecated. Supply build dependencies using PEP 517 pyproject.toml build-requires. warnings.warn( Traceback (most recent call last): File "setup.py", line 214, in do_setup(package_data) File "setup.py", line 136, in do_setup setup( File "/tmp/pip-build-env-bwv17z0g/overlay/lib/python3.9/site-packages/setuptools/init.py", line 158, in setup _install_setup_requires(attrs) File "/tmp/pip-build-env-bwv17z0g/overlay/lib/python3.9/site-packages/setuptools/init.py", line 153, in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) File "/tmp/pip-build-env-bwv17z0g/overlay/lib/python3.9/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 "/opt/envs/ml/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in main() File "/opt/envs/ml/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "/opt/envs/ml/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel return hook(config_settings) File "/tmp/pip-build-env-bwv17z0g/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 154, in get_requires_for_build_wheel return self._get_build_requires( File "/tmp/pip-build-env-bwv17z0g/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 135, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-bwv17z0g/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 150, in run_setup exec(compile(code, file, 'exec'), locals()) File "setup.py", line 217, in os.unlink(fairseq_examples) IsADirectoryError: [Errno 21] Is a directory: 'fairseq/examples'

WARNING: Discarding https://files.pythonhosted.org/packages/02/59/1f466d82d64482e2809a167e0067979c23057b3752e668537d5ff24453c9/fairseq-0.10.2.tar.gz#sha256=45b90d8ccc3f5a4623a523fe2d0465f54413d03fd1ec9a9d7af0461148ca1a68 (from https://pypi.org/simple/fairseq/). Command errored out with exit status 1: /opt/envs/ml/bin/python3.9 /opt/envs/ml/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpi9h33vpp Check the logs for full command output. ERROR: Could not find a version that satisfies the requirement fairseq==0.10.2 (from versions: 0.6.1, 0.6.2, 0.7.1, 0.7.2, 0.8.0, 0.9.0, 0.10.0, 0.10.1, 0.10.2) ERROR: No matching distribution found for fairseq==0.10.2

0x1orz avatar Nov 03 '21 17:11 0x1orz

has this been solved?

related: https://stackoverflow.com/questions/70339061/why-is-fairseq-giving-me-operation-not-permitted-errors-when-i-try-to-pip-inst

brando90 avatar Dec 13 '21 18:12 brando90

It's not just a problem with python 3.9. It appears even for 3.8, 3.7, 3.6.

I tried it with python 3.10.1 and 3.9.9 which yielded the same error as the OP. But going down to python 3.8.12 helped.

To be more precise this the dockerfile of the successful install:

FROM python:3.8.12-slim-bullseye
RUN apt-get -y update
RUN apt-get -y install build-essential=12.9
RUN pip3 install torch==1.10.1+cpu torchvision==0.11.2+cpu torchaudio==0.10.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
RUN pip install -Iv fairseq==0.10.2

Amiron49 avatar Dec 16 '21 21:12 Amiron49

The same issue is happening in our CI test. https://github.com/espnet/espnet/runs/5011281760?check_suite_focus=true But it's interesting that the issue just come out in a very recent time. It does not have the issue from the point when the issue is raised.

ftshijt avatar Jan 31 '22 19:01 ftshijt

Did you solved the problem ... I am facing the same problem. I passed 6 hours with this😔

MdYeasinSamadArnob avatar Feb 18 '22 15:02 MdYeasinSamadArnob

I met the same problem on Windows10 python3.9.7. Why this problem has not been tackled yet?

Darius-H avatar Mar 01 '22 08:03 Darius-H

For conda users, there are a few open PRs aiming at fixing this. In particular this one seems to work.

Until they get accepted, a workaround is to use sdvillal::fairseq as a dependency in your environment (linux and macos only).

sdvillal avatar Mar 18 '22 19:03 sdvillal

For me (on MacOS 10.15, Python 3.9) the issue turned out to be the pip version: using pip 21.3.1 works fine but upgrading to pip 22.0.4 resulted in the above error

bnika avatar Mar 22 '22 22:03 bnika

pip 21.3.1 did not work for me the only thing it did differently was it persevered when installing 0.10.2 and 0.10.1 failed and ended up successfully installing 0.10.0.

krassowski avatar Apr 22 '22 02:04 krassowski

it does work on fairseq version:1.0.0, the solution is as follow:

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

activate env(that you created existed)
pip install --editable .

reference : https://stackoverflow.com/questions/65445611/cannot-install-fairseq-using-anaconda

Camouflagee avatar May 16 '22 05:05 Camouflagee

still getting this buggo with python 3.9.9 (pip 22.1) on Void Linux for fairseq versions 0.10.1 and 0.10.2, but was able to run pip install fairseq==0.10.0

danjenson avatar May 17 '22 19:05 danjenson

I was facing this issue on Google Colab; not on its default python version, which was 3.7.13 but on version 3.6.9. I had changed the python version via command sudo update-alternatives --config python3. Afterward, I needed to install and updated pip via the command sudo apt install python3-pip && python -m pip install --upgrade pip. The following is the error I was facing.

>>> pip install fairseq==0.9.0
Collecting fairseq==0.9.0
  Downloading fairseq-0.9.0.tar.gz (306 kB)
     |████████████████████████████████| 306 kB 4.7 MB/s            
  Preparing metadata (setup.py) ... error
WARNING: Discarding https://files.pythonhosted.org/packages/67/bf/de299e082e7af010d35162cb9a185dc6c17db71624590f2f379aeb2519ff/fairseq-0.9.0.tar.gz#sha256=61206358b79f325ea0b46cfd8c95cdb81bfbcfb43cf12b47d1d5124ce7321d3b (from https://pypi.org/simple/fairseq/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement fairseq==0.9.0 (from versions: 0.6.1, 0.6.2, 0.7.1, 0.7.2, 0.8.0, 0.9.0, 0.10.0, 0.10.1, 0.10.2)
ERROR: No matching distribution found for fairseq==0.9.0

Surprisingly error was resolved by updating setuptools via the command pip3 install --upgrade setuptools. This solution originally was suggested in here.

mrghofrani avatar May 22 '22 07:05 mrghofrani

still getting this buggo with python 3.9.9 (pip 22.1) on Void Linux for fairseq versions 0.10.1 and 0.10.2, but was able to run pip install fairseq==0.10.0

yes, it also works with python 3.10 on windows11.

theshypig avatar Jun 03 '23 06:06 theshypig

ERROR: Cannot install fairseq2==0.1.0 and fairseq2==0.1.1 because these package versions have conflicting dependencies.

SharmaTushar007 avatar Oct 03 '23 10:10 SharmaTushar007

I encountered the same issue while trying to install fairseq=0.10.2 using pip, and after several attempts that all ended in failure, I finally found a solution that worked for me (on Windows with Python 3.8).

Here's how I managed to install fairseq version 0.10.2:

1.You can download either the zip or tar.gz of the specific release directly from the https://github.com/facebookresearch/fairseq/releases/tag/v0.10.2 2.After downloading and extracting the file, I opened a command prompt with administrator privileges. 3.Navigated to the extracted fairseq directory: cd path\to\fairseq 4.pip install --editable ./

This method proved successful.

Please note that fairseq=0.10.2 requires PyTorch version >= 1.5.0 and Python version >= 3.6. Ensure these requirements are met prior to installation.

Hope this helps anyone else facing the same challenge!

ruobingli1103 avatar Mar 05 '24 04:03 ruobingli1103