Open jvhaarst opened 5 years ago
I know this was already mentioned in https://github.com/ContinuumIO/anaconda-issues/issues/10173 But that one is closed, and the problem is still there.
My init lines look like this :
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/haars001/miniconda2/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/haars001/miniconda2/etc/profile.d/conda.sh" ]; then
. "/home/haars001/miniconda2/etc/profile.d/conda.sh"
else
export PATH="/home/haars001/miniconda2/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
If I remove them :
time source ~/.bashrc
real 0m0.720s
user 0m0.100s
sys 0m0.114s
If I include them :
time source ~/.bashrc
real 0m21.709s
user 0m1.378s
sys 0m2.813s
The culprit seems to be the '/home/haars001/miniconda2/bin/conda' 'shell.bash' 'hook'
and eval
parts, as running those separately gives:
time __conda_setup="$('/home/haars001/miniconda2/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
real 0m6.986s
user 0m0.192s
sys 0m0.736s
and
time eval "$__conda_setup"
real 0m14.758s
user 0m0.980s
sys 0m2.161s
Here are the output trace files that I created like this :
strace -r -s 80 '/home/haars001/miniconda2/bin/conda' 'shell.bash' 'hook' |& tee hookcreate.trace.txt
/home/haars001/miniconda2/bin/conda 'shell.bash' 'hook' > hook.bash
strace -r -s 80 bash hook.bash |& tee hook.trace.txt
hookcreate.trace.txt hook.trace.txt
If you need more info to track this down, please let me know.
It looks like you might be using pip_interop_enabled
. I'm guessing this because your traces show a lot of interaction with .egg stuff. If not, the next place I'd look is the <install prefix>/etc/conda/activate.d
folder. These are shell scripts that get sourced to set env vars. One or more of these may be your slow-down. Your environment is massive, so there may be many of these. If you track it back to a particular package, please pay attention to which channel you obtained that package from. You'll need to file issues on the repository where your package came from, not on this repository (unless the troublesome package comes from the defaults channel). We can't support things that other people provide.
I have done a massive cleanup of my base environment, and that removed a lot of stuff from the trace, but it didn't solve it. (and conda got updated to 4.6.9)
conda list --show-channel-urls
Create traces:
strace -r -s 200 '/home/haars001/miniconda2/bin/conda' 'shell.bash' 'hook' 2> hookcreate.trace.txt 1>hook.bash
strace -r -s 200 bash hook.bash 2> hook.trace.txt
Check traces for slow parts :
grep -v ' 0.00' hookcreate.trace.txt
0.015880 getdents(4, /* 0 entries */, 32768) = 0
0.059119 fstat(5, {st_mode=S_IFREG|0664, st_size=36166, ...}) = 0
0.021839 fstat(4, {st_mode=S_IFREG|0664, st_size=7521, ...}) = 0
0.021268 fstat(4, {st_mode=S_IFREG|0664, st_size=553, ...}) = 0
0.012556 fstat(6, {st_mode=S_IFREG|0664, st_size=32457, ...}) = 0
0.020299 fstat(7, {st_mode=S_IFREG|0664, st_size=7842, ...}) = 0
0.012418 fstat(6, {st_mode=S_IFREG|0664, st_size=1310, ...}) = 0
0.012670 fstat(5, {st_mode=S_IFREG|0664, st_size=7109, ...}) = 0
0.127572 fstat(6, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
0.015807 read(6, "", 4096) = 0
0.019757 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=6626, si_uid=16825946, si_status=0, si_utime=0, si_stime=0} ---
0.015011 openat(AT_FDCWD, "/home/haars001/miniconda2.nobackup/bin/ctypes.pyc", O_RDONLY) = -1 ENOENT (No such file or directory)
0.015144 fstat(6, {st_mode=S_IFREG|0664, st_size=31054, ...}) = 0
0.017126 fstat(5, {st_mode=S_IFREG|0664, st_size=0, ...}) = 0
0.064033 fstat(11, {st_mode=S_IFREG|0664, st_size=4370, ...}) = 0
0.011327 fstat(10, {st_mode=S_IFREG|0664, st_size=2297, ...}) = 0
0.011297 fstat(9, {st_mode=S_IFREG|0664, st_size=18843, ...}) = 0
0.058932 read(11, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@ \0\0\0\0\0\0@\0\0\0\0\0\0\0\10\342\1\0\0\0\0\0\0\0\0\0@\0008\0\10\0@\0\32\0\31\0\1\0\0\0\4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0(\34\0\0\0\0\0\0(\34\0\0\0\0\0\0\0\20\0\0\0\0\0\0\1\0\0\0\5\0\0\0\0 \0\0\0\0\0\0\0 \0\0\0\0\0\0\0 \0\0\0\0\0\0v^\1\0\0\0\0\0v^\1\0\0\0\0\0\0\20\0\0\0\0\0\0\1\0\0\0\4\0\0\0\0\200\1\0\0\0\0\0\0\200\1\0\0\0\0\0"..., 832) = 832
0.038842 fstat(12, {st_mode=S_IFREG|0664, st_size=6078, ...}) = 0
0.012494 fstat(12, {st_mode=S_IFREG|0664, st_size=40959, ...}) = 0
0.056042 fstat(5, {st_mode=S_IFREG|0664, st_size=545, ...}) = 0
0.049760 +++ exited with 0 +++
grep -v ' 0.00' hook.trace.txt
5.578672 read(3, "ocal/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/haars001/.fzf/", 128) = 128
0.011248 close(3) = 0
0.014896 rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f3734df3f20}, {sa_handler=0x5619d350e030, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f3734df3f20}, 8) = 0
So it looks like my storage is the culprit, as the only slow parts are now stats and reads...
The conda part is still very slow, though :
time source .bashrc
real 0m0.657s
user 0m0.088s
sys 0m0.117s
# enable conda init lines
time source .bashrc
real 0m12.073s
user 0m0.431s
sys 0m1.353s
Yeah, that's still way too slow. Are you on some sort of network drive?
Yeah, very slow and annoying NFS link. We are working on getting it better. Feel free to close this, as it doesn't look like something on your end.
Mine was a ridiculous thing
newgrp docker
should not be part of the startup script. it runs in a loop
Actual Behavior
Starting up a new terminal session with conda init lines present is very slow.
Expected Behavior
Startup should be quick, maybe a second slower than without init lines
Steps to Reproduce
Run conda init to add the lines.
Anaconda or Miniconda version:
conda 4.6.8
Operating System:
Linux, Ubuntu 18.04.2 LTS
conda info
conda list --show-channel-urls