Editing CommunityData:Hyak software installation

From CommunityData

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 17: Line 17:


=== Python Packages ===
=== Python Packages ===
Our setup on Mox provides the Anaconda python distribution.  
Our setup on Mox provides the Anaconda python distribution.  


Using an anaconda python distribution has important implications for how you install packages. While in normal python, you would install python packages using `pip`, when you use an anaconda distribution you should use <code>conda</code> to install packages. Conda also has some fancy features like virtual environments for using different versions of python or different versions of packages in different projects. The problem with using conda is that it does not include all the packages you might want to use. If you want to install a python package that is missing from conda, you can use pip. ''Importantly, you should prefer to install software using conda over pip.''
Using an anaconda python distribution has important implications for how you install packages. While in normal python, you would install python packages using `pip`, when you use an anaconda distribution you should use `conda` to install packages. Conda also has some fancy features like virtual environments for using different versions of python or different versions of packages in different projects. The problem with using conda is that it does not include all the packages you might want to use. If you want to install a python package that is missing from conda, you can use pip.


Details on both are here:
Importantly, you should prefer to install software using conda over pip.


* [https://conda.io/docs/ Conda Documentation]
[https://conda.io/docs/ Conda Documentation]
* [https://pip.pypa.io/en/stable/ Pip Documentation]
[https://pip.pypa.io/en/stable/ Pip Documentation]


It's often a good idea to create new environments for installing software you will use in each project. This way you can use the latest and greatest versions of packages, but you'll still be able to run code in your old projects. To create a new conda environment:  
It's often a good idea to create new environments for installing software you will use in each project. This way you can use the latest and greatest versions of packages, but you'll still be able to run code in your old projects. To create a new conda environment:  


<syntaxhighlight lang='bash'>
    conda create -n my_root
$ conda create -n my_root
 
</syntaxhighlight>
Then add the following to your .bashrc to use this environment automatically by default.
Then add the following to your .bashrc to use this environment automatically by default:
    if [ -z $(conda info --env | grep my_root | grep \*) ]; then
        source activate my_root
    fi


<syntaxhighlight lang='bash'>
if [ -z $(conda info --env | grep my_root | grep \*) ]; then
    source activate my_root
fi
</syntaxhighlight>
Conda doesn't like it when you try to activate an environment that is already active.  
Conda doesn't like it when you try to activate an environment that is already active.  


Conda modifies your prompt in a possibly annoying way. To disable this behavior run the command:  
Conda modifies your prompt in a possibly annoying way. To disable this behavior run the command:  
    $ conda config --set changeps1 False
<!-- If you need python libraries that are not installed in the shared environment:
$ pip3 install --user YOURLIBHERE
...replacing YOURLIBHERE with the name of the library you need, e.g. 'pandas'. The --user option will install it for just you.


<syntaxhighlight lang='bash'>
If you have a lot of dependencies for a specific project, consider using [[#Python Virtual Environments |Python Virtual Environments]] -->
$ conda config --set changeps1 False
</syntaxhighlight>


=== Custom modules ===
=== Custom modules ===
Please note that all contributions to CommunityData are considered to be released under the Attribution-Share Alike 3.0 Unported (see CommunityData:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel Editing help (opens in new window)

Template used on this page: