usnistgov / pyMCR

pyMCR: Multivariate Curve Resolution for Python
https://pages.nist.gov/pyMCR
Other
80 stars 27 forks source link

Fix packaging #41

Closed ericpre closed 2 years ago

ericpre commented 2 years ago

The requirement.txt is not included in the source distribution on pypi and this cause the following issue when trying to install:

Collecting pymcr
  Downloading pyMCR-0.5.0.tar.gz (24 kB)
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /opt/miniforge/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-bjs46cwp/pymcr_a9736cc790594a7ea35e8860862e3703/setup.py'"'"'; __file__='"'"'/tmp/pip-install-bjs46cwp/pymcr_a9736cc790594a7ea35e8860862e3703/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-gta12se2
       cwd: /tmp/pip-install-bjs46cwp/pymcr_a9736cc790594a7ea35e8860862e3703/
  Complete output (5 lines):
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-bjs46cwp/pymcr_a9736cc790594a7ea35e8860862e3703/setup.py", line 11, in <module>
      with open('./requirements.txt','r') as f:
  FileNotFoundError: [Errno 2] No such file or directory: './requirements.txt'
  ----------------------------------------

It should fix the conda-forge package too - see error in https://github.com/conda-forge/pymcr-feedstock/pull/3.

CCampJr commented 2 years ago

Thanks so much @ericpre -- I had no idea about the PEP 517/518 move to python -m build stuff.

ericpre commented 2 years ago

To follow up on this: the conda-forge recipe builds fine with the 0.5.1 release. There are 2 test failures and I am putting the relevant part of the build log in case, this is relevant:

2021-10-26T18:08:19.2195797Z import: 'pymcr'
2021-10-26T18:08:19.4936673Z import: 'pymcr.tests'
2021-10-26T18:08:19.4944152Z import: 'pymcr'
2021-10-26T18:08:19.4951377Z import: 'pymcr.tests'
2021-10-26T18:08:19.5286087Z + pytest --pyargs pymcr
2021-10-26T18:08:19.7410755Z ============================= test session starts ==============================
2021-10-26T18:08:19.7418316Z platform linux -- Python 3.9.7, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
2021-10-26T18:08:19.7424829Z rootdir: $SRC_DIR
2021-10-26T18:08:20.3817835Z collected 61 items
2021-10-26T18:08:20.3820786Z 
2021-10-26T18:08:20.3858201Z tests/test_condition.py .                                                [  1%]
2021-10-26T18:08:20.4503859Z tests/test_constraints.py ...........................                    [ 45%]
2021-10-26T18:08:20.4534696Z tests/test_external_regressors.py .                                      [ 47%]
2021-10-26T18:08:20.8347674Z tests/test_mcr.py F...........                                           [ 67%]
2021-10-26T18:08:21.1073782Z tests/test_mcr_sklearn_like.py F..........                               [ 85%]
2021-10-26T18:08:21.1086246Z tests/test_metrics.py .                                                  [ 86%]
2021-10-26T18:08:21.1234877Z tests/test_regressors.py ........                                        [100%]
2021-10-26T18:08:21.1240163Z 
2021-10-26T18:08:21.1245050Z =================================== FAILURES ===================================
2021-10-26T18:08:21.1251187Z ____________________________ test_mcr_ideal_default ____________________________
2021-10-26T18:08:21.1257187Z 
2021-10-26T18:08:21.1264301Z dataset = (array([[0.  , 1.  ],
2021-10-26T18:08:21.1270759Z        [0.05, 0.95],
2021-10-26T18:08:21.1290719Z        [0.1 , 0.9 ],
2021-10-26T18:08:21.1291268Z        [0.15, 0.85],
2021-10-26T18:08:21.1291696Z        [0.2 , 0.8 ],
2021-10-26T18:08:21.1292090Z        [0.25... 2., 2., 2., 2.,
2021-10-26T18:08:21.1292570Z         0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
2021-10-26T18:08:21.1293032Z         0., 0., 0., 0., 0.]]))
2021-10-26T18:08:21.1293294Z 
2021-10-26T18:08:21.1293683Z     def test_mcr_ideal_default(dataset):
2021-10-26T18:08:21.1294210Z         """ Provides C/St_known so optimal should be 1 iteration """
2021-10-26T18:08:21.1294626Z     
2021-10-26T18:08:21.1295027Z         C_known, D_known, St_known = dataset
2021-10-26T18:08:21.1295510Z     
2021-10-26T18:08:21.1295893Z         mcrar = McrAR()
2021-10-26T18:08:21.1296291Z         mcrar.fit(D_known, ST=St_known)
2021-10-26T18:08:21.1296734Z         assert_equal(1, mcrar.n_iter_opt)
2021-10-26T18:08:21.1297897Z         assert ((mcrar.D_ - D_known)**2).mean() < 1e-10
2021-10-26T18:08:21.1298734Z         assert ((mcrar.D_opt_ - D_known)**2).mean() < 1e-10
2021-10-26T18:08:21.1299237Z     
2021-10-26T18:08:21.1299613Z         mcrar.fit(D_known, C=C_known)
2021-10-26T18:08:21.1300058Z >       assert_equal(2, mcrar.n_iter_opt)
2021-10-26T18:08:21.1300473Z E       AssertionError: 
2021-10-26T18:08:21.1300900Z E       Items are not equal:
2021-10-26T18:08:21.1301296Z E        ACTUAL: 2
2021-10-26T18:08:21.1301699Z E        DESIRED: 1
2021-10-26T18:08:21.1301929Z 
2021-10-26T18:08:21.1303756Z ../_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_/lib/python3.9/site-packages/pymcr/tests/test_mcr.py:47: AssertionError
2021-10-26T18:08:21.1305036Z ----------------------------- Captured stdout call -----------------------------
2021-10-26T18:08:21.1305676Z Error increased above fractional tol_increase (ST iter). Exiting
2021-10-26T18:08:21.1306198Z Error increased above fractionalctol_increase (C iter). Exiting
2021-10-26T18:08:21.1306993Z ------------------------------ Captured log call -------------------------------
2021-10-26T18:08:21.1307641Z INFO     pymcr.mcr:mcr.py:508 Error increased above fractional tol_increase (ST iter). Exiting
2021-10-26T18:08:21.1308293Z INFO     pymcr.mcr:mcr.py:422 Error increased above fractionalctol_increase (C iter). Exiting
2021-10-26T18:08:21.1308896Z ________________________ test_sklearn_mcr_ideal_default ________________________
2021-10-26T18:08:21.1309221Z 
2021-10-26T18:08:21.1309571Z dataset = (array([[0.  , 1.  ],
2021-10-26T18:08:21.1309977Z        [0.05, 0.95],
2021-10-26T18:08:21.1310363Z        [0.1 , 0.9 ],
2021-10-26T18:08:21.1310727Z        [0.15, 0.85],
2021-10-26T18:08:21.1311102Z        [0.2 , 0.8 ],
2021-10-26T18:08:21.1311480Z        [0.25... 2., 2., 2., 2.,
2021-10-26T18:08:21.1311956Z         0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
2021-10-26T18:08:21.1312421Z         0., 0., 0., 0., 0.]]))
2021-10-26T18:08:21.1312679Z 
2021-10-26T18:08:21.1313074Z     def test_sklearn_mcr_ideal_default(dataset):
2021-10-26T18:08:21.1313588Z         """ Provides C/St_known so optimal should be 1 iteration """
2021-10-26T18:08:21.1314004Z     
2021-10-26T18:08:21.1314394Z         C_known, D_known, St_known = dataset
2021-10-26T18:08:21.1314768Z     
2021-10-26T18:08:21.1315421Z         mcrar = McrAR(fit_kwargs={'ST':St_known})
2021-10-26T18:08:21.1315925Z         mcrar.fit(D_known)
2021-10-26T18:08:21.1316374Z         assert_equal(1, mcrar.n_iter_opt)
2021-10-26T18:08:21.1317082Z         assert ((mcrar.D_ - D_known)**2).mean() < 1e-10
2021-10-26T18:08:21.1317844Z         assert ((mcrar.D_opt_ - D_known)**2).mean() < 1e-10
2021-10-26T18:08:21.1318334Z     
2021-10-26T18:08:21.1318954Z         mcrar = McrAR(fit_kwargs={'C':C_known})
2021-10-26T18:08:21.1319471Z         mcrar.fit(D_known)
2021-10-26T18:08:21.1319884Z >       assert_equal(2, mcrar.n_iter_opt)
2021-10-26T18:08:21.1320520Z E       AssertionError: 
2021-10-26T18:08:21.1320934Z E       Items are not equal:
2021-10-26T18:08:21.1321355Z E        ACTUAL: 2
2021-10-26T18:08:21.1321752Z E        DESIRED: 1
2021-10-26T18:08:21.1321982Z 
2021-10-26T18:08:21.1323180Z ../_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_/lib/python3.9/site-packages/pymcr/tests/test_mcr_sklearn_like.py:49: AssertionError
2021-10-26T18:08:21.1324408Z ----------------------------- Captured stdout call -----------------------------
2021-10-26T18:08:21.1325036Z Error increased above fractional tol_increase (ST iter). Exiting
2021-10-26T18:08:21.1325569Z Error increased above fractionalctol_increase (C iter). Exiting
2021-10-26T18:08:21.1326376Z ------------------------------ Captured log call -------------------------------
2021-10-26T18:08:21.1327057Z INFO     pymcr.mcr:mcr.py:508 Error increased above fractional tol_increase (ST iter). Exiting
2021-10-26T18:08:21.1327690Z INFO     pymcr.mcr:mcr.py:422 Error increased above fractionalctol_increase (C iter). Exiting
2021-10-26T18:08:21.1328302Z =========================== short test summary info ============================
2021-10-26T18:08:21.1329123Z FAILED tests/test_mcr.py::test_mcr_ideal_default - AssertionError: 
2021-10-26T18:08:21.1329998Z FAILED tests/test_mcr_sklearn_like.py::test_sklearn_mcr_ideal_default - Asser...
2021-10-26T18:08:21.1330645Z ========================= 2 failed, 59 passed in 1.38s =========================
2021-10-26T18:08:22.8867874Z Tests failed for pymcr-0.5.1-pyhd8ed1ab_0.tar.bz2 - moving package to /home/conda/feedstock_root/build_artifacts/broken
2021-10-26T18:08:22.8869457Z WARNING:conda_build.build:Tests failed for pymcr-0.5.1-pyhd8ed1ab_0.tar.bz2 - moving package to /home/conda/feedstock_root/build_artifacts/broken
2021-10-26T18:08:22.8870745Z WARNING conda_build.build:tests_failed(2955): Tests failed for pymcr-0.5.1-pyhd8ed1ab_0.tar.bz2 - moving package to /home/conda/feedstock_root/build_artifacts/broken
2021-10-26T18:08:23.1071817Z TESTS FAILED: pymcr-0.5.1-pyhd8ed1ab_0.tar.bz2
2021-10-26T18:41:31.2185764Z   Package               Version  Build                Channel                                                 Size
2021-10-26T18:41:31.2186824Z ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
2021-10-26T18:41:31.2187294Z   Install:
2021-10-26T18:41:31.2187979Z ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
2021-10-26T18:41:31.2188505Z 
2021-10-26T18:41:31.2189092Z   + _libgcc_mutex           0.1  conda_forge          conda-forge/linux-64                                  Cached
2021-10-26T18:41:31.2189836Z   + _openmp_mutex           4.5  1_gnu                conda-forge/linux-64                                  Cached
2021-10-26T18:41:31.2190604Z   + attrs                21.2.0  pyhd8ed1ab_0         conda-forge/noarch                                    Cached
2021-10-26T18:41:31.2191336Z   + ca-certificates   2021.10.8  ha878542_0           conda-forge/linux-64                                  139 KB
2021-10-26T18:41:31.2192070Z   + iniconfig             1.1.1  pyh9f0ad1d_0         conda-forge/noarch                                    Cached
2021-10-26T18:41:31.2192804Z   + joblib                1.1.0  pyhd8ed1ab_0         conda-forge/noarch                                    Cached
2021-10-26T18:41:31.2193532Z   + ld_impl_linux-64     2.36.1  hea4e1c9_2           conda-forge/linux-64                                  667 KB
2021-10-26T18:41:31.2194327Z   + libblas               3.9.0  12_linux64_openblas  conda-forge/linux-64                                   12 KB
2021-10-26T18:41:31.2195117Z   + libcblas              3.9.0  12_linux64_openblas  conda-forge/linux-64                                   12 KB
2021-10-26T18:41:31.2195916Z   + libffi                3.4.2  h9c3ff4c_4           conda-forge/linux-64                                   57 KB
2021-10-26T18:41:31.2196699Z   + libgcc-ng            11.2.0  h1d223b6_11          conda-forge/linux-64                                  887 KB
2021-10-26T18:41:31.2197464Z   + libgfortran-ng       11.2.0  h69a702a_11          conda-forge/linux-64                                  Cached
2021-10-26T18:41:31.2198251Z   + libgfortran5         11.2.0  h5c6108e_11          conda-forge/linux-64                                  Cached
2021-10-26T18:41:31.2199037Z   + libgomp              11.2.0  h1d223b6_11          conda-forge/linux-64                                  427 KB
2021-10-26T18:41:31.2199804Z   + liblapack             3.9.0  12_linux64_openblas  conda-forge/linux-64                                   12 KB
2021-10-26T18:41:31.2200595Z   + libopenblas          0.3.18  pthreads_h8fe5266_0  conda-forge/linux-64                                   10 MB
2021-10-26T18:41:31.2201492Z   + libstdcxx-ng         11.2.0  he4da1e4_11          conda-forge/linux-64                                    4 MB
2021-10-26T18:41:31.2202276Z   + libzlib              1.2.11  h36c2ea0_1013        conda-forge/linux-64                                   59 KB
2021-10-26T18:41:31.2203055Z   + more-itertools       8.10.0  pyhd8ed1ab_0         conda-forge/noarch                                    Cached
2021-10-26T18:41:31.2203823Z   + ncurses                 6.2  h58526e2_4           conda-forge/linux-64                                  985 KB
2021-10-26T18:41:31.2204604Z   + numpy                1.21.3  py39hdbf815f_0       conda-forge/linux-64                                    6 MB
2021-10-26T18:41:31.2205386Z   + openssl               3.0.0  h7f98852_1           conda-forge/linux-64                                  Cached
2021-10-26T18:41:31.2206147Z   + packaging              21.0  pyhd8ed1ab_0         conda-forge/noarch                                    Cached
2021-10-26T18:41:31.2206930Z   + pluggy                1.0.0  py39hf3d152e_1       conda-forge/linux-64                                  Cached
2021-10-26T18:41:31.2207707Z   + py                   1.10.0  pyhd3deb0d_0         conda-forge/noarch                                    Cached
2021-10-26T18:41:31.2208448Z   + pymcr                 0.5.1  pyhd8ed1ab_0         /home/conda/feedstock_root/build_artifacts/noarch      27 KB
2021-10-26T18:41:31.2209227Z   + pyparsing             3.0.1  pyhd8ed1ab_1         conda-forge/noarch                                    Cached
2021-10-26T18:41:31.2209991Z   + pytest                6.2.5  py39hf3d152e_0       conda-forge/linux-64                                  Cached
2021-10-26T18:41:31.2210889Z   + python                3.9.7  hf930737_3_cpython   conda-forge/linux-64                                  Cached
2021-10-26T18:41:31.2211675Z   + python_abi              3.9  2_cp39               conda-forge/linux-64                                  Cached
2021-10-26T18:41:31.2212445Z   + readline                8.1  h46c0cb4_0           conda-forge/linux-64                                  295 KB
2021-10-26T18:41:31.2213230Z   + scikit-learn          1.0.1  py39h7c5d8c9_1       conda-forge/linux-64                                    8 MB
2021-10-26T18:41:31.2214011Z   + scipy                 1.7.1  py39hee8e79c_0       conda-forge/linux-64                                   22 MB
2021-10-26T18:41:31.2214776Z   + setuptools           58.2.0  py39hf3d152e_0       conda-forge/linux-64                                  Cached
2021-10-26T18:41:31.2215555Z   + sqlite               3.36.0  h9cd32fc_2           conda-forge/linux-64                                    1 MB
2021-10-26T18:41:31.2216338Z   + threadpoolctl         3.0.0  pyh8a188c0_0         conda-forge/noarch                                     17 KB
2021-10-26T18:41:31.2217104Z   + tk                   8.6.11  h27826a3_1           conda-forge/linux-64                                    3 MB
2021-10-26T18:41:31.2217883Z   + toml                 0.10.2  pyhd8ed1ab_0         conda-forge/noarch                                    Cached
2021-10-26T18:41:31.2218645Z   + tzdata                2021e  he74cb21_0           conda-forge/noarch                                    Cached
2021-10-26T18:41:31.2219430Z   + xz                    5.2.5  h516909a_1           conda-forge/linux-64                                  343 KB
2021-10-26T18:41:31.2220211Z   + zlib                 1.2.11  h36c2ea0_1013        conda-forge/linux-64                                   86 KB
2021-10-26T18:41:31.2220527Z 
2021-10-26T18:41:31.2220807Z   Summary:
2021-10-26T18:41:31.2220984Z 
2021-10-26T18:41:31.2221262Z   Install: 41 packages
2021-10-26T18:41:31.2221469Z 
2021-10-26T18:41:31.2221714Z   Total download: 59 MB