swcarpentry / windows-installer

Software Carpentry installer for Windows.
MIT License
21 stars 17 forks source link

bash: nano: command not found #32

Closed karinlag closed 8 years ago

karinlag commented 8 years ago

I have installed things as described here;

http://swcarpentry.github.io/workshop-template/

This includes the installer.

I am now trying to run nano, but I get the following:

VI1452@VIO9971 MINGW64 ~
$ nano
bash: nano: command not found

My path is:

VI1452@VIO9971 MINGW64 ~
$ echo $PATH
/h/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/h/bin:/c
/ProgramData/Oracle/Java/javapath:/c/windows/system32:/c/windows:/c/windows/Syst
em32/Wbem:/c/windows/System32/WindowsPowerShell/v1.0:/c/pbdk/115:/c/PBDK:/c/syba
se/JS-12_5/bin:/c/sybase/OCS-12_5/lib3p:/c/sybase/OCS-12_5/dll:/c/sybase/OCS-12_
5/bin:/c/Program Files (x86)/Enterprise Vault/EVClient:/c/Program Files/SASHome/
x86/Secure/ccme4:/c/Program Files/SASHome/Secure/ccme4:/c/Users/VI1452/AppData/L
ocal/Continuum/Anaconda2:/c/Users/VI1452/AppData/Local/Continuum/Anaconda2/Scrip
ts:/c/Users/VI1452/AppData/Local/Continuum/Anaconda2/Library/bin:/usr/bin/vendor
_perl:/usr/bin/core_perl

VI1452@VIO9971 MINGW64 ~
$

Please note, my "home directory" ($HOME echos /h) is here on a network drive. I am likely to teach from a machine that is configured the same way, so if this turns out to be the issue, I need directions to figure out how to install things elsewhere.

ethanwhite commented 8 years ago

Can you post the contents of .bash_profile from your home directory?

Also, just so I'm clear, /c/Users/VI1452 is your home directory?

ethanwhite commented 8 years ago

Ah, so based on your update your home is /h?

ethanwhite commented 8 years ago

If .bash_profile isn't in /h you can also look for it in /c/Users/VI1452.

karinlag commented 8 years ago

No .bash_profile in /h, but in /c/Users/VI1452:

VI1452@VIO9971 MINGW64 /c/Users/VI1452
$ cat .bash_profile

# Add paths for Software-Carpentry-installed scripts and executables
export PATH="$PATH:/c/Users/VI1452/.swc/lib/nano:/c/Users/VI1452/.swc/lib/sqlite
:/c/Users/VI1452/.swc/bin"

# Make nano the default editor
export EDITOR=nano

# Add paths for Software-Carpentry-installed scripts and executables
export PATH="$PATH:/c/Users/VI1452/.swc/lib/nano:/c/Users/VI1452/.swc/lib/sqlite
:/c/Users/VI1452/.swc/bin"

# Make nano the default editor
export EDITOR=nano

VI1452@VIO9971 MINGW64 /c/Users/VI1452
$
karinlag commented 8 years ago

Just did echo $EDITOR, and nothing showed, so apparently this one wasn't being run. I sourced it, and can now get nano. A bit annoying but...

Suggestions on how to avoid having to have them do that?

ethanwhite commented 8 years ago

Thanks, this is really helpful. So the issue, which is specific to your particular set up, is that the Windows Installer thinks that /c/Users/VI1452 is your home directory. This is standard home on Windows so it's putting the swc files there including the .bash_profile. When you start your shell the shell identifies /h as the home directory, so it looks in /h for a .bash_profile file, doesn't find one, and so doesn't add anything to the path.

If your students don't have this same special configuration then their installations will just work. If they do have this same configuration then the easiest thing is to have them move the .bash_profile file into /h.

ethanwhite commented 8 years ago

Also, could you open up Python and run the following commands and post what they return:

os.environ['HOME']
os.path.expanduser('~')

We currently use the later to try to generically find the home directory, but it's clearly getting tripped up by your setup somehow.

karinlag commented 8 years ago

First, moving the .bash_profile into /h and then restarting works.

Restarting without .bash_profile in / gives:

VI1452@VIO9971 MINGW64 ~
$ python
Python 2.7.10 |Anaconda 2.4.0 (64-bit)| (default, Oct 21 2015, 19:35:23) [MSC v.
1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import os
>>> os.environ['HOME']
'H:\\'
>>> os.path.expanduser('~')
'H:\\'
>>>
karinlag commented 8 years ago

Note, I am leaving this computer now and won't have access to it until tomorrow at the same time, so further input from me won't occur until then.

ethanwhite commented 8 years ago

Since os.path.expanduser('~') is giving the right directory I'm not sure why everything is ending up in /c/Users/VI1452. Did you install it as a different user, or with admin privileges, or something?

karinlag commented 8 years ago

On 11/11/2015 5:09 PM, Ethan White wrote:

Since |os.path.expanduser('~')| is giving the right directory I'm not sure why everything is ending up in |/c/Users/VI1452|. Did you install it as a different user, or with admin privileges, or something?

I installed it with my own user, but I believe that my user has admin priviledge (not a native windowian, so hope I am understanding things correct).

karin

ethanwhite commented 8 years ago

That should be fine, so I'm not really sure what we can do in terms of a general solution here. Since it hasn't come up before I'm inclined to consider this an exceptional case that we've managed to work around leave it at that.

@wking - any thoughts?

wking commented 8 years ago

On Wed, Nov 11, 2015 at 08:09:15AM -0800, Ethan White wrote:

Since os.path.expanduser('~') is giving the right directory I'm not sure why everything is ending up in /c/Users/VI1452.

Me neither. You can debug the install from a terminal with: — $ swc-windows-installer.py --verbose info

which will print the install locations (including the expanded ~/.bash_profile) as it runs. My guess is that this would install in /h. If the original install was with the Inno Setup installer, maybe the Inno Setup installer and shell are seeing different HOMEs? I'm not familiar enough with Windows to know how that could happen, but it's the only thing I can think of at the moment. Maybe the default home directory is something you pick when you install Git for Windows?

JohnRMoreau commented 8 years ago

I'm getting a similar issue.

John@Bender MINGW64 ~
$ nano

Redirection is not supported. 
ethanwhite commented 8 years ago

Hi John - this is actually a different issue that results from how you installed git for Windows: https://github.com/swcarpentry/windows-installer/issues/31

If you reinstall git for Windows l following the current version of the installation instructions it should fix your problem.

On Saturday, November 14, 2015, JohnRMoreau notifications@github.com wrote:

I'm getting a similar issue.

John@Bender MINGW64 ~ $ nano

Redirection is not supported.

— Reply to this email directly or view it on GitHub https://github.com/swcarpentry/windows-installer/issues/32#issuecomment-156726733 .

ethanwhite commented 8 years ago

Closing for now. If anyone else encounters this issue please feel free to reopen.

arokem commented 8 years ago

I'm seeing this one on one machine. No .bash_profile in the home directory.

wking commented 8 years ago

On Thu, Mar 31, 2016 at 11:10:19AM -0700, Ariel Rokem wrote:

I'm seeing this one on one machine. No .bash_profile in the home directory.

Do you also have disagreements about where the home directory is 1? If so, do you know why Bash thinks your home directory is in one place but the SWC Windows installer thinks it's somewhere else?

arokem commented 8 years ago

Sorry - seems like that was a false alarm. This participant had downloaded and installed the GitBash installer, but not the text editor installer.

andreww commented 6 years ago

A quick note to say that we ran into this problem during https://ejh243.github.io/2017-09-26-Exeter/ - windows laptops provided by the University had $HOME in a different drive, but the files were in the c: drive. Moving .bashprofile etc. worked.