-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support spaces in the install path for the installers #716
Comments
Lets use this issue @mingwandroid as a placeholder for any issue related to spaces |
I just experienced this issue with Anaconda3 5.0.0 and Python 3 on Windows 10 as described in #1029 |
What is the status of this issue? One of my students just hit this issue on Windows. |
Should be fixed, but really, try not to use paths with spaces if you can avoid it. |
The default directory structure and anaconda-installation location on Windows has space in it for the average user. I know not to do this myself, but it is hard to deftly instruct some ~200 high school students in an online course towards this end. Was there ever a PR that resolved this? |
I just tried ignoring the alert about spaces in usernames and following through with the installation. After working for a few hours, Anaconda Prompt ended up losing track of my virtual environments. Using thinks like C:\Users\CHRISC~1\Anaconda3 as an installation path doesn't work. Installer treats ~ as an illegal character. Installing as root uses C:\ProgramData\Anaconda3 by default on Windows 10, which solves the issue of spaces in the path. If this continues to work as a temporary solution, I am fine with it. |
It looks like the required changes to the Unix Here is a minimal hack to illustrate this, which works on my machine. (I just disabled the byte-count check here.) --- old.sh 2018-11-05 16:35:53.000000000 -0500
+++ new.sh 2018-11-05 16:35:40.000000000 -0500
@@ -76,7 +76,7 @@
-t run package tests after installation (may install conda-build)
"
-if which getopt > /dev/null 2>&1; then
+if false; then
OPTS=$(getopt bfhp:sut "$*" 2>/dev/null)
if [ ! $? ]; then
printf "%s\\n" "$USAGE"
@@ -164,7 +164,7 @@
fi
# verify the size of the installer
-if ! wc -c "$THIS_PATH" | grep 38019315 >/dev/null; then
+if wc -c "$THIS_PATH" | grep 38019319 >/dev/null; then
printf "ERROR: size of %s should be 38019315 bytes\\n" "$THIS_FILE" >&2
exit 1
fi
@@ -297,7 +297,7 @@
fi
fi # !BATCH
-case "$PREFIX" in
+case "PREFIX" in
*\ * )
printf "ERROR: Cannot install into directories with spaces\\n" >&2
exit 1
@@ -342,8 +342,8 @@
fi
PRECONDA="$PREFIX/preconda.tar.bz2"
-bunzip2 -c $PRECONDA | tar -xf - --no-same-owner || exit 1
-rm -f $PRECONDA
+bunzip2 -c "$PRECONDA" | tar -xf - --no-same-owner || exit 1
+rm -f "$PRECONDA"
PYTHON="$PREFIX/bin/python"
MSGS="$PREFIX/.messages.txt"
@@ -364,7 +364,7 @@
fi
PKG_PATH="$PREFIX"/pkgs/$1
PKG="$PKG_PATH".tar.bz2
- mkdir -p $PKG_PATH || exit 1
+ mkdir -p "$PKG_PATH" || exit 1
bunzip2 -c "$PKG" | tar -xf - -C "$PKG_PATH" --no-same-owner || exit 1
"$PREFIX/pkgs/python-3.7.0-hc167b69_0/bin/python" -E -s \
"$PREFIX"/pkgs/.install.py $INST_OPT --root-prefix="$PREFIX" --link-dist="$1" || exit 1
@@ -422,7 +422,7 @@
cat "$MSGS"
rm -f "$MSGS"
-$PYTHON -E -s "$PREFIX/pkgs/.cio-config.py" "$THIS_PATH" || exit 1
+"$PYTHON" -E -s "$PREFIX/pkgs/.cio-config.py" "$THIS_PATH" || exit 1
printf "installation finished.\\n"
if [ "$PYTHONPATH" != "" ]; then I agree that other command-line tools may have bugs for paths with spaces, but I don't think the installer should refuse to install. Give a warning at most. |
(If I wanted to submit a PR for this, where would I submit to? I'm not sure which repo the miniconda installer is in.) |
From my current perspective (the amount of collatoral damage this would cause), I'm not sure fixing this is in anyone's best interests. Are you aware that we do text based prefix replacement in things like bash scripts when necessary? PATHs and env vars?, so a file may contain:
and we replace that with:
.. what happens when we inspect GDAL_ROOT?
Aah oops, ok, you could make a PR to conda to 'fix' this based on detecting the filetype - adding quotes to some files will break them - and suffer the knock-ons but where does it end? Then you have the issue of Unix tools that we provide that were written with the explicit assumption that spaces would not be supported in file paths. What happens when someone tries to build a conda package using GNU make (one of these tools)? Support requests? |
BTW, on Windows, this issue is far less of an issue since Windows software is coded (or the WIndows specific parts are coded) so that spaces in paths work and often so that trivial relocation works. Unforutunately much of the Unix world is oriented towards installing to a known fixed prefix (often space-incompatible) and we are left to deal with that as best we can. |
My original complaint was Windows-based. Definitely still an issue. The trick with Windows is to select “install as root” so that you minimize the chance of spaces in the path. |
If you do want to submit a PR the URL is here: https://github.com/conda/constructor |
@chrisconlan you didn't provide any reproducible steps for your problem, it's far too nebulous for us to look into as things stand. You say it's definitely still an issue, at what version of Miniconda or Anaconda does that statement stand? FWIW I don't believe we have a big problem on Windows around spaces, based on my own testing. If you can provide a simple reproduction case we can try to look into it. You say 'virtualenv' specifically though, do you mean conda environments here? |
@chrisconlan if you want to continue this it would be best to open a new issue here and fill in the template details. |
I wanted to raise the issue but I don’t have time to gut my Windows machine. Feel free to ignore me if you don’t think it’s an issue anymore. |
Oh I'm not ignoring you, we just have our priorities. |
Understood. |
Can you answer about the nature of the envs. you had trouble with? Knowing which software (conda, virtualenv, venv, pipenv) caused you trouble is fundamental to being able to fix it; |
If I remember correctly, I had just factory reset a windows machine, and I was trying to install Anaconda again. I opted to install on a user level and not global/root level, which caused Anaconda to install on C:\Users\Chris Conlan\Anaconda3. I got the warning about spaces, but proceeded anyway. I only used conda environments, not venv or virtualenv, and then I started to notice my conda environments would persist for one session then disappear the next. This was through the Anaconda Promot only, and through activate.bat. I uninstalled and reinstalled Anaconda as global/root on Windows to C:\ProgramData\Anaconda3 and had no problems. That’s the best I got. Hope it helps. |
Yes, that's helpful, thanks. |
I was having similar problems by installing Miniconda in my Users folder (which contains a space). So I did a complete uninstall and reinstalled Miniconda in C:\Miniconda3 (as is suggested here). Here's my output:
|
Is there still no solution to this? I am tired of updating my conda packages every now and then to see if the issue is fixed. Can this be fixed? How can I help? It is simple to understand the problem. Bear with me please, I got a brand new laptop, DELL G3 15 with windows 10 preinstalled. I installed chrome and downloaded the LATEST anaconda installer. I opened anaconda prompt not power shell not cmd. I created an environment and activated it. It all worked nice and good, then I restarted my machine (unfortunately) and opened the anaconda prompt but this error was showing:
My user profile has a space in it and now I cannot activate any environment. I don't want to make a new user nor do I want to reinstall my windows. I did reinstall anaconda on root but still this issue persists. Opening the anaconda prompt as an admin gives this error:
@mingwandroid Hope it is not too nebulous now. |
You may have old activate scripts that aren't getting updated for whatever
reason when you update conda.
Try running `conda init`
Our test suite uses paths with spaces throughout, and this should work in
conda 4.6.14. The only thing I'm aware of that might break it would be old
stuff still lying around somehow. Sometimes I've seen the start menu keep
old shortcuts to anaconda prompt, even though new shortcuts have replaced
the old on disk. We haven't found a solution to that, other than to use an
alternate program for the start menu (https://superuser.com/a/987952/184799).
Hacks to refresh the start menu database might work, too:
https://superuser.com/questions/955139/some-start-menu-shortcuts-are-missing-on-windows-10/967016#967016
…On Sat, Jun 8, 2019, 06:00 Jawad Arshad ***@***.***> wrote:
Is there still no solution to this? I am tired of updating my conda
packages every now and then to see if the issue is fixed. Can this be
fixed? How can I help?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#716?email_source=notifications&email_token=AAAJL6PTWCWIC4VPCIDABITPZOGMHA5CNFSM4B6U3HV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXHSPWA#issuecomment-500115416>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAJL6IYVAW7HNUQYUJTZZDPZOGMHANCNFSM4B6U3HVQ>
.
|
The output of "conda init": I find it hard to use the information given in the links you have provided. But I did make sure that I have removed everything and installed the anaconda clean again. I face similar problems with the windows cmd. |
This is still a problem with the Linux miniconda installer. If $PREFIX has a space in it it half-works and then crashes:
It also incorrectly makes a second folder:
If
The installer is even aware of the issue but just ignores it:
This is the version:
|
@kousu I'm seeing exactly the same. I've got the following patch that should fix most of the issues, but not sure where to open a pull request: --- Miniconda3-latest-Linux-x86_64.sh 2021-05-06 16:31:10.770625898 +0100
+++ Miniconda3-latest-Linux-x86_64.sh 2021-05-06 17:15:56.855432100 +0100
@@ -77,7 +77,7 @@
"
if which getopt > /dev/null 2>&1; then
- OPTS=$(getopt bfhp:sut "$*" 2>/dev/null)
+ OPTS=$(getopt bfhp:sut "$@" 2>/dev/null)
if [ ! $? ]; then
printf "%s\\n" "$USAGE"
exit 2
@@ -348,13 +348,6 @@
fi
fi # !BATCH
-case "$PREFIX" in
- *\ * )
- printf "ERROR: Cannot install into directories with spaces\\n" >&2
- exit 1
- ;;
-esac
-
if [ "$FORCE" = "0" ] && [ -e "$PREFIX" ]; then
printf "ERROR: File or directory already exists: '%s'\\n" "$PREFIX" >&2
printf "If you want to update an existing installation, use the -u option.\\n" >&2
@@ -363,7 +356,6 @@
REINSTALL=1
fi
-
if ! mkdir -p "$PREFIX"; then
printf "ERROR: Could not create directory: '%s'\\n" "$PREFIX" >&2
exit 1
@@ -441,20 +433,20 @@
"$CONDA_EXEC" constructor --prefix "$PREFIX" --extract-tarball < "$POSTCONDA" || exit 1
rm -f "$POSTCONDA"
-rm -f $PREFIX/conda.exe
-rm -f $PREFIX/pkgs/env.txt
+rm -f "$CONDA_EXEC"
+rm -f "$PREFIX/pkgs/env.txt"
-rm -rf $PREFIX/install_tmp
+rm -rf "$PREFIX/install_tmp"
export TMP="$TMP_BACKUP"
-mkdir -p $PREFIX/envs
+mkdir -p "$PREFIX/envs"
if [ -f "$MSGS" ]; then
cat "$MSGS"
fi
rm -f "$MSGS"
# handle .aic files
-$PREFIX/bin/python -E -s "$PREFIX/pkgs/.cio-config.py" "$THIS_PATH" || exit 1
+"$PREFIX/bin/python" -E -s "$PREFIX/pkgs/.cio-config.py" "$THIS_PATH" || exit 1
printf "installation finished.\\n"
if [ "$PYTHONPATH" != "" ]; then
@@ -493,9 +485,9 @@
else
if [[ $SHELL = *zsh ]]
then
- $PREFIX/bin/conda init zsh
+ "$PREFIX/bin/conda" init zsh
else
- $PREFIX/bin/conda init
+ "$PREFIX/bin/conda" init
fi
fi
printf "If you'd prefer that conda's base environment not be activated on startup, \\n" |
I think I found the right repository, created a PR: conda/constructor#449 |
This issue is fixed. Please confirm. |
Sorry, it's not fixed yet, or at least the fix hasn't made it to miniconda yet:
And it still mis-creates a spare directory (just named
|
There are cases on UNIX where a user wants to be able install Anaconda on a path that has spaces. (@maysonicboom) (Currently the installer does not support this and gives the user the correct warning message.)
The text was updated successfully, but these errors were encountered: