Skip to content

Conversation

@JasonLi1909
Copy link
Contributor

Currently, users that import ray.tune can run into an ImportError if they do not have pydantic installed. This is because ray.tune imports ray.train, which requires pydantic. This PR prevents this error by adding pydantic as a ray tune dependency.

Relevant user issue: #58280

Signed-off-by: JasonLi1909 <jasli1909@gmail.com>
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly addresses an ImportError for pydantic when using ray.tune by adding it to the [tune] extra dependencies. The change is straightforward and necessary.

I've added one comment regarding a minor code redundancy this change introduces in the definition of the [train] extras, which could be cleaned up.

Additionally, to provide a clearer error message to users who have not installed the [tune] extras, you might consider adding import pydantic to the try-except block in python/ray/tune/__init__.py. This would make the dependency check more explicit at import time.

cursor[bot]

This comment was marked as outdated.

Signed-off-by: JasonLi1909 <jasli1909@gmail.com>
@ray-gardener ray-gardener bot added the tune Tune-related issues label Nov 2, 2025
@aslonnie aslonnie requested a review from matthewdeng November 3, 2025 06:23
@matthewdeng matthewdeng enabled auto-merge (squash) November 6, 2025 22:23
@github-actions github-actions bot added the go add ONLY when ready to merge, run all tests label Nov 6, 2025
@matthewdeng matthewdeng merged commit cef9665 into ray-project:master Nov 6, 2025
8 checks passed
YoussefEssDS pushed a commit to YoussefEssDS/ray that referenced this pull request Nov 8, 2025
Currently, users that import ray.tune can run into an ImportError if
they do not have pydantic installed. This is because ray.tune imports
ray.train, which requires pydantic. This PR prevents this error by
adding pydantic as a ray tune dependency.

Relevant user issue: ray-project#58280

---------

Signed-off-by: JasonLi1909 <jasli1909@gmail.com>
JudithBernett added a commit to daisybio/drevalpy that referenced this pull request Nov 14, 2025
landscapepainter pushed a commit to landscapepainter/ray that referenced this pull request Nov 17, 2025
Currently, users that import ray.tune can run into an ImportError if
they do not have pydantic installed. This is because ray.tune imports
ray.train, which requires pydantic. This PR prevents this error by
adding pydantic as a ray tune dependency.

Relevant user issue: ray-project#58280

---------

Signed-off-by: JasonLi1909 <jasli1909@gmail.com>
Aydin-ab pushed a commit to Aydin-ab/ray-aydin that referenced this pull request Nov 19, 2025
Currently, users that import ray.tune can run into an ImportError if
they do not have pydantic installed. This is because ray.tune imports
ray.train, which requires pydantic. This PR prevents this error by
adding pydantic as a ray tune dependency.

Relevant user issue: ray-project#58280

---------

Signed-off-by: JasonLi1909 <jasli1909@gmail.com>
Signed-off-by: Aydin Abiar <aydin@anyscale.com>
@JudithBernett JudithBernett mentioned this pull request Nov 20, 2025
9 tasks
ykdojo pushed a commit to ykdojo/ray that referenced this pull request Nov 27, 2025
Currently, users that import ray.tune can run into an ImportError if
they do not have pydantic installed. This is because ray.tune imports
ray.train, which requires pydantic. This PR prevents this error by
adding pydantic as a ray tune dependency.

Relevant user issue: ray-project#58280

---------

Signed-off-by: JasonLi1909 <jasli1909@gmail.com>
Signed-off-by: YK <1811651+ykdojo@users.noreply.github.com>
SheldonTsen pushed a commit to SheldonTsen/ray that referenced this pull request Dec 1, 2025
Currently, users that import ray.tune can run into an ImportError if
they do not have pydantic installed. This is because ray.tune imports
ray.train, which requires pydantic. This PR prevents this error by
adding pydantic as a ray tune dependency.

Relevant user issue: ray-project#58280

---------

Signed-off-by: JasonLi1909 <jasli1909@gmail.com>
Future-Outlier pushed a commit to Future-Outlier/ray that referenced this pull request Dec 7, 2025
Currently, users that import ray.tune can run into an ImportError if
they do not have pydantic installed. This is because ray.tune imports
ray.train, which requires pydantic. This PR prevents this error by
adding pydantic as a ray tune dependency.

Relevant user issue: ray-project#58280

---------

Signed-off-by: JasonLi1909 <jasli1909@gmail.com>
Signed-off-by: Future-Outlier <eric901201@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests tune Tune-related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants