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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

External libraries cannot have a requirements.txt that needs to install a cpp_extension #82132

Open
zou3519 opened this issue Jul 25, 2022 · 0 comments
Labels
module: cpp-extensions Related to torch.utils.cpp_extension triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@zou3519
Copy link
Contributor

zou3519 commented Jul 25, 2022

馃悰 Describe the bug

If an external library (e.g. pytorch/tutorials) has a requirements.txt with the following:

torch
git+https://github.com/pytorch/functorch.git@v0.2.0

then pip install -r requirements.txt errors out with "module torch not found". Here's why:

  1. pip reads requirements.txt
  2. pip tries to determine each package's dependencies before installing anything
  3. pip tries to read functorch's dependencies by running its setup.py
  4. functorch's setup.py imports torch to get the cpp_extension
  5. torch does not exist, so python throws an error

This was discovered in pytorch/tutorials#1968

Pitch

People might need to pin libraries like this (I'm surprised this is the first time we've run into it). So it would be cool if we could offer a way for pip to read the torch dependency in a c++ extension library (e.g. functorch) without actually importing torch.

I am not sure if this is actually possible, since we need to pass setup.py a BuildExtension object somehow

Versions

main

cc @malfet @zou3519

@zou3519 zou3519 added the module: cpp-extensions Related to torch.utils.cpp_extension label Jul 25, 2022
@samdow samdow added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Jul 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: cpp-extensions Related to torch.utils.cpp_extension triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests

2 participants