I’m trying to use the harp package for R. I’ve downloaded it using Conda and I can see that it’s saved in my anaconda packages folder like the following:
r-harp-1.17-py311h4489670_1
r-harp-1.17-py311h4489670_1.conda
However, I’m still getting an error when I try to import it into my R environment:
> library(harp)
Error in library(harp) : there is no package called ‘harp’
Hi Sander - that was the first thing I tried, it also didn’t work, after which I posted a question on this forum and used your second method. This is the output from that attempt:
(base) priyapatel@Priyas-MacBook-Air ~ % conda install -c conda-forge r-harp
Retrieving notices: ...working... done
Collecting package metadata (current_repodata.json): done
Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 23.9.0
latest version: 24.1.2
Please update conda by running
$ conda update -n base -c defaults conda
Or to minimize the number of packages updated during conda update use
conda install conda=24.1.2
Collecting package metadata (repodata.json): | WARNING conda.models.version:get_matcher(556): Using .* with relational operator is superfluous and deprecated and will be removed in a future version of conda. Your spec was 1.9.0.*, but conda is ignoring the .* and treating it as 1.9.0
WARNING conda.models.version:get_matcher(556): Using .* with relational operator is superfluous and deprecated and will be removed in a future version of conda. Your spec was 1.8.0.*, but conda is ignoring the .* and treating it as 1.8.0
done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 23.9.0
latest version: 24.1.2
Please update conda by running
$ conda update -n base -c defaults conda
Or to minimize the number of packages updated during conda update use
conda install conda=24.1.2
## Package Plan ##
environment location: /Users/priyapatel/anaconda3
added / updated specs:
- r-harp
The following packages will be downloaded:
package | build
---------------------------|-----------------
archspec-0.2.3 | pyhd8ed1ab_0 48 KB conda-forge
conda-23.9.0 | py311h267d04e_2 1.2 MB conda-forge
r-harp-1.17 | py311h4489670_1 8 KB conda-forge
------------------------------------------------------------
Total: 1.3 MB
The following NEW packages will be INSTALLED:
archspec conda-forge/noarch::archspec-0.2.3-pyhd8ed1ab_0
r-harp conda-forge/osx-arm64::r-harp-1.17-py311h4489670_1
The following packages will be UPDATED:
ca-certificates pkgs/main::ca-certificates-2023.12.12~ --> conda-forge::ca-certificates-2024.2.2-hf0a4a13_0
conda pkgs/main::conda-23.9.0-py311hca03da5~ --> conda-forge::conda-23.9.0-py311h267d04e_2
The following packages will be SUPERSEDED by a higher-priority channel:
certifi pkgs/main/osx-arm64::certifi-2024.2.2~ --> conda-forge/noarch::certifi-2024.2.2-pyhd8ed1ab_0
openssl pkgs/main::openssl-1.1.1w-h1a28f6b_0 --> conda-forge::openssl-1.1.1w-h53f4e23_0
Proceed ([y]/n)? y
Downloading and Extracting Packages:
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(base) priyapatel@Priyas-MacBook-Air ~ % R
R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
[Previously saved workspace restored]
> library(harp_
+ )
Error in library(harp_) : there is no package called ‘harp_’
> library(harp)
Error in library(harp) : there is no package called ‘harp’
Don’t try to install harp in the base anaconda environment. Mixing conda-forge packages and anaconda default channel packages will usually not work correctly.
Create a separate conda environment as I showed. You should then also end up with harp 1.20.2 instead of 1.17.
I create a new environment and used Conda-forge to install - same error. Could it be that it’s not using the correct path to pull the package? I’m very confused at this point.
(harp-r) priyapatel@Priyas-MacBook-Air ~ % conda install -c conda-forge r-harp
Collecting package metadata (current_repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 23.9.0
latest version: 24.1.2
Please update conda by running
$ conda update -n base -c conda-forge conda
Or to minimize the number of packages updated during conda update use
conda install conda=24.1.2
## Package Plan ##
environment location: /Users/priyapatel/anaconda3/envs/harp-r
added / updated specs:
- r-harp
The following NEW packages will be INSTALLED:
bzip2 conda-forge/osx-arm64::bzip2-1.0.8-h93a5062_5
c-ares conda-forge/osx-arm64::c-ares-1.27.0-h93a5062_0
ca-certificates conda-forge/osx-arm64::ca-certificates-2024.2.2-hf0a4a13_0
cffi conda-forge/osx-arm64::cffi-1.16.0-py311h4a08483_0
coda conda-forge/osx-arm64::coda-2.25.1-py311he72ca09_1
harp conda-forge/osx-arm64::harp-1.20.2-py311ha597b10_1
hdf4 conda-forge/osx-arm64::hdf4-4.2.15-h2ee6834_7
hdf5 conda-forge/osx-arm64::hdf5-1.14.3-nompi_h5bb55e9_100
krb5 conda-forge/osx-arm64::krb5-1.21.2-h92f50d5_0
libaec conda-forge/osx-arm64::libaec-1.1.2-h13dd4ca_1
libblas conda-forge/osx-arm64::libblas-3.9.0-21_osxarm64_openblas
libcblas conda-forge/osx-arm64::libcblas-3.9.0-21_osxarm64_openblas
libcurl conda-forge/osx-arm64::libcurl-8.5.0-h2d989ff_0
libcxx conda-forge/osx-arm64::libcxx-16.0.6-h4653b0c_0
libedit conda-forge/osx-arm64::libedit-3.1.20191231-hc8eb9b7_2
libev conda-forge/osx-arm64::libev-4.33-h93a5062_2
libexpat conda-forge/osx-arm64::libexpat-2.5.0-hb7217d7_1
libffi conda-forge/osx-arm64::libffi-3.4.2-h3422bc3_5
libgfortran conda-forge/osx-arm64::libgfortran-5.0.0-13_2_0_hd922786_3
libgfortran5 conda-forge/osx-arm64::libgfortran5-13.2.0-hf226fd6_3
libjpeg-turbo conda-forge/osx-arm64::libjpeg-turbo-3.0.0-hb547adb_1
liblapack conda-forge/osx-arm64::liblapack-3.9.0-21_osxarm64_openblas
libnghttp2 conda-forge/osx-arm64::libnghttp2-1.58.0-ha4dd798_1
libopenblas conda-forge/osx-arm64::libopenblas-0.3.26-openmp_h6c19121_0
libsqlite conda-forge/osx-arm64::libsqlite-3.45.1-h091b4b1_0
libssh2 conda-forge/osx-arm64::libssh2-1.11.0-h7a5bd25_0
libzlib conda-forge/osx-arm64::libzlib-1.2.13-h53f4e23_5
llvm-openmp conda-forge/osx-arm64::llvm-openmp-17.0.6-hcd81f8e_0
ncurses conda-forge/osx-arm64::ncurses-6.4-h463b476_2
numpy conda-forge/osx-arm64::numpy-1.26.4-py311h7125741_0
openssl conda-forge/osx-arm64::openssl-3.2.1-h0d3ecfb_0
pip conda-forge/noarch::pip-24.0-pyhd8ed1ab_0
pycparser conda-forge/noarch::pycparser-2.21-pyhd8ed1ab_0
python conda-forge/osx-arm64::python-3.11.8-hdf0ec26_0_cpython
python_abi conda-forge/osx-arm64::python_abi-3.11-4_cp311
r-harp conda-forge/osx-arm64::r-harp-1.20.2-py311he72ca09_1
readline conda-forge/osx-arm64::readline-8.2-h92ec313_1
setuptools conda-forge/noarch::setuptools-69.1.1-pyhd8ed1ab_0
tk conda-forge/osx-arm64::tk-8.6.13-h5083fa2_1
tzdata conda-forge/noarch::tzdata-2024a-h0c530f3_0
wheel conda-forge/noarch::wheel-0.42.0-pyhd8ed1ab_0
xz conda-forge/osx-arm64::xz-5.2.6-h57fd34a_0
zstd conda-forge/osx-arm64::zstd-1.5.5-h4f39d0f_0
Proceed ([y]/n)? y
Downloading and Extracting Packages:
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(harp-r) priyapatel@Priyas-MacBook-Air ~ % R
R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
[Previously saved workspace restored]
> library(harp)
Error in library(harp) : there is no package called ‘harp’
I redirected to this directory and could not find harp-r. I found all my other R packages. When I look for the r-harp, I see that it’s being saved here:
Then, I tried to install the r-harp library directly in the folder where the rest of my R packages are saved and this is what I got.
(harp-r) priyapatel@Priyas-MacBook-Air harp-r % conda install -c conda-forge r-harp --prefix /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
DirectoryNotACondaEnvironmentError: The target directory exists, but it is not a conda environment.
Use 'conda create' to convert the directory to a conda environment.
target directory: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
Should I convert it into a conda environment? Not sure if there are any ramifications for this.
One more comment, I think the r-harp package is still being saved here:
/Users/priyapatel/anaconda3/pkgs
Because all I see in the harp-r environment folder is an r-harp json file, which isn’t the actual package. /Users/priyapatel/anaconda3/envs/harp-r/conda-meta/r-harp-1.20.2-py311he72ca09_1.json
In the /Users/priyapatel/anaconda3/pkgs folder, I see the r-harp files:
The conda installation of r-harp only works with an R installation within that same conda environment. Not with a system installed version of R. I think this is your problem.
Then, I again try to install harp and it can’t find it.
(renv) priyapatel@ envs % R
R version 4.3.3 (2024-02-29) -- "Angel Food Cake"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20.0.0 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(harp)
Error in library(harp) : there is no package called ‘harp’