{"id":105985,"date":"2017-04-06T15:22:20","date_gmt":"2017-04-06T19:22:20","guid":{"rendered":"http:\/\/www.bu.edu\/tech\/?page_id=105985"},"modified":"2020-08-17T21:06:08","modified_gmt":"2020-08-18T01:06:08","slug":"packages","status":"publish","type":"page","link":"https:\/\/www.bu.edu\/tech\/support\/research\/software-and-programming\/common-languages\/packages\/","title":{"rendered":"Python Packages"},"content":{"rendered":"<p>The <a href=\"https:\/\/www.bu.edu\/tech\/support\/research\/software-and-programming\/common-languages\/python\/versions\">python installations<\/a>\u00a0on the Shared Computing Cluster (SCC)\u00a0include many common python libraries and packages. Most of these are general purpose libraries made available from the Python Package Index (PyPI). Instructions for\u00a0checking package installation and versions are detailed on this page. If you need a package that is not installed in our python modules, please see our <a href=\"https:\/\/www.bu.edu\/tech\/support\/research\/software-and-programming\/common-languages\/python\/install-package\">Installing Python Packages<\/a>\u00a0page or <a href=\"https:\/\/www.bu.edu\/tech\/support\/research\/software-and-programming\/software-and-applications\/request-software\/\">request installation<\/a>\u00a0page.<\/p>\n<p>Strategies to check existing packages and versions are:<\/p>\n<ul>\n<li><a href=\"#pip\">List \u201cpip\u201d Installed Packages\/Modules from PyPI<\/a>\n<ul>\n<li><a href=\"#pip-general\">Centrally Installed Python Packages<\/a><\/li>\n<li><a href=\"#pip-user\">User Installed Python Packages<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#all\">List all Installed Packages\/Module<\/a><\/li>\n<li><a href=\"#individual\">Individual Package Version<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2><a name=\"pip\"><\/a>List \u201cpip\u201d Installed Packages from PyPI<\/h2>\n<h3><a name=\"pip-general\"><\/a>Centrally Installed Python Packages<\/h3>\n<p>The \u201c<code><span class=\"command\">pip<\/span><\/code>\u201d command with the \u201c<code><span class=\"command\">list<\/span><\/code>\u201d method will print a list of all centrally and locally installed PyPI packages and their versions. Because most of our packages are installed this way, this is the fastest way to list package information.<\/p>\n<pre><code class=\"code-block\"><span class=\"prompt\">scc1$<\/span> <span class=\"command\">module load python3\/3.7.7<\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">pip list<\/span>\r\n<span class=\"output\">Package Version\r\n---------------------------------- ------------\r\nabsl-py 0.9.0\r\naffine 2.3.0\r\nalabaster 0.7.12\r\nannoy 1.16.3\r\nappdirs 1.4.4<\/span>\r\n<span class=\"output\">...<\/span><\/code><\/pre>\n<p>&nbsp;<\/p>\n<h3><a name=\"pip-user\"><\/a>User Installed Python Packages<\/h3>\n<p>To print a list of user-installed packages in your user directory (<code><span class=\"command\">~\/.local<\/span><\/code>), add the \u201c<code><span class=\"command\">--user<\/span><\/code>\u201d option and it will limit the scope of the output. Python will search the user directory before the central install location, so it is important to keep user installed packages up to date or remove them in preference to the globally installed versions.<\/p>\n<pre><code class=\"code-block\"><span class=\"prompt\">scc1$<\/span> <span class=\"command\"> module load python3\/3.7.7<\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">pip list --user<\/span>\r\n<span class=\"output\">Package Version\r\n---------------------------------- ------------\r\nbluepyopt (1.5.5)<\/span>\r\n<span class=\"output\">deap (1.0.2)<\/span>\r\n<span class=\"output\">efel (2.11.14)<\/span>\r\n<span class=\"output\">HTSeq (0.7.2)<\/span>\r\n<span class=\"output\">...<\/span><\/code><\/pre>\n<p>&nbsp;<\/p>\n<h2><a name=\"all\"><\/a>List All Installed Packages\/Module<\/h2>\n<p>Not all packages were installed from the Python Package Index (PyPI) and these packages should be queried differently. The python interpreter\u2019s built in \u201chelp\u201d function can list and provide details for any installed package\/module. This command will attempt to load all installed modules and can sometimes produce errors for modules that have deprecated functions or require prerequisite software before loading. This is method is the most general way to list packages, but can be very slow.<\/p>\n<pre><code class=\"code-block\"><span class=\"prompt\">scc1$<\/span> <span class=\"command\"> module load python3\/3.7.7<\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">python<\/span>\r\n<span class=\"output\">Python 3.7.7 (default, May 21 2020, 14:57:43) \r\n[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.<\/span>\r\n<span class=\"prompt\">&gt;&gt;&gt;<\/span> <span class=\"command\">help('modules')<\/span>\r\n<span class=\"output\"> <\/span>\r\n<span class=\"output\">Please wait a moment while I gather a list of all available modules...<\/span>\r\n<span class=\"output\"> <\/span>\r\n<span class=\"output\"># This command will attempt to load all modules and produces errors<\/span>\r\n<span class=\"output\"># for modules that have deprecated functions or require prerequisite<\/span>\r\n<span class=\"output\"># software before loading. This is normal.<\/span>\r\n<span class=\"output\"> <\/span>\r\n<span class=\"output\">BaseHTTPServer      cellh5              leveldb             runipy <\/span>\r\n<span class=\"output\">Bastion             cellprofiler        lib2to3             runpy <\/span>\r\n<span class=\"output\">Bio                 centrosome          libfuturize         scandir <\/span>\r\n<span class=\"output\">BioSQL              certifi             libpasteurize       sched <\/span>\r\n<span class=\"output\">CDROM               cgi                 libtiff             schema <\/span>\r\n<span class=\"output\">... <\/span>\r\n<span class=\"output\"> <\/span>\r\n<span class=\"output\">Enter any module name to get more help.  Or, type \"modules spam\" to search <\/span>\r\n<span class=\"output\">for modules whose descriptions contain the word \"spam\". <\/span>\r\n<span class=\"output\"> <\/span>\r\n<span class=\"prompt\">In: <\/span><span class=\"command\"> <\/span><\/code><\/pre>\n<p>&nbsp;<\/p>\n<h2><a name=\"individual\"><\/a>Individual Package Version<\/h2>\n<p>Sometimes faster than rooting through the full list of installed packages is simply loading the package and checking the version directly. Most, but not all, packages have an attribute \u201c<code><span class=\"command\">__version__<\/span><\/code>\u201d (note, these are double-underscores on both sides of the word &#8220;version&#8221;) which contains the version number for that package\/module.<\/p>\n<pre><code class=\"code-block\"><span class=\"prompt\">scc1$<\/span> <span class=\"command\">module load python3\/3.7.7<\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">python<\/span>\r\n<span class=\"prompt\"><span class=\"output\">Python 3.7.7 (default, May 21 2020, 14:57:43) \r\n[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.<\/span>\r\n&gt;&gt;&gt;<\/span> <span class=\"command\">import spyder<\/span>\r\n<span class=\"prompt\">&gt;&gt;&gt;<\/span> <span class=\"command\">spyder.__version__<\/span>\r\n<span class=\"output\">'4.1.3'<\/span>\r\n<span class=\"prompt\">&gt;&gt;&gt;<\/span><span class=\"command\"> <\/span><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The python installations\u00a0on the Shared Computing Cluster (SCC)\u00a0include many common python libraries and packages. Most of these are general purpose libraries made available from the Python Package Index (PyPI). Instructions for\u00a0checking package installation and versions are detailed on this page. If you need a package that is not installed in our python modules, please see&#8230;<\/p>\n","protected":false},"author":3593,"featured_media":0,"parent":76567,"menu_order":3,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/105985"}],"collection":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/users\/3593"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/comments?post=105985"}],"version-history":[{"count":15,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/105985\/revisions"}],"predecessor-version":[{"id":130310,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/105985\/revisions\/130310"}],"up":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/76567"}],"wp:attachment":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/media?parent=105985"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}