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

Pandas Package import is not reinforced #5296

Closed
ashwinsnambiar opened this issue Mar 5, 2024 · 1 comment
Closed

Pandas Package import is not reinforced #5296

ashwinsnambiar opened this issue Mar 5, 2024 · 1 comment
Labels
bug Issue/PR about behavior that is broken. Not for typos/examples/CI/test but for Optuna itself.

Comments

@ashwinsnambiar
Copy link

ashwinsnambiar commented Mar 5, 2024

Expected behavior

While trying to use the study.trials_dataframe() functions, pandas dataframe object is returned. But since the setup.py doesn't have a requirement to install panda package, it causes an error. In optuna.study._dataframe.py file, there is a check to try importing pandas if available. There is no exception cause here. Should pandas be set as a requirement?

Environment

  • Optuna version:3.5.0
  • Python version:3.10.13
  • OS:Linux-5.15.0-94-generic-x86_64-with-glibc2.31
  • (Optional) Other libraries and their versions:

Error messages, stack traces, or logs

ImportError: Tried to import 'pandas' but failed. Please make sure that the package is installed correctly to use this feature. Actual error: No module named 'pandas'.

Steps to reproduce

1.Run any study

# python code
study.trials_dataframe().to_csv("study_results.csv")

Additional context (optional)

No response

@ashwinsnambiar ashwinsnambiar added the bug Issue/PR about behavior that is broken. Not for typos/examples/CI/test but for Optuna itself. label Mar 5, 2024
@nzw0301
Copy link
Member

nzw0301 commented Mar 5, 2024

pandas is an optional package as defined in

optuna/pyproject.toml

Lines 83 to 95 in d132cd9

optional = [
"boto3", # optuna/artifacts/_boto3.py.
"cmaes>=0.10.0", # optuna/samplers/_cmaes.py.
"google-cloud-storage", # optuna/artifacts/_gcs.py.
"matplotlib!=3.6.0", # optuna/visualization/matplotlib.
"pandas", # optuna/study.py.
"plotly>=4.9.0", # optuna/visualization.
"redis", # optuna/storages/redis.py.
"scikit-learn>=0.24.2",
# optuna/visualization/param_importances.py.
"scipy", # optuna/samplers/_gp
"torch", # optuna/samplers/_gp
]
.

@nzw0301 nzw0301 closed this as completed Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue/PR about behavior that is broken. Not for typos/examples/CI/test but for Optuna itself.
Projects
None yet
Development

No branches or pull requests

2 participants