conda-forge / cdflib-feedstock

A conda-smithy repository for cdflib.
BSD 3-Clause "New" or "Revised" License
1 stars 5 forks source link

pip check fails #9

Closed smithara closed 6 days ago

smithara commented 1 year ago

Solution to issue cannot be found in the documentation.

Issue

Found when creating feedstock for viresclient (https://github.com/conda-forge/staged-recipes/pull/20918) which depends on cdflib

In an environment without attrs, running pip check with cdflib fails because attrs is not included in the conda recipe but it is in the pip dependencies

$ pip check
cdflib 0.4.7 requires attrs, which is not installed.

Installed packages

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
astropy                   5.1              py38h71d37f0_0    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
ca-certificates           2022.9.24            ha878542_0    conda-forge
cdflib                    0.4.7              pyhd8ed1ab_0    conda-forge
importlib-metadata        5.0.0              pyha770c72_1    conda-forge
ld_impl_linux-64          2.39                 hc81fddc_0    conda-forge
libblas                   3.9.0           16_linux64_openblas    conda-forge
libcblas                  3.9.0           16_linux64_openblas    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 12.2.0              h65d4601_19    conda-forge
libgfortran-ng            12.2.0              h69a702a_19    conda-forge
libgfortran5              12.2.0              h337968e_19    conda-forge
libgomp                   12.2.0              h65d4601_19    conda-forge
liblapack                 3.9.0           16_linux64_openblas    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libopenblas               0.3.21          pthreads_h78a6416_3    conda-forge
libsqlite                 3.39.4               h753d276_0    conda-forge
libstdcxx-ng              12.2.0              h46fd767_19    conda-forge
libuuid                   2.32.1            h7f98852_1000    conda-forge
libzlib                   1.2.13               h166bdaf_4    conda-forge
ncurses                   6.3                  h27087fc_1    conda-forge
numpy                     1.23.4           py38h7042d01_1    conda-forge
openssl                   3.0.5                h166bdaf_2    conda-forge
packaging                 21.3               pyhd8ed1ab_0    conda-forge
pandas                    1.5.1            py38h8f669ce_1    conda-forge
pip                       22.3               pyhd8ed1ab_0    conda-forge
pyerfa                    2.0.0.1          py38h26c90d9_3    conda-forge
pyparsing                 3.0.9              pyhd8ed1ab_0    conda-forge
python                    3.8.13          ha86cf86_0_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python_abi                3.8                      2_cp38    conda-forge
pytz                      2022.5             pyhd8ed1ab_0    conda-forge
pyyaml                    6.0              py38h0a891b7_5    conda-forge
readline                  8.1.2                h0f457ee_0    conda-forge
setuptools                65.5.0             pyhd8ed1ab_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
sqlite                    3.39.4               h4ff8645_0    conda-forge
tk                        8.6.12               h27826a3_0    conda-forge
wheel                     0.37.1             pyhd8ed1ab_0    conda-forge
xarray                    2022.10.0          pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
yaml                      0.2.5                h7f98852_2    conda-forge
zipp                      3.10.0             pyhd8ed1ab_0    conda-forge

Environment info

-
smithara commented 1 year ago

@dstansby Sorry it looks like the new cdflib conda package can also fail pip check because pip reports the version as 0.0.0:

+ pip check
viresclient 0.11.0 has requirement cdflib>=0.3.9, but you have cdflib 0.0.0.

In a new environment (from mamba create --name cdflib python=3.10 cdflib):

$ mamba list | grep cdflib
cdflib                    0.4.8              pyhd8ed1ab_0    conda-forge
$ pip list | grep cdflib
cdflib             0.0.0

It might be something to do with setuptools_scm? Installing from the pip package reports 0.4.8 correctly in pip list, but in both cases the __version__ string gives 'unknown'

dstansby commented 1 year ago

Thanks for (re-)reporting. I think I've fixed it at https://github.com/MAVENSDC/cdflib/pull/173, and I've done a release of 0.4.9 on PyPI. Would you be able to re-open your PR to add pip check to the tests here to make sure this doesn't break again?

dstansby commented 1 year ago

This should be fixed now.

smithara commented 1 year ago

Hmm it still seems to be wrong. The __version__ string now reports correctly but pip list (with the conda package) still reports as 0.0.0.

I realised that the pip check added to the recipe here will just check that dependencies are okay so it doesn't catch that error here. i.e. that will only find it if I run pip check for a user of cdflib:

$ pip check cdflib
viresclient 0.11.1 has requirement cdflib>=0.3.9, but you have cdflib 0.0.0.

as in https://github.com/conda-forge/viresclient-feedstock/pull/4

smithara commented 1 year ago

Might be a solution? https://conda-forge.org/docs/maintainer/knowledge_base.html#using-setuptools-scm

Cadair commented 2 weeks ago

Hi @smithara I don't suppose you know if this is still an issue? the pip check command in the CI passes: https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=1010716&view=logs&j=656edd35-690f-5c53-9ba3-09c10d0bea97&t=986b1512-c876-5f92-0d81-ba851554a0a3&l=1026

smithara commented 2 weeks ago

@Cadair sorry I confused the issues here. pip check passes in an environment with just cdflib installed (so passes in the cdflib feedstock build), but can fail when a conda package depending on cdflib is installed, because the cdflib conda package is reported as version 0.0.0 by pip

smithara commented 2 weeks ago

I can get this to show the right version if I change it to install from the wheel instead of the source

i.e. in meta.yaml changing

url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz

to

url: https://pypi.io/packages/py3/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}-py3-none-any.whl

but I haven't figured out why that works.

It is possibly because dynamic = ["version"] is not set in the pyproject.toml?

Cadair commented 2 weeks ago

@smithara Do you want to see if #38 has fixed the issue? I am not convinced it has, but maybe?

smithara commented 6 days ago

I think it is fixed now, thanks!