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

build: added separate requirement file for torch #599

Merged
merged 2 commits into from
Sep 19, 2024

Conversation

mrava87
Copy link
Collaborator

@mrava87 mrava87 commented Aug 9, 2024

Closes #597 by adding a requirements-torch.txt file that installs PyTorch from a specific index.

We have also simplified the GA installation process removing unneeded if [ -f requirements.txt ]; then pip install -r requirements-dev.txt; fi, simply installing all dependencies as follows:

pip install -r requirements-dev.txt
pip install -r requirements-torch.txt

@mrava87 mrava87 marked this pull request as draft August 9, 2024 22:22
@mrava87
Copy link
Collaborator Author

mrava87 commented Aug 10, 2024

@cako can you check that this is doing what you suggested 😄

@mrava87 mrava87 requested a review from cako August 10, 2024 08:24
@mrava87 mrava87 marked this pull request as ready for review August 16, 2024 20:40
Copy link
Collaborator

@cako cako left a comment

Choose a reason for hiding this comment

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

@mrava87 I changed --extra-index-url to --index-url in the requirements-torch.txt file. This ensures that only one index (the pytorch one) is used. However, it means that all requirements must be already installed. Torch is the last one to be installed so this should be fine.

@mrava87
Copy link
Collaborator Author

mrava87 commented Aug 19, 2024

Alright!

Let me give it a try. I assume you mean that if I run the pip install command with requirements-torch.txt after that with requirements.txt, the only extra package that should be installed is torch (otherwise any of the other will come from this index instead of the official PyPI?)

@mrava87
Copy link
Collaborator Author

mrava87 commented Sep 2, 2024

@cako I finally got some time to go back to this.. I tried the following:

conda create -n pylops_torchafter python=3.11
pip install -r requirements-dev.txt
pip install install -r requirements-torch.txt 

and from the latter command I get:

(pylops_torchafter) KL-23637:pylops ravasim$ pip install -r requirements-torch.txt 
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cpu
Collecting torch>=1.2.0 (from -r requirements-torch.txt (line 2))
  Using cached https://download.pytorch.org/whl/cpu/torch-2.4.0-cp311-none-macosx_11_0_arm64.whl (62.1 MB)
Requirement already satisfied: filelock in /opt/anaconda3/envs/pylops_torchafter/lib/python3.11/site-packages (from torch>=1.2.0->-r requirements-torch.txt (line 2)) (3.15.4)
Requirement already satisfied: typing-extensions>=4.8.0 in /opt/anaconda3/envs/pylops_torchafter/lib/python3.11/site-packages (from torch>=1.2.0->-r requirements-torch.txt (line 2)) (4.12.2)
Requirement already satisfied: sympy in /opt/anaconda3/envs/pylops_torchafter/lib/python3.11/site-packages (from torch>=1.2.0->-r requirements-torch.txt (line 2)) (1.13.2)
Collecting networkx (from torch>=1.2.0->-r requirements-torch.txt (line 2))
  Using cached networkx-3.3-py3-none-any.whl.metadata (5.1 kB)
Requirement already satisfied: jinja2 in /opt/anaconda3/envs/pylops_torchafter/lib/python3.11/site-packages (from torch>=1.2.0->-r requirements-torch.txt (line 2)) (3.1.4)
Collecting fsspec (from torch>=1.2.0->-r requirements-torch.txt (line 2))
  Using cached fsspec-2024.6.1-py3-none-any.whl.metadata (11 kB)
Requirement already satisfied: MarkupSafe>=2.0 in /opt/anaconda3/envs/pylops_torchafter/lib/python3.11/site-packages (from jinja2->torch>=1.2.0->-r requirements-torch.txt (line 2)) (2.1.5)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in /opt/anaconda3/envs/pylops_torchafter/lib/python3.11/site-packages (from sympy->torch>=1.2.0->-r requirements-torch.txt (line 2)) (1.3.0)
Using cached fsspec-2024.6.1-py3-none-any.whl (177 kB)
Using cached networkx-3.3-py3-none-any.whl (1.7 MB)
Installing collected packages: networkx, fsspec, torch

I think this looks good to go, do you agree?

@mrava87
Copy link
Collaborator Author

mrava87 commented Sep 13, 2024

@cako checking that you saw this.. if you agree, I would like to merge this PR?

@mrava87 mrava87 merged commit ea8fff0 into PyLops:dev Sep 19, 2024
13 checks passed
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

Successfully merging this pull request may close these issues.

Torch installation with requirement.txt file
2 participants