-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Checklist
- I added a descriptive title
- I searched open reports and couldn't find a duplicate
What happened?
I installed miniconda3 on a fresh Windows machine, which has msys2. In the installer, I selected not to add miniconda to $PATH. In my user environment (in the registry) I add the necessary dirs (~/miniconda3
and ~/miniconda3/Scripts
) to $PATH.
In my .zshrc
I try to set up miniconda like this:
eval $($HOME/miniconda3/Scripts/conda shell.zsh hook)
but that fails because of \r
(CR) characters in the output of cygpath
and the conda exe.
As a workaround, I put the output of the shell.zsh hook
command into a tmp shell script and added 4 calls to |tr -d '\r'
, i.e. remove the extraneous CRs. Now that script works to set up conda in my msys zsh; I can activate, deactivate, and use python.
I'm not sure where to patch miniconda itself, but here is my modified script. See the tr
calls. I think you could add these always without issue on other systems (Mac, Linux) as long as they can find tr
.
export CONDA_EXE="$(cygpath 'C:\Users\garyo\miniconda3\Scripts\conda.exe' | tr -d '\r')"
export _CE_M=''
export _CE_CONDA=''
export CONDA_PYTHON_EXE="$(cygpath 'C:\Users\garyo\miniconda3\python.exe' | tr -d '\r')"
# Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
__conda_exe() (
"$CONDA_EXE" $_CE_M $_CE_CONDA "$@"
)
__conda_hashr() {
if [ -n "${ZSH_VERSION:+x}" ]; then
\rehash
elif [ -n "${POSH_VERSION:+x}" ]; then
: # pass
else
\hash -r
fi
}
__conda_activate() {
if [ -n "${CONDA_PS1_BACKUP:+x}" ]; then
# Handle transition from shell activated with conda <= 4.3 to a subsequent activation
# after conda updated to >= 4.4. See issue #6173.
PS1="$CONDA_PS1_BACKUP"
\unset CONDA_PS1_BACKUP
fi
\local ask_conda
ask_conda="$(PS1="${PS1:-}" __conda_exe shell.posix "$@" | tr -d '\r')" || \return
\eval "$ask_conda"
__conda_hashr
}
__conda_reactivate() {
\local ask_conda
ask_conda="$(PS1="${PS1:-}" __conda_exe shell.posix reactivate | tr -d '\r')" || \return
\eval "$ask_conda"
__conda_hashr
}
conda() {
\local cmd="${1-__missing__}"
case "$cmd" in
activate|deactivate)
__conda_activate "$@"
;;
install|update|upgrade|remove|uninstall)
__conda_exe "$@" || \return
__conda_reactivate
;;
*)
__conda_exe "$@"
;;
esac
}
if [ -z "${CONDA_SHLVL+x}" ]; then
\export CONDA_SHLVL=0
# In dev-mode CONDA_EXE is python.exe and on Windows
# it is in a different relative location to condabin.
if [ -n "${_CE_CONDA:+x}" ] && [ -n "${WINDIR+x}" ]; then
PATH="$(\dirname "$CONDA_EXE")/condabin${PATH:+":${PATH}"}"
else
PATH="$(\dirname "$(\dirname "$CONDA_EXE")")/condabin${PATH:+":${PATH}"}"
fi
\export PATH
# We're not allowing PS1 to be unbound. It must at least be set.
# However, we're not exporting it, which can cause problems when starting a second shell
# via a first shell (i.e. starting zsh from bash).
if [ -z "${PS1+x}" ]; then
PS1=
fi
fi
conda activate base
Conda Info
active environment : None
shell level : 0
user config file : C:\Users\garyo\.condarc
populated config files :
conda version : 23.10.0
conda-build version : not installed
python version : 3.11.5.final.0
virtual packages : __archspec=1=x86_64
__win=0=0
base environment : C:\Users\garyo\miniconda3 (writable)
conda av data dir : C:\Users\garyo\miniconda3\etc\conda
conda av metadata url : None
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : C:\Users\garyo\miniconda3\pkgs
C:\Users\garyo\.conda\pkgs
C:\Users\garyo\AppData\Local\conda\conda\pkgs
envs directories : C:\Users\garyo\miniconda3\envs
C:\Users\garyo\.conda\envs
C:\Users\garyo\AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/23.10.0 requests/2.31.0 CPython/3.11.5 Windows/10 Windows/10.0.22631 solver/libmamba conda-libmamba-solver/23.11.1 libmambapy/1.5.3
administrator : False
netrc file : None
offline mode : False
Conda Config
--nothing here--
Conda list
# packages in environment at C:\Users\garyo\miniconda3:
#
# Name Version Build Channel
archspec 0.2.1 pyhd3eb1b0_0 defaults
boltons 23.0.0 py311haa95532_0 defaults
brotli-python 1.0.9 py311hd77b12b_7 defaults
bzip2 1.0.8 he774522_0 defaults
ca-certificates 2023.08.22 haa95532_0 defaults
certifi 2023.7.22 py311haa95532_0 defaults
cffi 1.15.1 py311h2bbff1b_3 defaults
charset-normalizer 2.0.4 pyhd3eb1b0_0 defaults
colorama 0.4.6 py311haa95532_0 defaults
conda 23.10.0 py311haa95532_0 defaults
conda-content-trust 0.2.0 py311haa95532_0 defaults
conda-libmamba-solver 23.11.1 py311haa95532_0 defaults
conda-package-handling 2.2.0 py311haa95532_0 defaults
conda-package-streaming 0.9.0 py311haa95532_0 defaults
console_shortcut_miniconda 0.1.1 haa95532_1 defaults
cryptography 41.0.3 py311h89fc84f_0 defaults
fmt 9.1.0 h6d14046_0 defaults
idna 3.4 py311haa95532_0 defaults
jsonpatch 1.32 pyhd3eb1b0_0 defaults
jsonpointer 2.1 pyhd3eb1b0_0 defaults
libarchive 3.6.2 hb62f4d4_2 defaults
libcurl 8.1.1 h86230a5_0 defaults
libffi 3.4.4 hd77b12b_0 defaults
libiconv 1.16 h2bbff1b_2 defaults
libmamba 1.5.3 hcd6fe79_0 defaults
libmambapy 1.5.3 py311h77c03ed_0 defaults
libsolv 0.7.24 h23ce68f_0 defaults
libssh2 1.10.0 he2ea4bf_2 defaults
libxml2 2.10.4 h0ad7f3c_1 defaults
lz4-c 1.9.4 h2bbff1b_0 defaults
menuinst 1.4.19 py311h59b6b97_1 defaults
openssl 3.0.12 h2bbff1b_0 defaults
packaging 23.1 py311haa95532_0 defaults
pcre2 10.42 h0ff8eda_0 defaults
pip 23.3 py311haa95532_0 defaults
pluggy 1.0.0 py311haa95532_1 defaults
powershell_shortcut_miniconda 0.0.1 haa95532_1 defaults
pybind11-abi 4 hd3eb1b0_1 defaults
pycosat 0.6.6 py311h2bbff1b_0 defaults
pycparser 2.21 pyhd3eb1b0_0 defaults
pyopenssl 23.2.0 py311haa95532_0 defaults
pysocks 1.7.1 py311haa95532_0 defaults
python 3.11.5 he1021f5_0 defaults
reproc 14.2.4 hd77b12b_1 defaults
reproc-cpp 14.2.4 hd77b12b_1 defaults
requests 2.31.0 py311haa95532_0 defaults
ruamel.yaml 0.17.21 py311h2bbff1b_0 defaults
setuptools 68.0.0 py311haa95532_0 defaults
sqlite 3.41.2 h2bbff1b_0 defaults
tk 8.6.12 h2bbff1b_0 defaults
tqdm 4.65.0 py311h746a85d_0 defaults
truststore 0.8.0 py311haa95532_0 defaults
tzdata 2023c h04d1e81_0 defaults
urllib3 1.26.18 py311haa95532_0 defaults
vc 14.2 h21ff451_1 defaults
vs2015_runtime 14.27.29016 h5e58377_2 defaults
wheel 0.41.2 py311haa95532_0 defaults
win_inet_pton 1.1.0 py311haa95532_0 defaults
xz 5.4.2 h8cc25b3_0 defaults
yaml-cpp 0.8.0 hd77b12b_0 defaults
zlib 1.2.13 h8cc25b3_0 defaults
zstandard 0.19.0 py311h2bbff1b_0 defaults
zstd 1.5.5 hd43e919_0 defaults
Additional Context
Windows 11 Home, msys2 in c:/msys64
Metadata
Metadata
Assignees
Labels
Type
Projects
Status