Home > database >  conda won't install package that shows up in search
conda won't install package that shows up in search

Time:10-22

This is similar to the question conda install reporting failure to find package that conda search finds?, but I am confident that the root cause is different as the cause of that problem was due to incompatible dependencies, whereas here I am trying to install the same version of a package that I already have, from a different channel.

Running conda search conda-forge/osx-arm64::r-base will result in:

# Name                         Version    Build       Channel
[... multiple other versions]
r-base                         4.2.1      hab92f3e_2  conda-forge         
r-base                         4.2.1      hd4fed26_0  conda-forge         
r-base                         4.2.1      hd4fed26_1  conda-forge  

conda list r-base gives:

# Name                    Version              Build         Channel
r-base                    4.2.1                h85fa70c_1    conda-forge

So as you can see, I already have this file installed. However, my Mac's architecture is arm (verified with uname -p) and my R version says "Platform: x86_64-apple-darwin13.4.0 (64-bit)" so I want to swap to the conda-forge/osx-arm64 channel in the hopes of changing it. (Since I think this mismatch is the root cause of another problem I'm experiencing).

However, conda install conda-forge/osx-arm64::r-base returns a PackageNotFoundError.

Now, I think I know why - when I run conda info, I get:

conda version : 22.9.0
conda-build version : 3.21.5
[...]
virtual packages : __osx=10.16=0
                   __unix=0=0
                   __archspec=1=x86_64
[...]
platform : osx-64

Thus, my conda distribution seems to think I have an x86. I think the reason why is that I used to use an x86 on an old computer which I have since transferred all its data to my new one. I suspect that conda thinks that it can only install x86-specific packages, which is problematic. However I have no idea how to change this.


For your convenience, the full output of conda info is listed here:

    active environment : JupyterWithR
    active env location : /Users/baileyandrew/opt/anaconda3/envs/JupyterWithR
            shell level : 2
       user config file : /Users/baileyandrew/.condarc
 populated config files : /Users/baileyandrew/.condarc
          conda version : 22.9.0
    conda-build version : 3.21.5
         python version : 3.9.7.final.0
       virtual packages : __osx=10.16=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /Users/baileyandrew/opt/anaconda3  (writable)
      conda av data dir : /Users/baileyandrew/opt/anaconda3/etc/conda
  conda av metadata url : None
           channel URLs : 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/baileyandrew/opt/anaconda3/pkgs
                          /Users/baileyandrew/.conda/pkgs
       envs directories : /Users/baileyandrew/opt/anaconda3/envs
                          /Users/baileyandrew/.conda/envs
               platform : osx-64
             user-agent : conda/22.9.0 requests/2.26.0 CPython/3.9.7 Darwin/21.3.0 OSX/10.16
                UID:GID : 501:20
             netrc file : None
           offline mode : False

CodePudding user response:

macOS lets one run osx-64 binaries in emulation, and since you transferred the base Conda installation, that’s likely what it is. You can still create osx-arm64 environments by setting the subdir environment variable, which is what controls the folder searched on Anaconda Cloud. For example,

## create empty environment 
conda create -n r42_arm

## always activate before installing
conda activate -n r42_arm

## configure its subdir
conda config —-env —-set subdir osx-arm64

## install R and enable usage as kernel
conda install r-base=4.2 r-irkernel

Please note that many packages are still not built natively for osx-arm64. So, it might be a smoother user experience to continue working with osx-64 for now. Particular native builds can be requested following the documented procedure.

  • Related