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

Add run_constrained for optional dependencies #187

Closed
duncanmmacleod opened this issue Oct 24, 2023 · 5 comments · Fixed by #212
Closed

Add run_constrained for optional dependencies #187

duncanmmacleod opened this issue Oct 24, 2023 · 5 comments · Fixed by #212
Labels

Comments

@duncanmmacleod
Copy link

Comment:

Currently, installing pandas doesn't constrain the versions of any of the 'optional-dependencies' specified in the project's metadata. This means its easy to find yourself in situations where importing pandas results in warnings being emitted (slightly contrived example):

$ mamba create -n test pandas numexpr=2.7
$ conda activate test
$ python3 -c "import pandas"
/home/duncan/opt/mambaforge/envs/test/lib/python3.10/site-packages/numexpr/expressions.py:21: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  _np_version_forbids_neg_powint = LooseVersion(numpy.__version__) >= LooseVersion('1.12.0b1')
/home/duncan/opt/mambaforge/envs/test/lib/python3.10/site-packages/pandas/core/computation/expressions.py:21: UserWarning: Pandas requires version '2.8.0' or newer of 'numexpr' (version '2.7.3' currently installed).
  from pandas.core.computation.check import NUMEXPR_INSTALLED

Is it reasonable to add requirements/run_constrained to this recipe to map the version constraints for the optional dependencies?

I worry about the scope of this, given that there are ~35 optional dependencies, all with version constraints, and I don't want to burden the maintainers of this feedstock with more grunt work.

@rootsmusic
Copy link

rootsmusic commented Jan 11, 2024

Pandas requires version '2.8.0' or newer of 'numexpr' (version '2.7.3' currently installed).

This UserWarning is correct, because you specified numexpr=2.7. Version constraints doesn't apply when installing optional dependencies individually. For example, pip install "pandas[performance]" would constrain numexpr>=2.8.4 (as specified starting on line 65 in pyproject.toml).

@duncanmmacleod
Copy link
Author

@rootsmusic, I (think I) understand the reason for the warning, what I'm asking here is if it's reasonable to modify the conda package to avoid the warning (basically to prevent the user from being able to build an environment that would emit a warning).

@jefsayshi
Copy link
Contributor

@rootsmusic It looks like conda-main added the constraints. It would be helpful if conda-forge did as well.
My particular use case is sqlalchemy=1.4 and pandas.
Using conda-forge:

mamba create -n test-pandas python=3.10 sqlalchemy=1.4 pandas -c conda-forge --override-channels

pandas               2.2.2
sqlalchemy          1.4.49

Using conda-main:

mamba create -n test-pandas python=3.10 sqlalchemy=1.4 pandas -c conda-main --override-channels

pandas                 2.1.4
sqlalchemy            1.4.51

As pandas deprecated support for sqlalchemy 1.4 with pandas 2.2.0, only the conda-main solve results in a working environment. https://pandas.pydata.org/docs/dev/whatsnew/v2.2.0.html#increased-minimum-versions-for-dependencies

@rootsmusic
Copy link

@jefsayshi Will #211 resolve this issue?

@jefsayshi
Copy link
Contributor

@rootsmusic It doesn't appear that any run_constrained were added to meta.yml so it is unlikely to resolve the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants