如何在conda中沉默或抑制gfortran(或clang?)后端? [英] How to silence or suppress gfortran (or clang?) backend in conda?
问题描述
我一直在努力构建一个针对python
和R
设计的非常特殊的conda环境,并使用rpy2
进行串扰.我想到的可以安装正确的R
软件包的方法如下:
I have been working on building a very particular conda environment designed for python
and R
with cross-talk using rpy2
. The recipe I came up with that works to install the proper R
packages is the following:
# install_main_environment.sh
now=$(date +"%T")
echo "Start Time: $now"
## Create Main Environment (OSX-64)
conda create -n python3 python=3 --yes
source activate python3
## Jupyter
conda install jupyterlab --yes
## R
conda install -c r r --yes
conda install -c r r-essentials --yes
conda install -c r rstudio --yes
conda install gfortran_osx-64 --yes
conda install -c anaconda clangxx_osx-64 --yes
conda install rpy2 --yes
## Install Python Packages
source ./install_python_packages.sh
## Install R Packages
RScript ./install_r_packages.r
# End
now=$(date +"%T")
echo "End Time: $now"
但是,这些行之一使后端变得非常冗长,因此每次我获取/停用环境或安装软件包时,我都会得到一个非常冗长的后端.
However, one of these lines has made the backend extremely verbose so everytime I source/deactivate an environment or install a package I get a very verbose backend.
如何抑制这种情况或永久使多余的文本静音?在激活环境时,在bash个人资料中,我指示stderr& stdout到/dev/null source activate python3 > /dev/null 2>&1
,但这只是一个不通用的补丁.
How can I suppress this or silence the extra text permanently? In my bash profile when I activate my environment, I direct the stderr & stdout to /dev/null source activate python3 > /dev/null 2>&1
but this is only a patch that is not universal.
我的两台工作计算机都存在这种情况:
OSX 10.11.6 (El Capitan)
和我的个人计算机OSX Sierra
.
This situation exists for both my work computer:
OSX 10.11.6 (El Capitan)
and my personal computer OSX Sierra
.
这是我在下面引用的输出示例:
Here is an example of the output I am referring to below:
jespinozlt-osx:~ jespinoz$ source activate python3
INFO: activate-gfortran_osx-64.sh made the following environmental changes:
+DEBUG_FFLAGS=-march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -Og -g -Wall -Wextra -fcheck=all -fbacktrace -fimplicit-none -fvar-tracking-assignments
+F95=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-gfortran
+FC=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-gfortran
+FFLAGS=-march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe
+FORTRANFLAGS=-march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe
+GFORTRAN=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-gfortran
INFO: activate_clang_osx-64.sh made the following environmental changes:
+AR=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-ar
+AS=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-as
+CC=x86_64-apple-darwin13.4.0-clang
+CFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe
+CHECKSYMS=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-checksyms
+CLANG=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-clang
+CODESIGN_ALLOCATE=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-codesign_allocate
+CONDA_BUILD_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
+CPPFLAGS=-D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9
+DEBUG_CFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -Og -g -Wall -Wextra
+INDR=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-indr
+INSTALL_NAME_TOOL=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-install_name_tool
+LD=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-ld
+LDFLAGS=-Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs
+LDFLAGS_LD=-pie -headerpad_max_install_names -dead_strip_dylibs
+LIBTOOL=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-libtool
+LIPO=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-lipo
+NM=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-nm
+NMEDIT=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-nmedit
+OTOOL=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-otool
+PAGESTUFF=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-pagestuff
+RANLIB=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-ranlib
+REDO_PREBINDING=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-redo_prebinding
+SEGEDIT=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-segedit
+SEG_ADDR_TABLE=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-seg_addr_table
+SEG_HACK=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-seg_hack
+SIZE=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-size
+STRINGS=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-strings
+STRIP=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-strip
+_PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_x86_64_apple_darwin13_4_0
INFO: activate_clangxx_osx-64.sh made the following environmental changes:
+CLANGXX=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-clang++
+CXX=x86_64-apple-darwin13.4.0-clang++
+CXXFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0
+DEBUG_CXXFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0 -Og -g -Wall -Wextra
下面是指向pastebin
的链接,用于请求的输出/脚本:
如塔伦·拉尔瓦尼(Tarun Lalwani)在评论中所建议:
Below are links to pastebin
for requested outputs/scripts:
As suggested by Tarun Lalwani in comments:
bash -xlc源激活python3" 1> activate_output.o
bash -xlc源代码激活python3" 2> activate_output.e
Trishansh Bhardwaj和Tarun Lalwani在评论中要求的脚本:
Scripts requested by Trishansh Bhardwaj and Tarun Lalwani in comments:
推荐答案
如果您查看以下文件夹
/Users/jespinoz/anaconda/envs/python3/etc/conda
同一文件夹中有一个activate.d
和deactivate.d
文件夹,该文件夹在activate
和deactivate
There is a activate.d
and deactivate.d
folder inside the same, which gets executed, during activate
and deactivate
这些文件具有以下代码部分
These files have below code section
if [ $? -ne 0 ]; then
echo "ERROR: $(_get_sourced_filename) failed, see above for details"
else
if [ -f /tmp/new-env-$$.txt ]; then
rm -f /tmp/new-env-$$.txt || true
fi
env > /tmp/new-env-$$.txt
echo "INFO: $(_get_sourced_filename) made the following environmental changes:"
diff -U 0 -rN /tmp/old-env-$$.txt /tmp/new-env-$$.txt | tail -n +4 | grep "^-.*\|^+.*" | grep -v "CONDA_BACKUP_" | sort
fi
rm -f /tmp/old-env-$$.txt /tmp/new-env-$$.txt || true
您需要对它们进行注释以禁用详细输出.该代码基本上将当前的env
保存到文件中,然后运行激活代码,再次捕获env
并打印差异
You need to comment these to disable the verbose output. This code basically saves current env
to a file and then run the activation code, capture env
again and print the diff
这篇关于如何在conda中沉默或抑制gfortran(或clang?)后端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!