facebookresearch / fairseq

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

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

Closed Beterng closed 4 months ago

Beterng commented 5 months ago

🐛 Bug

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

Environment

i use ther command to install

git clone https://github.com/pytorch/fairseq
cd fairseq
py -3.10 -m pip install --editable ./

There is a full log

PS D:\html\AI Cover voice\fairseq> py -3.10 -m pip install ./
Processing d:\html\ai cover voice\fairseq
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: cffi in c:\users\admin\appdata\local\programs\python\python310\lib\site-packages (from fairseq==0.12.2) (1.16.0)
Requirement already satisfied: cython in c:\users\admin\appdata\local\programs\python\python310\lib\site-packages (from fairseq==0.12.2) (3.0.10)
Collecting hydra-core<1.1,>=1.0.7 (from fairseq==0.12.2)
  Using cached hydra_core-1.0.7-py3-none-any.whl.metadata (3.7 kB)
Collecting omegaconf<2.1 (from fairseq==0.12.2)
  Using cached omegaconf-2.0.6-py3-none-any.whl.metadata (3.0 kB)
WARNING: Ignoring version 2.0.6 of omegaconf since it has invalid metadata:
Requested omegaconf<2.1 from https://files.pythonhosted.org/packages/d0/eb/9d63ce09dd8aa85767c65668d5414958ea29648a0eec80a4a7d311ec2684/omegaconf-2.0.6-py3-none-any.whl (from fairseq==0.12.2) has invalid metadata: .* suffix can only be used with `==` or `!=` operators
    PyYAML (>=5.1.*)
            ~~~~~~^
Please use pip<24.1 if you need to use this version.
  Using cached omegaconf-2.0.5-py3-none-any.whl.metadata (3.0 kB)
WARNING: Ignoring version 2.0.5 of omegaconf since it has invalid metadata:
Requested omegaconf<2.1 from https://files.pythonhosted.org/packages/e5/f6/043b6d255dd6fbf2025110cea35b87f4c5100a181681d8eab496269f0d5b/omegaconf-2.0.5-py3-none-any.whl (from fairseq==0.12.2) has invalid metadata: .* suffix can only be used with `==` or `!=` operators
    PyYAML (>=5.1.*)
            ~~~~~~^
Please use pip<24.1 if you need to use this version.
  Using cached omegaconf-2.0.4-py3-none-any.whl.metadata (3.0 kB)
WARNING: Ignoring version 2.0.4 of omegaconf since it has invalid metadata:
Requested omegaconf<2.1 from https://files.pythonhosted.org/packages/92/b1/4f3023143436f12c98bab53f0b3db617bd18a7d223627d5030e13a7b4fc2/omegaconf-2.0.4-py3-none-any.whl (from fairseq==0.12.2) has invalid metadata: .* suffix can only be used with `==` or `!=` operators
    PyYAML (>=5.1.*)
            ~~~~~~^
Please use pip<24.1 if you need to use this version.
  Using cached omegaconf-2.0.3-py3-none-any.whl.metadata (3.0 kB)
WARNING: Ignoring version 2.0.3 of omegaconf since it has invalid metadata:
Requested omegaconf<2.1 from https://files.pythonhosted.org/packages/29/08/a88210c2c1aa0a3f65f05d8a6c98939ccb84b6fb982aa6567dec4e6773f9/omegaconf-2.0.3-py3-none-any.whl (from fairseq==0.12.2) has invalid metadata: .* suffix can only be used with `==` or `!=` operators
    PyYAML (>=5.1.*)
            ~~~~~~^
Please use pip<24.1 if you need to use this version.
  Using cached omegaconf-2.0.2-py3-none-any.whl.metadata (3.0 kB)
WARNING: Ignoring version 2.0.2 of omegaconf since it has invalid metadata:
Requested omegaconf<2.1 from https://files.pythonhosted.org/packages/72/fe/f8d162aa059fb4f327fd75144dd69aa7e8acbb6d8d37013e4638c8490e0b/omegaconf-2.0.2-py3-none-any.whl (from fairseq==0.12.2) has invalid metadata: .* suffix can only be used with `==` or `!=` operators
    PyYAML (>=5.1.*)
            ~~~~~~^
Please use pip<24.1 if you need to use this version.
  Using cached omegaconf-2.0.1-py3-none-any.whl.metadata (3.0 kB)
WARNING: Ignoring version 2.0.1 of omegaconf since it has invalid metadata:
Requested omegaconf<2.1 from https://files.pythonhosted.org/packages/86/ec/605805e60abdb025b06664d107335031bb8ebdc52e0a90bdbad6a7130279/omegaconf-2.0.1-py3-none-any.whl (from fairseq==0.12.2) has invalid metadata: .* suffix can only be used with `==` or `!=` operators
    PyYAML (>=5.1.*)
            ~~~~~~^
Please use pip<24.1 if you need to use this version.
  Using cached omegaconf-2.0.0-py3-none-any.whl.metadata (3.5 kB)
Requirement already satisfied: numpy>=1.21.3 in c:\users\admin\appdata\local\programs\python\python310\lib\site-packages (from fairseq==0.12.2) (1.23.5)
Collecting regex (from fairseq==0.12.2)
  Using cached regex-2024.5.15-cp310-cp310-win_amd64.whl.metadata (41 kB)
Collecting sacrebleu>=1.4.12 (from fairseq==0.12.2)
  Using cached sacrebleu-2.4.2-py3-none-any.whl.metadata (58 kB)
Requirement already satisfied: torch>=1.13 in c:\users\admin\appdata\local\programs\python\python310\lib\site-packages (from fairseq==0.12.2) (2.0.1+cu118)
Requirement already satisfied: tqdm in c:\users\admin\appdata\local\programs\python\python310\lib\site-packages (from fairseq==0.12.2) (4.65.0)
Collecting bitarray (from fairseq==0.12.2)
  Using cached bitarray-2.9.2-cp310-cp310-win_amd64.whl.metadata (35 kB)
Requirement already satisfied: torchaudio>=0.8.0 in c:\users\admin\appdata\local\programs\python\python310\lib\site-packages (from fairseq==0.12.2) (2.3.1+cu121)
Requirement already satisfied: scikit-learn in c:\users\admin\appdata\local\programs\python\python310\lib\site-packages (from fairseq==0.12.2) (1.5.0)
Requirement already satisfied: packaging in c:\users\admin\appdata\local\programs\python\python310\lib\site-packages (from fairseq==0.12.2) (24.1)
Collecting omegaconf<2.1 (from fairseq==0.12.2)
  Using cached omegaconf-2.0.6-py3-none-any.whl.metadata (3.0 kB)
WARNING: Ignoring version 2.0.6 of omegaconf since it has invalid metadata:
Requested omegaconf<2.1 from https://files.pythonhosted.org/packages/d0/eb/9d63ce09dd8aa85767c65668d5414958ea29648a0eec80a4a7d311ec2684/omegaconf-2.0.6-py3-none-any.whl (from fairseq==0.12.2) has invalid metadata: .* suffix can only be used with `==` or `!=` operators
    PyYAML (>=5.1.*)
            ~~~~~~^
Please use pip<24.1 if you need to use this version.
  Using cached omegaconf-2.0.5-py3-none-any.whl.metadata (3.0 kB)
WARNING: Ignoring version 2.0.5 of omegaconf since it has invalid metadata:
Requested omegaconf<2.1 from https://files.pythonhosted.org/packages/e5/f6/043b6d255dd6fbf2025110cea35b87f4c5100a181681d8eab496269f0d5b/omegaconf-2.0.5-py3-none-any.whl (from fairseq==0.12.2) has invalid metadata: .* suffix can only be used with `==` or `!=` operators
    PyYAML (>=5.1.*)
            ~~~~~~^
Please use pip<24.1 if you need to use this version.
INFO: pip is looking at multiple versions of hydra-core to determine which version is compatible with other requirements. This could take a while.
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

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip to attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

Something went wrong when install.

Beterng commented 5 months ago

Has fix the torch issue so update the bug info

arjunbahuguna commented 5 months ago

Facing the same.

Beterng commented 5 months ago

This issue is connected with https://github.com/SociallyIneptWeeb/AICoverGen/issues/133#issue-2372232845 ploblem

Siddharth-Latthe-07 commented 4 months ago

@Beterng , the best way is, to install without version specifications, as it would by default install the latest versions of all the libraries. And if there are cases, when the package itself is not updated by the org to match the latter versions, then in that case, unfortunately, we need to install it accordingly.

Gan-Xing commented 4 months ago

I have the same problem.

Title

pip install fairseq fails due to invalid metadata for PyYAML dependency in omegaconf

Issue Description

Environment:

Steps to Reproduce:

  1. Create and activate conda environment:

    conda create -n streamspeech python=3.10 -y
    conda activate streamspeech
  2. Install dependencies:

    conda install pytorch=2.0.1 torchvision torchaudio cudatoolkit=11.7 -c pytorch
    sudo apt-get update
    sudo apt-get install -y build-essential python3-dev
    pip install cython numpy
    pip install --upgrade pip setuptools
    pip install PyYAML
  3. Check PyYAML version:

    python -c "import yaml; print(yaml.__version__)"
    # Output: 6.0.1
  4. Try to install fairseq:

    pip install --editable ./ --no-build-isolation

Observed Behavior:

Expected Behavior: fairseq should be installed without errors.

Additional Information:

Notes:

Steps Tried:

  1. Upgrading/downgrading pip, setuptools, and wheel.
  2. Installing specific versions of PyYAML and omegaconf.
  3. Setting up a new conda environment with specific versions of dependencies.
  4. Verifying GCC installation and setting default versions.

Request for Help: I need assistance in resolving this installation failure. Any guidance or solutions would be appreciated.

Contact Information: 599153574@qq.com

Labels

Siddharth-Latthe-07 commented 4 months ago

@Gan-Xing , The issue seems to stem from an invalid version specifier in the omegaconf package's metadata. try out these steps, and let me know if it works,

  1. Create a patched version of omegaconf by:- Download the omegaconf source code.

    git clone https://github.com/omry/omegaconf.git
    cd omegaconf
  2. edit the setup.py or setup.cfg file to correct the version specifier for PyYAML. Open the setup.cfg file (or setup.py if there is no setup.cfg) and change the PyYAML requirement from PyYAML (>=5.1.*) to PyYAML (>=5.1).

  3. Install the above patch version before the fairseq

    python setup.py sdist
    pip install dist/omegaconf-<version>.tar.gz
  4. Proceed with installing fairseq:

    pip install --editable ./ --no-build-isolation

let me know, if it works

Geremia commented 4 months ago

@Siddharth-Latthe-07 I don't see PyYAML version lines in the 2 setup.* files.

Siddharth-Latthe-07 commented 4 months ago

@Geremia sorry my bad, not in setup. files in the requirements/base.txt file, Change the version specifier from PyYAML (>=5.1.) to PyYAML (>=5.1). and then proceed with above steps to install fairseq:- pip install fairseq

Geremia commented 4 months ago

@Siddharth-Latthe-07 It builds omegaconf 2.4.0.dev3, and I still get the same issue installing fairseq:

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

I don't know why it keeps Downloading omegaconf-2.0.5-py3-none-any.whl.metadata.

Geremia commented 4 months ago

@Siddharth-Latthe-07 I had to git checkout v2.0.6 first. That fixed the problem.

Siddharth-Latthe-07 commented 4 months ago

@Geremia so, the issue seems to have caused due version control, switching to relevant version of git helped to solve the dependency conflicts ig.

Beterng commented 4 months ago

The problem may start with the pip version. I have downgraded to ver 20 and then it works. Issue close.

roelfrenkema commented 3 months ago

Great downgraded pip to version 20 and now nothing works anymore. Everything haywire. Will rebuild the venv.

asumagic commented 2 months ago

The issue is not solved, downgrading the package manager is only a temporary hack. This isn't a pip bug.

Gan-Xing commented 2 months ago

来信已收到。谢谢。——此为自动回复。Votre courrier est bien re?0?4u,merci.//C'est une réponse automatique.Your e-mail has been received,thanks.//This is an automatic reply.

Spudra commented 2 months ago

I downgraded my pip to 24.0 and now the pip install --editable command ran smoothly! Somebody else mentioned downgrading to 20, but that only caused other problems for me.

WFAR0 commented 2 months ago

I downgraded my pip to 24.0 and now the pip install --editable command ran smoothly! Somebody else mentioned downgrading to 20, but that only caused other problems for me.

same here, pip install pip == 24 after that fairseq downloaded fine

stet-stet commented 1 month ago

Can confirm - downgrading pip from 24.2 to 24.0 solved it for me. Fresh conda venv with Python 3.10.

gustavoruske commented 1 month ago

It works for me too, thx!

Kishlay-notabot commented 1 month ago

Downgrading doesn't work at all. Tried pip 19, 24.0, 24.1

ak4off commented 4 weeks ago

Downgraded to pip 20

The problem may start with the pip version. I have downgraded to ver 20 and then it works. Issue close.

ImportError: cannot import name 'SourceDistribution' from 'pip._internal.distributions.source'

zhaone commented 4 days ago

I downgraded my pip to 24.0 and now the pip install --editable command ran smoothly! Somebody else mentioned downgrading to 20, but that only caused other problems for me.

same here, pip install pip == 24 after that fairseq downloaded fine

It works for me!