Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[farmshare-discuss] Python3 (Outdated) Version

vanessa sochat vsochat at stanford.edu
Wed Sep 21 01:12:48 PDT 2016


I haven't used corn in a million years, so my home may outdated, but I'll
see if I can help! First, in order to "remove" an executable from your
path, you might have the following options:

1) remove the path to the executable
2) remove the alias, given that it's an alias
3) load a module for another python3 (this basically just does #4, below)
4) add another python3 further up in your path, to be found first
5) replace it with a different executable by setting your python3 alias of
choice

*TLDR: *option 5 is probably the best, but I'll walk through my thinking of
the others anyway! :)


*1) remove the path to the executable*

First, we might look to see where the different pythons are set:

corn14:~> which python3
> /usr/bin/python3
> corn14:~> which python3.4
> /usr/bin/python3.4


and as you showed, the folder "/usr/bin" is on your path... where is that
set? For me it's in the file.cshrc, and here is where we already start to
see differences, because my shell doesn't seem to be bash:

corn14:~> echo $SHELL
> /bin/tcsh


But I can still look in the equivalent of $HOME/.profile or
$HOME/.bash_profile or $HOME/.bashrc to see where it's set:

corn14:~> vim $HOME/.cshrc
> # First, set up a default path (site_path).  The local default
> # should be set for you in /etc/csh.cshrc.  If none is set, we
> # set a resonable default base system path here.
> if ( ! $?site_path ) then
>     if ( -f /etc/debian_version || -f /etc/redhat_release ) then
>         set site_path=( \
>             /usr/local/bin /usr/bin /bin /usr/bin/X11 /usr/sbin /sbin \
>             /usr/games /usr/sweet/bin /usr/pubsw/bin /usr/pubsw/X/bin \
>             )
>     else
>         set site_path=( \
>             /usr/local/bin /usr/sweet/bin /usr/pubsw/bin \
>             /usr/bin /bin /usr/sbin /sbin /usr/proc/bin \
>             /usr/local/X/bin /usr/sweet/X/bin /usr/pubsw/X/bin
> /usr/bin/X11 \
>             /opt/SUNWspro/bin /opt/langtools/bin /usr/lang /usr/ccs/bin \
>             /usr/ucb /usr/bsd /usr/etc \
>             /usr/dt/bin /usr/openwin/bin /usr/demos/bin /usr/audio/bin \
>             /usr/games \
>             )
>     endif
> endif


This means that option "remove the path to the executable" is probably not
going to work, because /usr/bin is a pretty important spot :)

*2) remove the alias, given that it's an alias*

My next question was if it's an alias or an actual executable, I could
confirm this with the command "alias"

corn14:~> alias
> ..      cd ..
> back    cd -
> clearMT (eval `/farmshare/software/free/lmod-5.0-install/lmod/lmod/libexec/clearMT_cmd
> csh`)
> cp      cp -i
> cwdcmd  eval `$LMOD_SETTARG_CMD -s csh`
> dir     ls -alg
> jobs    jobs -l
> lpr     lpr -h
> ml      eval `/farmshare/software/free/lmod-5.0-install/lmod/lmod/libexec/ml_cmd
> !*`
> module  (eval `$LMOD_CMD csh  !*` ; eval `$LMOD_SETTARG_CMD -s csh`)
> mv      mv -i
> orig    cp -p !:1 !:1.orig
> precmd  echo -n "\033]2;${TARG_TITLE_BAR_PAREN}${HOST}:$cwd\007"
> quiet   !* >& /dev/null &
> rm      rm -i


Note that you can also use the command "which" and it will show either an
alias or an executable, here is an example with an alias "module"

corn28:~> which module
> module:          aliased to eval `$LMOD_CMD csh  !*` ; eval
> `$LMOD_SETTARG_CMD -s csh`


I don't see it, so this means it's an executable on the path! The option to
"remove the alias, given that it's an alias" won't work then.


*3) load a module for another python3*

On sherlock there are different modules for python to load, so maybe if we
can load a python3 on Sherlock from some (more consistent) path, this would
fix our problem? If you do "module spider python*" the other available are
a Biopython module, this won't work.


*4) add another python3 further up in your path, to be found first*

You could literally install some other python (eg, anaconda) and then add
it earlier to your path in your .bashrc, or .bash_profile, but you probably
don't want to do this given that you have other versions already installed
that you like. We also don't have much space on our $HOME folder, so this
is an expensive option. I'll skip over this option.


*5) replace it with a different executable by setting your python3 alias of
choice*

You can just set an alias for python3 to point to whatever version you
want.  You would do this by opening up your .bashrc, .bash_profile, or in
my case, .cshrc, and adding the alias toward the end:

# For cshrc
> alias python3 python3.4
> # I think this might be for bash
> alias python3="python3.4"


Again, this will only last for the shell session, so you want to put it in
one of the files that gets sourced when a new shell opens. For me I tried
setting the "python" alias to point to "python3" instead of python 2.7.6,
and then I can check using "which"

corn28:~> which python3
> python3:         aliased to python



Finally, for comparison's sake, it looks like my python3 is set to the
newer version, 3.4.3,

corn28:~> python3
> Python 3.4.3 (default, Oct 14 2015, 20:28:29)
> [GCC 4.8.4] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> quit()


so you may in fact have something additional in your setup that I don't.
Likely you can't be absolutely sure that every corn node is the same, so
you would do best to set your preferred python, and then run some tests to
see how it works across nodes by submitting some basic jobs to print paths
and versions.  I hope some of this helps you to figure it out!



On Tue, Sep 20, 2016 at 10:09 PM, Andreas Santucci <
santucci.andreas at gmail.com> wrote:

> Currently, the python3 command on Corn launches python 3.3.5 (for me).
>
> santucci at corn28:~$ python3
> Python 3.3.5 (default, Sep 21 2014, 22:14:07)
> [GCC 4.8.1] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>
> There is a newer version installed as well, 3.4.3, but it must be called
> manually via python3.4
> santucci at corn28:~$ python3.4
> Python 3.4.3 (default, Oct 14 2015, 20:28:29)
> [GCC 4.8.4] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>
> Is there a way we can request that the outdated version be removed from the
> python3 alias?
>
> System Information:
> santucci at corn28:~$ echo $SHELL
> /bin/bash
>
> santucci at corn28:~$ echo $PATH
> /farmshare/software/free/oge/2011.11p1/bin/linux-x64:/usr/
> local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/
> usr/games:/usr/local/games
>
> (As a secondary issue, is it possible this behavior may vary from corn
> machine to corn-machine? E.g., if one is using Corn23 vs Corn28? If this is
> might be the case, what are the guarantees of homogeneity among Corn
> servers?)
>
> _______________________________________________
> farmshare-discuss mailing list
> farmshare-discuss at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/farmshare-discuss
>



-- 
Vanessa Villamia Sochat
Stanford University
(603) 321-0676
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/farmshare-discuss/attachments/20160921/1478ded3/attachment-0001.html>


More information about the farmshare-discuss mailing list