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

Cannot unpack browser-downloaded .conda files #868

Open
2 tasks done
mfansler opened this issue Jan 9, 2024 · 3 comments
Open
2 tasks done

Cannot unpack browser-downloaded .conda files #868

mfansler opened this issue Jan 9, 2024 · 3 comments
Assignees
Labels
pending::support indicates user is waiting on support from triage engineers severity::1 blocker; broken functionality with no workaround source::community catch-all for issues filed by community members type::bug describes erroneous operation, use severity::* to classify the type

Comments

@mfansler
Copy link

mfansler commented Jan 9, 2024

Checklist

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

What happened?

Downloading packages on Anaconda Cloud via a web browser (Safari 16.6.1) leads to a file like (for example, from https://anaconda.org/conda-forge/r-tinytex/files):

noarch_r-tinytex-0.49-r43hc72bb7e_0.conda

This fails to unpack with cph

(cph) $ cph x noarch_r-tinytex-0.49-r43hc72bb7e_0.conda 
Traceback (most recent call last):
  File "/Users/mfansler/.local/envs/cph/bin/cph", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/mfansler/.local/envs/cph/lib/python3.12/site-packages/conda_package_handling/cli.py", line 121, in main
    api.extract(args.archive_path, args.dest, prefix=args.prefix)
  File "/Users/mfansler/.local/envs/cph/lib/python3.12/site-packages/conda_package_handling/api.py", line 77, in extract
    format.extract(fn, dest_dir, components=components)
  File "/Users/mfansler/.local/envs/cph/lib/python3.12/site-packages/conda_package_handling/conda_fmt.py", line 46, in extract
    _extract(str(fn), str(dest_dir), components=components)
  File "/Users/mfansler/.local/envs/cph/lib/python3.12/site-packages/conda_package_handling/streaming.py", line 35, in _extract
    stream = package_streaming.stream_conda_component(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mfansler/.local/envs/cph/lib/python3.12/site-packages/conda_package_streaming/package_streaming.py", line 133, in stream_conda_component
    raise LookupError(f"didn't find {component_name} component in {filename}")
LookupError: didn't find info-noarch_r-tinytex-0.49-r43hc72bb7e_0 component in /Users/mfansler/Downloads/noarch_r-tinytex-0.49-r43hc72bb7e_0.conda

However, everything goes smoothly when downloading the file programmatically using the link on the Anaconda Cloud page:

(cph) $ wget https://anaconda.org/conda-forge/r-tinytex/0.49/download/noarch/r-tinytex-0.49-r43hc72bb7e_0.conda
(cph) $ cph x r-tinytex-0.49-r43hc72bb7e_0.conda

This behavior arose in the last few months. Is Anaconda Cloud doing something different when downloading from a web browser?

Conda Info

active environment : /Users/mfansler/.local/envs/cph
    active env location : /Users/mfansler/.local/envs/cph
            shell level : 2
       user config file : /Users/mfansler/.condarc
 populated config files : /Users/mfansler/.condarc
          conda version : 23.7.4
    conda-build version : 3.28.2
         python version : 3.9.15.final.0
       virtual packages : __archspec=1=skylake
                          __osx=11.7.10=0
                          __unix=0=0
       base environment : /Users/mfansler/miniconda3  (writable)
      conda av data dir : /Users/mfansler/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://conda.anaconda.org/bioconda/osx-64
                          https://conda.anaconda.org/bioconda/noarch
                          https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/mfansler/miniconda3/pkgs
                          /Users/mfansler/.conda/pkgs
       envs directories : /Users/mfansler/miniconda3/envs
                          /Users/mfansler/.conda/envs
               platform : osx-64
             user-agent : conda/23.7.4 requests/2.28.1 CPython/3.9.15 Darwin/20.6.0 OSX/11.7.10
                UID:GID : 501:20
             netrc file : None
           offline mode : False

Conda Config

==> /Users/mfansler/.condarc <==
auto_activate_base: True
changeps1: True
env_prompt: ({default_env}) 
create_default_packages: []
envs_dirs:
  - /Users/mfansler/miniconda3/envs
ssl_verify: True
channel_priority: flexible
channels:
  - conda-forge
  - bioconda
  - defaults
show_channel_urls: False
restore_free_channel: False
offline: False

==> cmd_line <==
debug: False
json: False

Conda list

# packages in environment at /Users/mfansler/.local/envs/cph:
#
# Name                    Version                   Build  Channel
bzip2                     1.0.8                h10d778d_5    conda-forge
ca-certificates           2023.11.17           h8857fd0_0    conda-forge
cffi                      1.16.0          py312h38bf5a0_0    conda-forge
conda-package-handling    2.2.0              pyh38be061_0    conda-forge
conda-package-streaming   0.9.0              pyhd8ed1ab_0    conda-forge
libexpat                  2.5.0                hf0c8a7f_1    conda-forge
libffi                    3.4.2                h0d85af4_5    conda-forge
libsqlite                 3.44.2               h92b6c6a_0    conda-forge
libzlib                   1.2.13               h8a1eda9_5    conda-forge
ncurses                   6.4                  h93d8f39_2    conda-forge
openssl                   3.2.0                hd75f5a5_1    conda-forge
pip                       23.3.2             pyhd8ed1ab_0    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
python                    3.12.1          h9f0c242_1_cpython    conda-forge
python_abi                3.12                    4_cp312    conda-forge
readline                  8.2                  h9e318b2_1    conda-forge
setuptools                69.0.3             pyhd8ed1ab_0    conda-forge
tk                        8.6.13               h1abcd95_1    conda-forge
tzdata                    2023d                h0c530f3_0    conda-forge
wheel                     0.42.0             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h775f41a_0    conda-forge
zstandard                 0.22.0          py312h7a629f7_0    conda-forge
zstd                      1.5.5                h829000d_0    conda-forge

Additional Context

Recommended to transfer report here from conda-forge/conda-forge.github.io#2055.

@mfansler mfansler added the type::bug describes erroneous operation, use severity::* to classify the type label Jan 9, 2024
@jezdez
Copy link
Member

jezdez commented Jan 9, 2024

@dholth Can you look into this please?

@jezdez jezdez added pending::support indicates user is waiting on support from triage engineers severity::1 blocker; broken functionality with no workaround source::community catch-all for issues filed by community members labels Jan 9, 2024
@dholth dholth self-assigned this Jan 9, 2024
@dholth
Copy link
Contributor

dholth commented Jan 9, 2024

anaconda.org includes the directory in the filename= content-disposition and that winds up in the downloaded filename. Instead, it should say

Current behavior filename="noarch/r-tinytex-0.49-r43hc72bb7e_1.conda"; filename*=UTF-8''noarch%2Fr-tinytex-0.49-r43hc72bb7e_1.conda

Desired behavior filename="r-tinytex-0.49-r43hc72bb7e_1.conda"; filename*=UTF-8''r-tinytex-0.49-r43hc72bb7e_1.conda

(what's up with the UTF-8 portion?)

% curl -I https://anaconda.org/conda-forge/r-tinytex/0.49/download/noarch/r-tinytex-0.49-r43hc72bb7e_1.conda
HTTP/2 200
date: Tue, 09 Jan 2024 20:22:30 GMT
content-type: application/octet-stream
content-length: 146795
content-disposition: attachment; filename="noarch/r-tinytex-0.49-r43hc72bb7e_1.conda"; filename*=UTF-8''noarch%2Fr-tinytex-0.49-r43hc72bb7e_1.conda

You may rename the local file without the noarch_ prefix to extract.

@simonnier
Copy link

This also happens when we conda install offline .conda file downloaded from anaconda. This is solved by renaming .conda file as shown in this stackoverflow post https://stackoverflow.com/questions/77928132/how-to-install-conda-file-downloaded-from-anaconda-package-site

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending::support indicates user is waiting on support from triage engineers severity::1 blocker; broken functionality with no workaround source::community catch-all for issues filed by community members type::bug describes erroneous operation, use severity::* to classify the type
Projects
Status: 🆕 New
Development

No branches or pull requests

4 participants