conda build fails for CRAN R packages - r

I am trying to build a R conda package that doesn't exist on conda-forge from a CRAN package using the appraoch shown here: https://www.anaconda.com/blog/developer-blog/conda-data-science/
I used the R package rann as an example - this package already exists as r-rann on conda-forge, but I used it to test if the build process works in general.
During the build process the script "conda_build.sh" is executed that contains the line $R CMD INSTALL --build .. My problem is that the build process fails with error Fatal error: cannot open file 'CMD': No such file or directory independently of which package I try to build. I have no idea where the environment variable(?) "CMD" should come from.
I took the following steps:
conda skeleton cran rann
conda build r-rann
I also tested to build Python packages from pip and these work without any problem, so it doesn't appear that this is a general problem with my Miniconda installation.
My system:
Ubuntu 17.10
Miniconda 3, version 4.4.10
Here is the full log of the build process:
eega#eega-nb:~/workspace$ conda build r-rann/
Adding in variants from internal_defaults
INFO:conda_build.variants:Adding in variants from internal_defaults
Attempting to finalize metadata for r-rann
INFO:conda_build.metadata:Attempting to finalize metadata for r-rann
Solving environment: ...working... done
==> WARNING: A newer version of conda exists. <==
current version: 4.4.10
latest version: 4.5.0
Please update conda by running
$ conda update -n base conda
Solving environment: ...working... done
==> WARNING: A newer version of conda exists. <==
current version: 4.4.10
latest version: 4.5.0
Please update conda by running
$ conda update -n base conda
Solving environment: ...working... done
==> WARNING: A newer version of conda exists. <==
current version: 4.4.10
latest version: 4.5.0
Please update conda by running
$ conda update -n base conda
BUILD START: ['r-rann-2.5.1-r341h599a50d_0.tar.bz2']
Solving environment: ...working... done
==> WARNING: A newer version of conda exists. <==
current version: 4.4.10
latest version: 4.5.0
Please update conda by running
$ conda update -n base conda
## Package Plan ##
environment location: /tmp/conda-builds/r-rann_1522400915206/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold
The following NEW packages will be INSTALLED:
bzip2: 1.0.6-1 conda-forge
ca-certificates: 2018.1.18-0 conda-forge
cairo: 1.14.10-0 conda-forge
curl: 7.59.0-0 conda-forge
fontconfig: 2.12.6-0 conda-forge
freetype: 2.8.1-0 conda-forge
gettext: 0.19.8.1-0 conda-forge
glib: 2.55.0-0 conda-forge
graphite2: 1.3.11-0 conda-forge
gsl: 2.1-2 conda-forge
harfbuzz: 1.7.6-0 conda-forge
icu: 58.2-0 conda-forge
jpeg: 9b-2 conda-forge
krb5: 1.14.2-0 conda-forge
libffi: 3.2.1-3 conda-forge
libgcc: 7.2.0-h69d50b8_2
libgcc-ng: 7.2.0-hdf63c60_3
libiconv: 1.15-0 conda-forge
libpng: 1.6.34-0 conda-forge
libssh2: 1.8.0-2 conda-forge
libstdcxx-ng: 7.2.0-hdf63c60_3
libtiff: 4.0.9-0 conda-forge
libxml2: 2.9.8-0 conda-forge
ncurses: 5.9-10 conda-forge
openssl: 1.0.2n-0 conda-forge
pango: 1.40.14-0 conda-forge
pcre: 8.39-0 conda-forge
pixman: 0.34.0-1 conda-forge
r-base: 3.4.1-3 conda-forge
readline: 7.0-0 conda-forge
tk: 8.6.7-0 conda-forge
xz: 5.2.3-0 conda-forge
zlib: 1.2.11-0 conda-forge
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
Solving environment: ...working... done
==> WARNING: A newer version of conda exists. <==
current version: 4.4.10
latest version: 4.5.0
Please update conda by running
$ conda update -n base conda
Solving environment: ...working... done
==> WARNING: A newer version of conda exists. <==
current version: 4.4.10
latest version: 4.5.0
Please update conda by running
$ conda update -n base conda
## Package Plan ##
environment location: /tmp/conda-builds/r-rann_1522400915206/_build_env
The following NEW packages will be INSTALLED:
binutils_impl_linux-64: 2.28.1-had2808c_3
binutils_linux-64: 7.2.0-26
gcc_impl_linux-64: 7.2.0-habb00fd_3
gcc_linux-64: 7.2.0-26
gxx_impl_linux-64: 7.2.0-hdf63c60_3
gxx_linux-64: 7.2.0-26
libstdcxx-ng: 7.2.0-hdf63c60_3
make: 4.2.1-0 conda-forge
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
Source cache directory is: /tmp/conda-builds/src_cache
Found source in cache: RANN_2.5.1_75277e5d8a.tar.gz
Extracting download
source tree in: /tmp/conda-builds/r-rann_1522400915206/work
INFO: activate-binutils_linux-64.sh made the following environmental changes:
+ADDR2LINE=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-addr2line
+AR=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-ar
+AS=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-as
+CXXFILT=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-c++filt
+ELFEDIT=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-elfedit
+GPROF=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-gprof
+HOST=x86_64-conda_cos6-linux-gnu
+LD_GOLD=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-ld.gold
+LD=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-ld
+NM=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-nm
+OBJCOPY=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-objcopy
+OBJDUMP=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-objdump
+RANLIB=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-ranlib
+READELF=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-readelf
+SIZE=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-size
+STRINGS=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-strings
+STRIP=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-strip
INFO: activate-gcc_linux-64.sh made the following environmental changes:
+CC=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-cc
+CFLAGS=-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -I/tmp/conda-builds/r-rann_1522400915206/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/include -fdebug-prefix-map=${SRC_DIR}=/usr/local/src/conda/${PKG_NAME}-${PKG_VERSION} -fdebug-prefix-map=${PREFIX}=/usr/local/src/conda-prefix
+_CONDA_PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_x86_64_conda_cos6_linux_gnu
+CPPFLAGS=-DNDEBUG -D_FORTIFY_SOURCE=2 -O2
+CPP=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-cpp
+DEBUG_CFLAGS=-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-all -fno-plt -Og -g -Wall -Wextra -fvar-tracking-assignments -pipe -I/tmp/conda-builds/r-rann_1522400915206/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/include -fdebug-prefix-map=${SRC_DIR}=/usr/local/src/conda/${PKG_NAME}-${PKG_VERSION} -fdebug-prefix-map=${PREFIX}=/usr/local/src/conda-prefix
+DEBUG_CPPFLAGS=-D_DEBUG -D_FORTIFY_SOURCE=2 -Og
+GCC_AR=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-gcc-ar
+GCC_NM=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-gcc-nm
+GCC_RANLIB=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-gcc-ranlib
+GCC=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-gcc
+LDFLAGS=-Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-rpath,/tmp/conda-builds/r-rann_1522400915206/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/lib -L/tmp/conda-builds/r-rann_1522400915206/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/lib
INFO: activate-gxx_linux-64.sh made the following environmental changes:
+CXXFLAGS=-fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -I/tmp/conda-builds/r-rann_1522400915206/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/include -fdebug-prefix-map=${SRC_DIR}=/usr/local/src/conda/${PKG_NAME}-${PKG_VERSION} -fdebug-prefix-map=${PREFIX}=/usr/local/src/conda-prefix
+CXX=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-c++
+DEBUG_CXXFLAGS=-fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-all -fno-plt -Og -g -Wall -Wextra -fvar-tracking-assignments -pipe -I/tmp/conda-builds/r-rann_1522400915206/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/include -fdebug-prefix-map=${SRC_DIR}=/usr/local/src/conda/${PKG_NAME}-${PKG_VERSION} -fdebug-prefix-map=${PREFIX}=/usr/local/src/conda-prefix
+GXX=/tmp/conda-builds/r-rann_1522400915206/_build_env/bin/x86_64-conda_cos6-linux-gnu-g++
Fatal error: cannot open file 'CMD': No such file or directory
Traceback (most recent call last):
File "/home/eega/miniconda3/bin/conda-build", line 6, in <module>
sys.exit(conda_build.cli.main_build.main())
File "/home/eega/miniconda3/lib/python3.6/site-packages/conda_build/cli/main_build.py", line 420, in main
execute(sys.argv[1:])
File "/home/eega/miniconda3/lib/python3.6/site-packages/conda_build/cli/main_build.py", line 411, in execute
verify=args.verify)
File "/home/eega/miniconda3/lib/python3.6/site-packages/conda_build/api.py", line 199, in build
notest=notest, need_source_download=need_source_download, variants=variants)
File "/home/eega/miniconda3/lib/python3.6/site-packages/conda_build/build.py", line 2097, in build_tree
notest=notest,
File "/home/eega/miniconda3/lib/python3.6/site-packages/conda_build/build.py", line 1370, in build
utils.check_call_env(cmd, env=env, cwd=src_dir, stats=build_stats)
File "/home/eega/miniconda3/lib/python3.6/site-packages/conda_build/utils.py", line 301, in check_call_env
return _func_defaulting_env_to_os_environ('call', *popenargs, **kwargs)
File "/home/eega/miniconda3/lib/python3.6/site-packages/conda_build/utils.py", line 280, in _func_defaulting_env_to_os_environ
raise subprocess.CalledProcessError(proc.returncode, _args)
subprocess.CalledProcessError: Command '['/bin/bash', '-e', '/tmp/conda-builds/r-rann_1522400915206/work/conda_build.sh']' returned non-zero exit status 2.
The content of the build.sh conda created:
#!/bin/bash
if [[ $target_platform =~ linux.* ]] || [[ $target_platform == win-32 ]] || [[ $target_platform == win-64 ]] || [[ $target_platform == osx-64 ]]; then
export DISABLE_AUTOBREW=1
mv DESCRIPTION DESCRIPTION.old
grep -v '^Priority: ' DESCRIPTION.old > DESCRIPTION
$R CMD INSTALL --build .
else
mkdir -p $PREFIX/lib/R/library/RANN
mv * $PREFIX/lib/R/library/RANN
fi
The content of the meta.yaml conda created:
{% set version = '2.5.1' %}
{% set posix = 'm2-' if win else '' %}
{% set native = 'm2w64-' if win else '' %}
package:
name: r-rann
version: {{ version|replace("-", "_") }}
source:
fn: RANN_2.5.1.tar.gz
url:
- {{ cran_mirror }}/src/contrib/RANN_2.5.1.tar.gz
- {{ cran_mirror }}/src/contrib/Archive/RANN/RANN_2.5.1.tar.gz
sha256: 75277e5d8a13ca01ff387f99d403268a8077862d4e95b076b74fb1b5538a8546
build:
merge_build_host: True # [win]
# If this is a new build for the same version, increment the build number.
number: 0
# This is required to make R link correctly on Linux.
rpaths:
- lib/R/lib/
- lib/
# Suggests: testthat
requirements:
build:
- {{ compiler('c') }} # [not win]
- {{ compiler('cxx') }} # [not win]
- {{native}}toolchain # [win]
- {{posix}}filesystem # [win]
- {{posix}}make
host:
- r-base
run:
- r-base
- {{native}}gcc-libs # [win]
test:
commands:
# You can put additional test commands to be run here.
- $R -e "library('RANN')" # [not win]
- "\"%R%\" -e \"library('RANN')\"" # [win]
# You can also put a file called run_test.py, run_test.sh, or run_test.bat
# in the recipe that will be run at test time.
# requires:
# Put any additional test requirements here.
about:
home: https://github.com/jefferis/RANN
license: GPL (>= 3)
summary: Finds the k nearest neighbours for every point in a given dataset in O(N log N) time
using Arya and Mount's ANN library (v1.1.3). There is support for approximate as
well as exact searches, fixed radius searches and 'bd' as well as 'kd' trees. The
distance is computed using the L2 (Euclidean) metric. Please see package 'RANN.L1'
for the same functionality using the L1 (Manhattan, taxicab) metric.
license_family: GPL3
# The original CRAN metadata for this package was:
# Package: RANN
# Title: Fast Nearest Neighbour Search (Wraps ANN Library) Using L2 Metric
# Author: Sunil Arya and David Mount (for ANN), Samuel E. Kemp, Gregory Jefferis
# Maintainer: Gregory Jefferis <jefferis#gmail.com>
# Copyright: ANN library is copyright University of Maryland and Sunil Arya and David Mount. See file COPYRIGHT for details.
# Description: Finds the k nearest neighbours for every point in a given dataset in O(N log N) time using Arya and Mount's ANN library (v1.1.3). There is support for approximate as well as exact searches, fixed radius searches and 'bd' as well as 'kd' trees. The distance is computed using the L2 (Euclidean) metric. Please see package 'RANN.L1' for the same functionality using the L1 (Manhattan, taxicab) metric.
# URL: https://github.com/jefferis/RANN
# BugReports: https://github.com/jefferis/RANN/issues
# Encoding: UTF-8
# License: GPL (>= 3)
# Suggests: testthat
# Version: 2.5.1
# RoxygenNote: 6.0.1
# NeedsCompilation: yes
# Packaged: 2017-05-19 13:52:30 UTC; jefferis
# Repository: CRAN
# Date/Publication: 2017-05-21 07:56:50 UTC
# See
# http://docs.continuum.io/conda/build.html for
# more information about meta.yaml
Any help would be appreciated!

"CMD" is an R command-line instruction. During the conda-build you download the source code for RANN, then build a package from it using R in a temp environment, then install it (temporarily) to check it works.
That line is just telling R to build the package rann. When you're developing an R package you use R CMD build <my_package> or R CMD INSTALL --build <my_package> to make an installable archive of that package.
It looks like your conda-build can't find an R to build the package, although that is typically done in a temporary environment that is set up while running conda-build; and the build process will almost certainly install r-base so there's no real reason for it not to find R.
I've ran the code under windows-subsystem for linux (effectively Ubuntu 16.04) with conda-build 3.7.2 and conda 4.3.34, and with R v3.4.1 (with verbose output)
conda skeleton cran rann
conda build r-rann --R=3.4.1 --debug
It tries to run Rscript CMD INSTALL --build on my system, rather than R CMD build. The former isn't how packages are typically built under R, and it was at this step that the "Cannot find file CMD" error was thrown, so I had a look into it in a bit more detail.
First, I compared the meta.yaml with that on conda-forge. libgcc was absent from the run-requirements and r-base was absent from the build-requirements in the yaml set up by conda skeleton - I added these and rebuilt (though I doubt these cause the problem). This didn't fix anything, the "Could not find CMD" error still threw.
I checked the changelog at conda-build. Rscript is used to run tests rather than R from version 3.7.2 onwards. I reverted to conda-build=3.7.1:
conda install conda-build=3.7.1 -vv
conda build r-rann --R=3.4.1 --debug
Now, I get past the ccall to R CMD INSTALL --build ..., but an error still occurs during compilation; so I haven't solved the problem yet.
Nonetheless, it looks like the error you originally posted about has resulted from a change to conda-build (to use Rscript rather than
R when testing packages) that has led to problems in building R packages. Could you post an issue cross-referencing this question to the conda-build github, please.
<-- EDIT -->
After some searching, I got this to work by a) installing gfortran and b) using conda-build 3.6.0 to both create the skeleton and build the package. 3.7.0/1 of conda-build threw a bug related to version numbers (without the --version XXX argument, conda-skeleton threw an error re Namespace not having a version; with the --version XXX argument, conda-skeleton threw an error re version numbers not being implemented for R packages).
The above errors have been fixed in conda-build 3.8.0, but I haven't used that yet

Related

R fails to load igraph in conda environment

I am trying to run an RShiny app in a WSL2 installation of Ubuntu on Windows. I am no expert in R, but I feel this is a problem due to conda interaction with R. I run the following commands:
conda create -n r_env r-essentials r-base
conda activate r_env
conda install -c conda-forge r-shiny
conda install -c r r-visnetwork
conda install -c conda-forge r-dplyr
conda install -c r r-dt
conda install -c conda-forge r-igraph
conda install -c r r-leaflet
conda install -c conda-forge r-rgdal
conda install -c r r-shinydashboard
conda install -c conda-forge r-shinywidgets
conda install -c conda-forge r-shinycssloaders
conda install -c conda-forge r-igraph
When I run R and type in : library(igraph) i get:
->Error: package or namespace load failed for ‘igraph’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/carlo/anaconda3/envs/r_env/lib/R/library/igraph/libs/igraph.so':
but I can list it, it's there:
ll /home/carlo/anaconda3/envs/r_env/lib/R/library/igraph/libs/igraph.so
-> -rwxrwxr-x 1 carlo carlo 3816608 Mar 31 15:38 /home/carlo/anaconda3/envs/r_env/lib/R/library/igraph/libs/igraph.so
Did anybody encounter a similar problem?
The igraph library was meant to load correctly
(My Opinion) I would caution against the use of the r channel and the r-essentials package. The Continuum/Anaconda support for R was a good college-try, but is since outmoded and superseded by the broader CRAN support that Conda Forge provides. Users managing R environments will find a better experience ignoring any Continuum/Anaconda documentation and exclusively using Conda Forge for their R environments. (End Opinion)
Mixing channels can lead to symbol reference errors. Furthermore, sequences of ad hoc installations are subpar - instead specify through a YAML.
The following YAML file works just fine on linux-64, osx-64, and win-64 platforms:
so-igraph.yaml
name: so-igraph
channels:
- conda-forge
dependencies:
- r-base=4.1 # adjust to desired version
- r-shiny
- r-visnetwork
- r-dplyr
- r-dt
- r-igraph
- r-leaflet
- r-rgdal
- r-shinydashboard
- r-shinywidgets
- r-shinycssloaders
- r-igraph
Which can be used with
conda env create -n so-igraph -f so-igraph.yaml
conda activate so-igraph
I was having a similar problem with R on AlmaLinux, and it turned out I was missing some libraries on the OS itself, which I thought I had and that were necessary for some R packages. I think they were these, which makes sense, given that we're talking about igraph, a graphing package:
gsl-devel-2.5-1.el8.x86_64
gsl-2.5-1.el8.x86_64
openssl-1.1.1k-6.el8_5.x86_64
geos-devel-3.7.2-1.el8.x86_64
geos-3.7.2-1.el8.x86_64
proj-datumgrid-1.8-6.3.2.4.el8.noarch
proj-6.3.2-4.el8.x86_64
libtiff-devel-4.0.9-21.el8.x86_64
libgeotiff-devel-1.5.1-1.el8.x86_64
libgeotiff-1.5.1-1.el8.x86_64
Installing openblas may work, see https://github.com/conda-forge/r-igraph-feedstock/issues/19

Working with an R package under a conda environment in macOS

I am trying to work with an R package that includes Rcpp + OpenMP in a conda environment in macOS. I read the conda environment documentation; however, I could not fix the problem I have in the following reproducible example. Most of the documentation is based on addressing OpenMP issues (clang+llvm) on macOS. I was wondering if there are any resources or documentation for the conda environment. These steps work on a Linux system (with conda) and macOS (without conda) without any problem.
Here is the reproducible example:
In a macOS:
Step 1: Create a conda environment and install R:
conda create -n env r-essentials r-base
Step 2: activate the environment
conda activate env
Step 3: install rstudio
conda install -c r rstudio
Step 4: install some required packages
conda install -c r r-devtools
conda install -c r r-wcorr
conda install -c r r-ranger
conda install -c conda-forge r-rcpparmadillo
conda install -c r r-testthat
conda install -c conda-forge r-superlearner
conda install -c conda-forge r-polycore
conda install -c conda forge r-logger
conda install -c anaconda llvm
conda install -c conda-forge openmp
Step 5: Run rstudio
Step 6: Inside rstudio
library('devtools')
install_github('fasrc/CausalGPS')
I get the following error:
In file included from ColorSpace.cpp:1:
In file included from ./ColorSpace.h:4:
In file included from env/bin/../include/c++/v1/typeinfo:60:
In file included from env/bin/../include/c++/v1/exception:81:
In file included from env/bin/../include/c++/v1/cstdlib:85:
In file included from env/bin/../include/c++/v1/stdlib.h:100:
env/bin/../include/c++/v1/math.h:773:12: error: no member named 'labs' in the global namespace; did you mean 'abs'?
return ::labs(__x);
~~^
~/env/bin/../include/c++/v1/math.h:772:39: note: 'abs' declared here
inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT {
^
~/env/bin/../include/c++/v1/math.h:777:12: error: no member named 'llabs' in the global namespace
return ::llabs(__x);
~~^
~/env/bin/../include/c++/v1/math.h:785:12: error: no member named 'fabsf' in the global namespace
return ::fabsf(__lcpp_x);
~~^
~/env/bin/../include/c++/v1/math.h:789:12: error: no member named 'fabs' in the global namespace; did you mean 'abs'?
return ::fabs(__lcpp_x);
~~^
~/env/bin/../include/c++/v1/math.h:772:39: note: 'abs' declared here
inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT {
^
~/env/bin/../include/c++/v1/math.h:794:12: error: no member named 'fabsl' in the global namespace
return ::fabsl(__lcpp_x);
~~^
I think I need to set some environmental variables; however, I could not find out which variables I should export. Do you have any idea?
Works for me, with some adjustments that I regard as better practice:
don't use RStudio from Conda - it is an abandoned project; see alternatives
only use conda-forge channel - mixing channels can have dynamic library issues
use a YAML for more reliable specification of requirements
explicitly declare R version (r-base)
include everything in the declared Imports (except what is included as dependencies of other packages)
conda-forge::r-cli>=3 builds are broken, so I pin that to newest working version
use mamba because conda is slow
Here is a YAML for creating the environment:
causalgps-env.yaml
name: causalgps
channels:
- conda-forge
dependencies:
- r-base=4.1
- r-tidyverse
- r-devtools
- r-xgboost
- r-superlearner
- r-earth
- r-ranger
- r-gam
- r-kernsmooth
- r-gnm
- r-polycor
- r-wcorr
- r-rlang
- r-glue
- r-logger
- r-cli>=2,<3
And the steps are:
Create env.
## install Mamba if you don't have it
## conda install -n base conda-forge::mamba
mamba env create -n causalgps -f causalgps-env.yaml
Run R session in env.
conda activate causalgps
R
Install package.
library(devtools)
install_github('fasrc/CausalGPS')
Test loading.
library(CausalGPS) ## works

"How to fix 'error: command 'gcc' failed with exit status 1' while installing "SudachiPy" python package?

I am working in building Japanese NLP sentiment analysis, to tokenise the Japanese sentence we have a package called "SudachiPy".I tried to install it but I am getting error while installing the package. I'm using anaconda in MAC Book pro.
I tried all the steps mentioned in stack overflow by installing following libraries to debug the error.
pip3 install python3-dev
Also I tried launching an "Ubuntu" instance from AWS and try to install "SudachiPy" but still encountering the same error.
pip3 install SudachiPy
Building wheels for collected packages: dartsclone
Building wheel for dartsclone (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/lf/4754h1x94x39xfw_q6c8_ryc0000gn/T/pip-install-st3sqcmm/dartsclone/setup.py'"'"'; __file__='"'"'/private/var/folders/lf/4754h1x94x39xfw_q6c8_ryc0000gn/T/pip-install-st3sqcmm/dartsclone/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/lf/4754h1x94x39xfw_q6c8_ryc0000gn/T/pip-wheel-x8k1ryul --python-tag cp36
cwd: /private/var/folders/lf/4754h1x94x39xfw_q6c8_ryc0000gn/T/pip-install-st3sqcmm/dartsclone/
Complete output (25 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.7-x86_64-3.6
creating build/lib.macosx-10.7-x86_64-3.6/dartsclone
copying dartsclone/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/dartsclone
running build_ext
cythoning dartsclone/_dartsclone.pyx to dartsclone/_dartsclone.cpp
/anaconda3/lib/python3.6/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /private/var/folders/lf/4754h1x94x39xfw_q6c8_ryc0000gn/T/pip-install-st3sqcmm/dartsclone/dartsclone/_dartsclone.pxd
tree = Parsing.p_module(s, pxd, full_module_name)
warning: dartsclone/_dartsclone.pyx:119:49: local variable 'result' referenced before assignment
warning: dartsclone/_dartsclone.pyx:120:15: local variable 'result' referenced before assignment
building 'dartsclone._dartsclone' extension
creating build/temp.macosx-10.7-x86_64-3.6
creating build/temp.macosx-10.7-x86_64-3.6/dartsclone
creating build/temp.macosx-10.7-x86_64-3.6/csrc
creating build/temp.macosx-10.7-x86_64-3.6/csrc/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/include -arch x86_64 -I/anaconda3/include -arch x86_64 -I./csrc/include -I/anaconda3/include/python3.6m -c dartsclone/_dartsclone.cpp -o build/temp.macosx-10.7-x86_64-3.6/dartsclone/_dartsclone.o
warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
dartsclone/_dartsclone.cpp:610:10: fatal error: 'ios' file not found
#include "ios"
^~~~~
1 warning and 1 error generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for dartsclone
You need to install some deps before, similar to Linux build-essential:
xcode-select install
Also, you may need to specify the right compiler, by setting this env. variable:
CFLAGS='-stdlib=libc++'

Problems Installing rgeos and rgdal on Mac OS X High Sierra

I have looked at the multiple sources to figure out how to install rgeos and rgdal on Mac OS X High Sierra in a way that works with Anaconda Navigator. I mention Anaconda because I want to be able to build static project-specific, package environments to ensure that my projects work 6 months from now when the dependent packages change. I have successfully installed and used both rgeos and rgdal on a couple other computers but seem to be having issues on a new computer. I want to launch Shiny apps from Anaconda Navigator's RStudio. None of the solutions I found, listed below, worked:
https://dyerlab.ces.vcu.edu/2015/03/31/install-rgeos-on-osx/
https://cran.rstudio.com/web/packages/rgeos/rgeos.pdf
http://tlocoh.r-forge.r-project.org/mac_rgeos_rgdal.html
https://anaconda.org/conda-forge/r-rgdal
Based on the above sources and my slow progression through a series of error messages, I tried the following:
Install GDAL 2.2 Complete [30.0 MiB] 2018-3-10 from http://www.kyngchaos.com/software/frameworks. This installs GDAL, GEOS, PROJ, SQLite and UnixImageIO frameworks.
The above installed without an error message. But attempting to install rgeos gave an error message:
configure: error: geos-config not found or not executable.
Consequently, either the install failed and didn't notify me, or there is some type of $PATH issue (?). On a blog, someone suggested to do the following in response to the aforementioned issue:
brew install geos
The above completed successfully. So I went into RStudio and tried the following, which resolved the former error but produced a new one:
install.packages("~/Downloads/rgeos_0.3-28.tar.gz", repos = NULL, type = "source")
installing source package ‘rgeos’ ...
configure: CC: x86_64-apple-darwin13.4.0-clang
configure: CXX: x86_64-apple-darwin13.4.0-clang++
configure: rgeos: 0.3-28
checking for /usr/bin/svnversion... yes
cat: inst/SVN_VERSION: No such file or directory
configure: svn revision:
checking for geos-config... /usr/local/bin/geos-config
checking geos-config usability... yes
configure: GEOS version: 3.6.2
checking geos version at least 3.2.0... yes
checking geos-config clibs... yes
checking geos_c.h presence and usability... no
configure: error: geos_c.h not found in standard or given locations.
ERROR: configuration failed for package ‘rgeos’
removing ‘/Users/aloha2018/anaconda2/lib/R/library/rgeos’
Warning in install.packages :
installation of package ‘/Users/aloha2018/Downloads/rgeos_0.3-28.tar.gz’ had non-zero exit status
Any ideas on what to try next?
Naturally, I already tried in an RStudio application launched from Anaconda Navigator:
install.packages("rgeos")
install.packages("rgdal")
both from CRAN and from tar.gz. But it seems like it is unable to find a file called geos_c.h, which does indeed exist on my computer at:
/Library/Frameworks/GEOS.framework/Versions/3B/Headers/geos_c.h
Is there a way to tell RStudio to look in the directory containing that file so my rgeos and rgdal installations work? Are there other errors I should expect to encounter and if so, how do I avoid/resolve them?
I also tried in a Terminal window:
conda install -c conda-forge r-rgdal
but that fails after spending a long time attempting to "solve environment":
Andrews-MacBook-Pro:~ aloha2018$ conda install -c conda-forge r-rgdal
Solving environment: failed
UnsatisfiableError: The following specifications were found to be in conflict:
- r-rgdal
- rstudio==1.1.423
Use "conda info <package>" to see the dependencies for each package.
So I try:
conda r-rgdal
But there is no output:
Andrews-MacBook-Pro:~ aloha2018$ conda info r-rgdal
Andrews-MacBook-Pro:~ aloha2018$
I've had a similar issue. I first solved it by installing everything using conda using the following environment.yml configuration
name: london-crime-r
channels:
- conda-forge
- conda
dependencies:
- gdal
- geos
- r-base
- r-rcpp
- r-irkernel
- r-mass
- r-dplyr
- r-rgdal
- r-rgeos
- r-raster
- rstudio
However, after updating conda, resolving dependencies did not finish within the 10 hours so I went the traditional route:
Use brew to install geos and gdal. It takes 40 minutes to build on my machine.
brew install geos gdal
Once that has been achieved, install R packages in this sequence.
install.packages('sp', type='source')
install.packages("rgeos", repos="http://R-Forge.R-project.org", type="source")
require(rgeos)
install.packages("rgdal", repos="http://R-Forge.R-project.org", type="source")
require(rgdal)
Subsequently, the packages below are ok with the plain install.
libraries <- c("rgdal",
"rgeos",
"raster",
"spdep",
"spatstat")
install.packages(libraries)

How do I check the version of MPICH?

As stated in the question, what is the command that lists the current version of MPICH? I am running CentOS.
The command you run to start your application with MPICH is mpiexec, so the way to check the version is:
mpiexec --version
I find that mpichversion, which is found in the directory as mpicc, provides very useful information. For example, on my laptop, it displays:
$ mpichversion
MPICH Version: 3.2b1
MPICH Release date: unreleased development copy
MPICH Device: ch3:nemesis
MPICH configure: CC=gcc-4.9 CXX=g++-4.9 FC=gfortran-4.9 F77=gfortran-4.9
--enable-cxx --enable-fortran --enable-threads=runtime
--enable-g=dbg --with-pm=hydra
--prefix=/opt/mpich/dev/gcc/default
--enable-wrapper-rpath --enable-static --enable-shared
MPICH CC: gcc-4.9 -g -O2
MPICH CXX: g++-4.9 -g -O2
MPICH F77: gfortran-4.9 -g -O2
MPICH FC: gfortran-4.9 -g -O2
Note that I reformatted the output slightly (I added whitespace, nothing else) so that it would fit nicely into the fixed column format without requiring a slider.
Note that this provides less information than the previously suggested mpiexec --version, but the configure flags are given in a slightly less useful format, at least for my purposes (copy-and-paste into new configure invocation).
$ mpiexec --version
HYDRA build details:
Version: 3.2b1
Release Date: unreleased development copy
CC: gcc-4.9
CXX: g++-4.9
F77: gfortran-4.9
F90: gfortran-4.9
Configure options: '--disable-option-checking' '--prefix=/opt/mpich/dev/gcc/default' 'CC=gcc-4.9' 'CXX=g++-4.9' 'FC=gfortran-4.9' 'F77=gfortran-4.9' '--enable-cxx' '--enable-fortran' '--enable-threads=runtime' '--enable-g=dbg' '--with-pm=hydra' '--enable-wrapper-rpath' '--enable-static' '--enable-shared' '--cache-file=/dev/null' '--srcdir=../../../../src/pm/hydra' 'CFLAGS= -g -O2' 'LDFLAGS= ' 'LIBS=-lpthread ' 'CPPFLAGS= -I/Users/jrhammon/Work/MPI/MPICH/git/build/src/mpl/include -I/Users/jrhammon/Work/MPI/MPICH/git/src/mpl/include -I/Users/jrhammon/Work/MPI/MPICH/git/src/openpa/src -I/Users/jrhammon/Work/MPI/MPICH/git/build/src/openpa/src -D_REENTRANT -I/Users/jrhammon/Work/MPI/MPICH/git/build/src/mpi/romio/include'
Process Manager: pmi
Launchers available: ssh rsh fork slurm ll lsf sge manual persist
Topology libraries available: hwloc
Resource management kernels available: user slurm ll lsf sge pbs cobalt
Checkpointing libraries available:
Demux engines available: poll select
(I did not reformat this output.)
One benefit of mpichversion is that, because it is specific to MPICH (and possibly some MPICH derivatives), you can write a more specific parser for it. I do not know what, if any, information is available from mpiexec --version for OpenMPI or other non-MPICH MPI implementations.
Well for me it was mpicc -v
mpicc for 1.1.1p1
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu4)
HTH
Depending on your rights, you can check yum (or sudo yum):
$> yum info mpich2
...
Name : mpich2
Arch : x86_64
Version : 1.2.1
Release : 2.3.el6
Size : 3.7 M
Repo : base
...
shows the relevant section on my machine. Repo : base would be Repo : installed for the version you have installed.
Or you can check mpirun or mpiexec:
$> mpirun --version
mpirun (Open MPI) 1.6.3
There is a string called MPICH_VERSION in mpi.h that is set to the version. Cray, for example, provides their own application launcher so there isn't the standard set of executables already mentioned for querying the MPICH version.

Resources