Skip to content

Make TorchText installable from direct reference #1154

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

Closed

Conversation

malfet
Copy link
Contributor

@malfet malfet commented Feb 12, 2021

In order to make pip install https://github.com/pytorch/text succeed
setup.py should have logic to initialize submodules

Add check_submodules() routine to setup.py to check if
'third_party/re2/CMakeLists.txt' is present on the filesystem and
attempt to initialize submodules if it is not

In order to make `pip install https://github.com/pytorch/text` succeed
`setup.py` should have logic to initialize submodules

Add `check_submodules()` routine to setup.py to check if
'third_party/re2/CMakeLists.txt' is present on the filesystem and
attempt to initialize submodules if it is not
@malfet malfet force-pushed the malfet/make-torchtext-installable-from-direct-source branch from 3036a2b to 26ffbe5 Compare February 12, 2021 22:32
third_party_dir = ROOT_DIR / 'third_party'
if not (third_party_dir / 're2' / 'CMakeFiles.txt').exists():
print(' --- third_party/re2/CMakeFiles.txt do not exist, trying to init submodules')
try:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PyTorch fails and asks the user to do it manually. I worry that this might cause issues when someone wants to debug / modify the submodules and then subsequently runs setup.py. Are there similar plans for PyTorch as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpuhrsch yes, I plan to make similar change for pytorch as well, although Pytorch is less likely to be built directly from source (building TorchText using direct link takes less than 15 min, whereas for PyTorch, especially with GPU support will likely to take more than an hour)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the context of this work? Are we going to do the same for torchaudio (which I support)?

mthrok added a commit to mthrok/text that referenced this pull request Jun 23, 2022
This commit adds `git` submodule initialization commands at the beginning
of setup, so that third party modules become available automatically.

This makes it possible to install torchtext with a command like
`pip install --no-use-pep517 git+https://github.com/pytorch/text.git`

See also:
- pytorch#1154
- pytorch/audio#1966
@mthrok mthrok closed this in #1805 Jun 23, 2022
mthrok added a commit that referenced this pull request Jun 23, 2022
* Automatically initialize submodule

This commit adds `git` submodule initialization commands at the beginning
of setup, so that third party modules become available automatically.

This makes it possible to install torchtext with a command like
`pip install --no-use-pep517 git+https://github.com/pytorch/text.git`

See also:
- #1154
- pytorch/audio#1966
@malfet malfet deleted the malfet/make-torchtext-installable-from-direct-source branch June 24, 2022 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants