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

Mr. Addis Walter O'Connor addiso at stanford.edu
Wed Sep 21 10:49:05 PDT 2016


Hi Nick,

A new user (in fact most users) will get python 3.4.3 when they call the ‘python3’ command. On all of the Farmshare machines /usr/bin/python3 is linked to /usr/bin/python3.4 so you can call either command to launch python 3.4.3. All Farmshare machines should behave the same when calling python3 and if this is not the behavior you are seeing, please let us know right away.

corn28:~$ which python3
/usr/bin/python3
corn28:~$ ls -alth /usr/bin/python3
lrwxrwxrwx 1 root root 9 Mar 23  2014 /usr/bin/python3 -> python3.4

Andreas has a custom setting in his ~/.bashrc file that hardcodes the ‘python3’ command to a specific version, in his case 3.3.5, which can be setup by any user, but is not the default behavior.

Andreas, if you would like to change the behavior of the python3 command on the Farmshare machines, you can simply comment out or remove the first 2 lines of your .bashrc file;

# AS_edit
alias python3="/afs/ir/class/stats202/opt/python3.3/bin/python3"
alias ipython3="/afs/ir/class/stats202/opt/python3.3/bin/ipython”

Then log out and log back in, or run ‘source ~/.bashrc’ and then the python3 command will launch 3.4.3 as expected.

Please feel free to contact us at ‘research-computing-support at stanford.edu’ if you run into any other trouble.

Best,

Addis O'Connor

HPC System Administrator

Polya Hall, Room 263

Stanford | University IT

Research Computing

P: 650.736.6993

C: 650.529.5782

addiso at stanford.edu<mailto:addiso at stanford.edu>


From: farmshare-discuss <farmshare-discuss-bounces at lists.stanford.edu<mailto:farmshare-discuss-bounces at lists.stanford.edu>> on behalf of Nick Henderson <nwh at stanford.edu<mailto:nwh at stanford.edu>>
Reply-To: Open discussion for users of FarmShare <farmshare-discuss at lists.stanford.edu<mailto:farmshare-discuss at lists.stanford.edu>>
Date: Wednesday, September 21, 2016 at 8:40 AM
To: Open discussion for users of FarmShare <farmshare-discuss at lists.stanford.edu<mailto:farmshare-discuss at lists.stanford.edu>>
Subject: Re: [farmshare-discuss] Python3 (Outdated) Version


On corn, my python3 is also Python 3.4.3.

[nwh at corn19 ~]
$ alias
alias la='ls -alh'
alias ll='ls -lh'

[nwh at corn19 ~]
$ which python3
/usr/bin/python3

[nwh at corn19 ~]
$ 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.
>>>


Can anybody tell us what the behavior will be for a new corn user?

​

On Wed, Sep 21, 2016 at 1:13 AM vanessa sochat <vsochat at stanford.edu<mailto:vsochat at stanford.edu>> wrote:
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<mailto: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<mailto:farmshare-discuss at lists.stanford.edu>
https://mailman.stanford.edu/mailman/listinfo/farmshare-discuss



--
Vanessa Villamia Sochat
Stanford University
(603) 321-0676
_______________________________________________
farmshare-discuss mailing list
farmshare-discuss at lists.stanford.edu<mailto:farmshare-discuss at lists.stanford.edu>
https://mailman.stanford.edu/mailman/listinfo/farmshare-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/farmshare-discuss/attachments/20160921/39394cb9/attachment-0001.html>


More information about the farmshare-discuss mailing list