Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in setup.py when installing the package from a fresh conda environment #188

Open
anthonyhu opened this issue Apr 24, 2023 · 7 comments

Comments

@anthonyhu
Copy link
Contributor

anthonyhu commented Apr 24, 2023

Hello! I'm trying to install flash attention in a fresh conda environment using pip install flash-attn==1.0.3, but I'm getting the following error message:

Collecting flash_attn==1.0.3
  Using cached flash_attn-1.0.3.tar.gz (2.0 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-a4qarcrp/flash-attn_543da69ff06f400dbac3604ba0164302/setup.py", line 6, in <module>
          from packaging.version import parse, Version
      ModuleNotFoundError: No module named 'packaging'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

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

Do you know where this is coming from? :)


To reproduce:
conda create -n test-env python=3.9 && conda activate test-env && pip install flash-attn==1.0.3

Thanks!

@huddyyeo
Copy link

I've noticed this too!

@StrangeTcy
Copy link

Did you try installing it explicitly, like conda install -c conda-forge packaging?

@anthonyhu
Copy link
Contributor Author

The installation works if packaging is already in the environment. However in my use case this is not possible. I need to have flash-attn==1.0.3 in a requirements.txt file and install the requirements doing something like pip install -r requirements.txt. When doing this, I get the error above (even when adding packaging as an entry in the requirements.txt file)

@tridao
Copy link
Contributor

tridao commented Apr 25, 2023

I suspect if you list two packages in a requirements.txt file, pip might not necessarily install them in the order.

@anthonyhu
Copy link
Contributor Author

Thanks for the responses! I've created a tentative PR #193 that resolves this issue. Let me know what you think :)

@anthonyhu
Copy link
Contributor Author

FlashAttention v2 is really impressive in terms of training speed. Thank you for that. I am still running into the same issue when installing the package 😢 . Do you think there is a way to add back the pyproject.toml file? (see #193)

@tridao
Copy link
Contributor

tridao commented Jul 18, 2023

We tried pyproject.toml for a while but that caused issues with some other setups regarding pytorch versions etc. I'm not experienced in package distribution, but My impression is that it's hard to specify pytorch dependency, since people could have Pytorch installed by pip or conda or their own local version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants