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

poetry install -E all fails because torch` undetected #5048

Closed
14 tasks
startakovsky opened this issue May 21, 2023 · 10 comments
Closed
14 tasks

poetry install -E all fails because torch` undetected #5048

startakovsky opened this issue May 21, 2023 · 10 comments

Comments

@startakovsky
Copy link
Contributor

System Info

MacOS Ventura, zshell
pyenv virtualenv 3.11 langchain, clean environment
pyenv local langchain, automatically activate environment
curl -sSL https://install.python-poetry.org | python -, install poetry
export PATH="/Users/steven/.local/bin:$PATH, added this to allow for poetry to be accessible
pip install --upgrade pip
pip install torch
poetry install -E all

yields the following output. Strange.

 • Installing torch (1.13.1): Failed

  RuntimeError

  Unable to find installation candidates for torch (1.13.1)

  at ~/Library/Application Support/pypoetry/venv/lib/python3.11/site-packages/poetry/installation/chooser.py:76 in choose_for
       72│
       73│             links.append(link)
       74│
       75│         if not links:
    →  76│             raise RuntimeError(f"Unable to find installation candidates for {package}")
       77│
       78│         # Get the best link
       79│         chosen = max(links, key=lambda link: self._sort_key(package, link))
       80│

Who can help?

@hwchase17 This is install related and while I have langchain running fine from pip in another virtual environment running the same python version (3.11.3), things with poetry are not working well.

Information

  • The official example notebooks/scripts
  • My own modified scripts

Related Components

  • LLMs/Chat Models
  • Embedding Models
  • Prompts / Prompt Templates / Prompt Selectors
  • Output Parsers
  • Document Loaders
  • Vector Stores / Retrievers
  • Memory
  • Agents / Agent Executors
  • Tools / Toolkits
  • Chains
  • Callbacks/Tracing
  • Async

Reproduction

MacOS Ventura, zshell
pyenv virtualenv 3.11 langchain, clean environment
pyenv local langchain, automatically activate environment
curl -sSL https://install.python-poetry.org | python -, install poetry
export PATH="/Users/steven/.local/bin:$PATH, added this to allow for poetry to be accessible
pip install --upgrade pip
pip install torch
poetry install -E all

Expected behavior

 • Installing torch (1.13.1): Failed

  RuntimeError

  Unable to find installation candidates for torch (1.13.1)

  at ~/Library/Application Support/pypoetry/venv/lib/python3.11/site-packages/poetry/installation/chooser.py:76 in choose_for
       72│
       73│             links.append(link)
       74│
       75│         if not links:
    →  76│             raise RuntimeError(f"Unable to find installation candidates for {package}")
       77│
       78│         # Get the best link
       79│         chosen = max(links, key=lambda link: self._sort_key(package, link))
       80│
@AvikantSrivastava
Copy link

Hi @startakovsky
can you take a look at #2991
It looks like a duplicate issue

hope it helps, thanks

@startakovsky
Copy link
Contributor Author

@AvikantSrivastava you are correct, I just deleted my virtual environment and built on top of python 3.9(latest) instead of 3.11.

@AvikantSrivastava
Copy link

Cool @startakovsky
I think we can close this issue now

@jcf
Copy link

jcf commented Jul 10, 2023

PyTorch supports Python 3.11 as of last month.

Is it possible to relax the version constraint on PyTorch to enable the use of Python 3.11 in projects dependent on LangChain?

@yordis
Copy link

yordis commented Jul 21, 2023

Hey peeps, any updates on this one? I am a first-timer in python development, so I am unsure how to deal with the situation.

[tool.poetry.dependencies]
python = "3.11.4"
langchain = { version = "0.0.238", extras = ["all", "llms"] }

@trancethehuman
Copy link
Contributor

If anyone still runs into this issue, it's because the PyTorch version in langchain isn't supported in Python version >=3.9.

To fix this, assuming you want to contribute to libs/langchain, and you're on Mac:

  1. Download Python 3.9 from official source and install it.
  2. Open your langchain's root directory.
cd ~/langchain
  1. Create a new virtual environment using Python 3.9 (if you've already had one, might be best to just delete it and start over by running rm -r NAME_OF_ENVIRONMENT_FOLDER
python3.9 -m venv langchain
  1. Activate that virtual environment
source langchain/bin/activate
  1. Make sure you're running Python 3.9 in that virtual environment
python3 --version

This should say Python 3.9

  1. Continue with installing dependencies

@dosubot
Copy link

dosubot bot commented Oct 28, 2023

Hi, @startakovsky! I'm Dosu, and I'm helping the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.

From what I understand, the issue you reported was about the installation of torch failing when running poetry install -E all. It seems that @hwchase17 was mentioned as someone who might be able to help. @AvikantSrivastava suggested that it might be a duplicate issue and recommended checking another GitHub issue. You confirmed that the issue was resolved by deleting the virtual environment and building on top of Python 3.9 instead of 3.11.

Before we close this issue, we wanted to check with you if it is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days.

Thank you for your contribution to the LangChain repository! Let us know if you have any further questions or concerns.

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Oct 28, 2023
@nilsbunger
Copy link

I hit this issue last week. I think it's a valid issue for python 3.10+

@dosubot dosubot bot removed the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Oct 28, 2023
@dosubot
Copy link

dosubot bot commented Oct 28, 2023

@baskaryan Could you please help @nilsbunger with this issue? They encountered the same problem with the installation of torch failing on Python 3.10+. Thank you!

Copy link

dosubot bot commented Feb 6, 2024

Hi, @startakovsky,

I'm helping the LangChain team manage their backlog and am marking this issue as stale. From what I understand, the issue was opened regarding the installation of torch using Poetry in a specific virtual environment. It was suggested that the issue might be a duplicate, and you later confirmed that the issue was resolved by switching to Python 3.9 instead of 3.11. There were also discussions about the compatibility of PyTorch with Python versions and a suggestion to relax the version constraint on PyTorch. Additionally, a user provided a detailed solution for fixing the issue by using Python 3.9 in the virtual environment.

Could you please confirm if this issue is still relevant to the latest version of the LangChain repository, especially for Python 3.10+? If it is, please let the LangChain team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days. Thank you!

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Feb 6, 2024
@dosubot dosubot bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 13, 2024
@dosubot dosubot bot removed the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Feb 13, 2024
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

6 participants