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

cph extract fails on .conda files because of missing requests package #279

Open
2 tasks done
jtilly opened this issue Jan 8, 2025 · 1 comment
Open
2 tasks done
Labels
type::bug describes erroneous operation, use severity::* to classify the type

Comments

@jtilly
Copy link

jtilly commented Jan 8, 2025

Checklist

  • I added a descriptive title
  • I searched open reports and couldn't find a duplicate

What happened?

When I install conda-packaging-handling from conda-forge and run cph extract on a .conda package, I get the following error:

➜  /tmp micromamba create -p /tmp/cph conda-package-handling
conda-forge/osx-arm64                                         No change
conda-forge/noarch                                  23.3MB @   5.6MB/s  4.1s

Transaction

  Prefix: /private/tmp/cph

  Updating specs:

   - conda-package-handling


  Package                       Version  Build               Channel           Size
─────────────────────────────────────────────────────────────────────────────────────
  Install:
─────────────────────────────────────────────────────────────────────────────────────

  + libexpat                      2.6.4  h286801f_0          conda-forge     Cached
  + libmpdec                      4.0.0  h99b78c6_0          conda-forge     Cached
  + python_abi                     3.13  5_cp313             conda-forge     Cached
  + libzlib                       1.3.1  h8359307_2          conda-forge     Cached
  + ncurses                         6.5  h7bae524_1          conda-forge     Cached
  + bzip2                         1.0.8  h99b78c6_7          conda-forge     Cached
  + libffi                        3.4.2  h3422bc3_5          conda-forge     Cached
  + liblzma                       5.6.3  h39f12f2_1          conda-forge     Cached
  + ca-certificates          2024.12.14  hf0a4a13_0          conda-forge     Cached
  + tk                           8.6.13  h5083fa2_1          conda-forge     Cached
  + zstd                          1.5.6  hb46c0d2_0          conda-forge     Cached
  + libsqlite                    3.47.2  h3f77e49_0          conda-forge     Cached
  + readline                        8.2  h92ec313_1          conda-forge     Cached
  + openssl                       3.4.0  h81ee809_1          conda-forge     Cached
  + tzdata                        2024b  hc8b5060_0          conda-forge     Cached
  + python                       3.13.1  h4f43103_103_cp313  conda-forge     Cached
  + pip                          24.3.1  pyh145f28c_2        conda-forge     Cached
  + pycparser                      2.22  pyh29332c3_1        conda-forge     Cached
  + cffi                         1.17.1  py313hc845a76_0     conda-forge     Cached
  + zstandard                    0.23.0  py313hf2da073_1     conda-forge     Cached
  + conda-package-streaming      0.11.0  pyhd8ed1ab_0        conda-forge     Cached
  + conda-package-handling        2.4.0  pyha770c72_1        conda-forge     Cached

  Summary:

  Install: 22 packages

  Total download: 0 B

─────────────────────────────────────────────────────────────────────────────────────


Confirm changes: [Y/n] 

Transaction starting
Linking libexpat-2.6.4-h286801f_0
Linking libmpdec-4.0.0-h99b78c6_0
Linking python_abi-3.13-5_cp313
Linking libzlib-1.3.1-h8359307_2
Linking ncurses-6.5-h7bae524_1
Linking bzip2-1.0.8-h99b78c6_7
Linking libffi-3.4.2-h3422bc3_5
Linking liblzma-5.6.3-h39f12f2_1
Linking ca-certificates-2024.12.14-hf0a4a13_0
Linking tk-8.6.13-h5083fa2_1
Linking zstd-1.5.6-hb46c0d2_0
Linking libsqlite-3.47.2-h3f77e49_0
Linking readline-8.2-h92ec313_1
Linking openssl-3.4.0-h81ee809_1
Linking tzdata-2024b-hc8b5060_0
Linking python-3.13.1-h4f43103_103_cp313
Linking pip-24.3.1-pyh145f28c_2
Linking pycparser-2.22-pyh29332c3_1
Linking cffi-1.17.1-py313hc845a76_0
Linking zstandard-0.23.0-py313hf2da073_1
Linking conda-package-streaming-0.11.0-pyhd8ed1ab_0
Linking conda-package-handling-2.4.0-pyha770c72_1

Transaction finished

To activate this environment, use:

    micromamba activate /private/tmp/cph

Or to execute a single command in this environment, use:

    micromamba run -p /private/tmp/cph mycommand

 ➜  /tmp micromamba activate /private/tmp/cph
 ➜  /tmp cph extract python-3.13.1-ha99a958_103_cp313.conda 
/private/tmp/cph/lib/python3.13/site-packages/conda_package_handling/api.py:29: UserWarning: Install zstandard Python bindings for .conda support
  _warnings.warn("Install zstandard Python bindings for .conda support")
Traceback (most recent call last):
  File "/private/tmp/cph/bin/cph", line 10, in <module>
    sys.exit(main())
             ~~~~^^
  File "/private/tmp/cph/lib/python3.13/site-packages/conda_package_handling/cli.py", line 140, in main
    api.extract(args.archive_path, args.dest, prefix=args.prefix)
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/private/tmp/cph/lib/python3.13/site-packages/conda_package_handling/api.py", line 67, in extract
    dest_dir = _os.path.join(
        prefix or _os.path.dirname(fn),
        get_default_extracted_folder(fn, abspath=False),
    )
  File "<frozen posixpath>", line 90, in join
  File "<frozen genericpath>", line 188, in _check_arg_types
TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'

This can be fixed by installing the requests package.

The try / except in

try:
from .conda_fmt import ZSTD_COMPRESS_LEVEL, ZSTD_COMPRESS_THREADS
from .conda_fmt import CondaFormat_v2 as _CondaFormat_v2
SUPPORTED_EXTENSIONS[".conda"] = _CondaFormat_v2
libarchive_enabled = True
except ImportError:
_warnings.warn("Install zstandard Python bindings for .conda support")

is a bit too broad and leads to a confusing warning, because I do have zstandard installed.

I see that the recipe in this repo has

listed as explicit dependency (added in #254).

The conda-forge feedstock repo doesn't include requests: https://github.com/conda-forge/conda-package-handling-feedstock/blob/da6a80bc3da0c317786ddce08112976d48c3fbdf/recipe/meta.yaml#L27-L31

Is it worth raising a better warning/error here or should this just be fixed in the feedstock repo?

Additional Context

No response

@jtilly jtilly added the type::bug describes erroneous operation, use severity::* to classify the type label Jan 8, 2025
@github-project-automation github-project-automation bot moved this to 🆕 New in 🧭 Planning Jan 8, 2025
@dholth
Copy link
Contributor

dholth commented Jan 10, 2025

This line grabs requests for the "list remote" feature. https://github.com/conda/conda-package-handling/blob/main/src/conda_package_handling/conda_fmt.py#L20

Probably easiest to make requests a mandatory dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type::bug describes erroneous operation, use severity::* to classify the type
Projects
Status: 🆕 New
Development

No branches or pull requests

2 participants