How to inspect the existence and install a python package in the cloud

417 views
Skip to first unread message

Hansen Chen

unread,
Jun 11, 2014, 12:41:52 PM6/11/14
to sage-s...@googlegroups.com
I would like to do the following.

1) Inspect the python packages that are already in the cloud.sagemath.

2) Install new python packages that are not in cloud.sagemath.

4) I tried in the command terminal the following python command to install a package called gensim.
$ easy_install -U gensim
and
$ pip install --upgrade gensim
It seems I do not have the permission to do this. I then tried 
$ sudo easy_install -U gensim
I then typed in my cloud.sagemath password. It does not acknowledge it. I suppose the super user is the website administration not me.

What should I do to install a new package in the cloud? Is the only option to install it locally on my own machine and add search path to the local package?

Hansen Chen

unread,
Jun 11, 2014, 1:30:30 PM6/11/14
to sage-s...@googlegroups.com
I have found the answers to questions 2) and 3) in cloud.sagemath FAQ regarding downloading from PyPi. Sorry for not checking FAQ more thoroughly before posting. I am new to SAGE. Question 1) still remains as to how to check whether a certain package is already in cloud.sagemath.

Thank you.

Hansen

leif

unread,
Jun 11, 2014, 2:32:13 PM6/11/14
to sage-s...@googlegroups.com
Hansen Chen wrote:
> I have found the answers to questions 2) and 3) in cloud.sagemath FAQ
> <https://github.com/sagemath/cloud/wiki/FAQ#own-ipython> regarding
> downloading from PyPi. Sorry for not checking FAQ more thoroughly before
> posting. I am new to SAGE. Question 1) still remains as to how to check
> whether a certain package is already in cloud.sagemath.

sage: is_package_installed("foo")
False

Note that (e.g.) optional_packages() (from the Sage prompt) is currently
broken, but you can use 'sage --optional' in the shell.

But probably you're not that interested in /Sage/ packages, but "plain"
Python packages.

In that case, you could use pkg_resources, e.g.

import pkg_resources

pkg_resources.get_distribution("foo") # may raise DistributionNotFound

pkg_resources.get_distribution("foo").version

or simply try to 'import foo'... ;-)


-leif


> On Wednesday, June 11, 2014 12:41:52 PM UTC-4, Hansen Chen wrote:
>
> I would like to do the following.
>
> 1) Inspect the python packages that are already in the cloud.sagemath.
>
> 2) Install new python packages that are not in cloud.sagemath.
>
> 4) I tried in the command terminal the following python command to
> install a package called gensim.
> $ easy_install -U gensim
> and
> $ pip install --upgrade gensim
> such as what is shown in http://radimrehurek.com/gensim/install.html
> <http://radimrehurek.com/gensim/install.html>.
> It seems I do not have the permission to do this. I then tried
> $ sudo easy_install -U gensim
> I then typed in my cloud.sagemath password. It does not acknowledge
> it. I suppose the super user is the website administration not me.
>
> What should I do to install a new package in the cloud? Is the only
> option to install it locally on my own machine and add search path
> to the local package?

--
() The ASCII Ribbon Campaign
/\ Help Cure HTML E-Mail

William Stein

unread,
Jun 11, 2014, 3:19:23 PM6/11/14
to sage-support, sage-cloud
On Wed, Jun 11, 2014 at 11:29 AM, leif <not.r...@online.de> wrote:
> Hansen Chen wrote:
>>
>> I have found the answers to questions 2) and 3) in cloud.sagemath FAQ
>> <https://github.com/sagemath/cloud/wiki/FAQ#own-ipython> regarding
>>
>> downloading from PyPi. Sorry for not checking FAQ more thoroughly before
>> posting. I am new to SAGE. Question 1) still remains as to how to check
>> whether a certain package is already in cloud.sagemath.
>
>
> sage: is_package_installed("foo")
> False

In addition, many interesting packages come from pypi [1], rather than
Sage's own package system, since pypi has about 45000 packages, and
sage has about 30.

I googled for "pypi list installed packages" and found [2], which
says to use "pip freeze", so I typed "sage -sh" in a terminal,
followed by "pip freeze" and got the list [3] below. You could also
type "!pip freeze" in a worksheet or ipython notebook.

As always, if you want anything else to be standard, let me know!

[1] https://pypi.python.org/pypi

[2] http://stackoverflow.com/questions/6600878/find-all-packages-installed-with-easy-install-pip

[3] The list:
Babel==1.3
CryptoPlus==1.0
Cython==0.20.1
Fabric==1.8.3
Flask==0.10.1
Flask-AutoIndex==0.5
Flask-Babel==0.9
Flask-OldSessions==0.10
Flask-OpenID==1.2.1
Flask-Silk==0.2
Jinja2==2.5.5
MySQL-python==1.2.5
NEURON==7.4
NZMATH==1.1.0
Pillow==2.2.2
PyX==0.10
PyYAML==3.10
Pygments==1.3.1
QuantLib-Python==1.4
SQLAlchemy==0.5.8
Shapely==1.3.1
Sphinx==1.1.2
Theano==0.6.0
Twisted==13.2.0
Werkzeug==0.9.4
backports.ssl-match-hostname==3.4.0.2
basemap==1.0.8
biopython==1.61
bitarray==0.8.1
brian==1.4.1
clawpack==5.1.0
cvxopt==1.1.6
cypari==1.1
docutils==0.7
dot2tex==2.9.0dev
gdmodule==0.56
ggplot==0.2.8
git-remote-helpers==0.1.0
gnuplot-py==1.8
greenlet==0.4.2
guppy==0.1.8
h5py==2.3.0
httplib2==0.9
ipython==1.2.1
itsdangerous==0.23
lxml==3.3.5
mahotas==1.1.0
matplotlib==1.3.1
mercurial==2.9.1
mmh3==2.3
mpld3==0.2
mpmath==0.18
munkres==1.0.6
netCDF4==1.0.9
networkx==1.8.1
nose==1.3.1
numexpr==2.4
numpy==1.7.0
oct2py==1.3.0
pGroupCohomology==2.1.4
pandas==0.13.1
paramiko==1.13.0
patsy==0.2.1
pexpect==2.0
pkgconfig==1.1.0
plink==1.6
plotly==0.5.13
psutil==2.1.0
psycopg2==2.5.2
pybtex==0.16
pycrypto==2.6.1
pyface==4.4.0
pymongo==2.7
pyparsing==1.5.6
pypng==0.0.16
pyproj==1.9.3
python-dateutil==2.2
python-openid==2.2.5
pytz==2013b
pyzmq==2.1.11
redis==2.9.1
requests==2.2.1
rpy2==2.3.10
sage==6.2.rc0
sagenb==0.10.8.2
sagetex==2.3.4
scikit-learn==0.14.1
scikits-image==0.7.1
scimath==4.1.2
scipy==0.12.0
simpy==3.0.4
six==1.4.1
snappy==2.1.1
speaklater==1.3
spherogram==1.3
statsmodels==0.5.0
sympy==0.7.4
tables==3.1.1
tornado==3.2
traits==4.4.0
traitsui==4.4.0
webassets==0.9
wsgiref==0.1.2
xlrd==0.9.3
xlwt==0.7.5
zope.interface==4.0.5
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support...@googlegroups.com.
> To post to this group, send email to sage-s...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.



--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org
Reply all
Reply to author
Forward
0 new messages