Enthought Python、Sage 或其他(在 Unix 集群中)

发布于 2024-08-31 04:12:56 字数 601 浏览 2 评论 0原文

我可以访问 Unix 机器集群,但它们没有我需要的软件(numpyscipy, matplotlib > 等),所以我必须自己安装它们(我也没有 root 权限,所以像 apt-get 或 yast 这样的命令不起作用)。

在最坏的情况下,我将不得不从源代码编译它们。有没有更好的方法继续进行?我听说过一些关于 Enthought Python Sage,但我不确定最好的方法是什么。

有什么建议吗?

I have access to a cluster of Unix machines, but they don't have the software I need (numpy, scipy, matplotlib, etc), so I have to install them by myself (I don't have root permissions, either, so commands like apt-get or yast don't work).

In the worst case, I will have to compile them all from source. Is there any better way to proceed? I've heard something about Enthought Python and Sage, but am not sure what is the best way to go.

Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

滥情稳全场 2024-09-07 04:12:56

EPD(Enthought Python Distribution)很棒,但即使对于学者来说,也只能免费获得 32 位版本。如果您打算做任何内存密集型的事情,那么这并不是一个真正的选择。

编辑:此后情况已发生变化,64 位版本可免费用于学术/教育用途。

另一方面,英特尔 MLK 库确实有所作为,它构建了许多漂亮的东西(例如最新版本的 mayavi),否则从源代码构建这些东西可能会很痛苦。另外,正如其他人所说,您可以将其解压到您的主文件夹中并运行它。您不应该需要 root 访问权限。

如果您不需要使用超过 2GB 的内存,那么 EPD 绝对是一个不错的选择,但您必须付费才能获得 64 位版本。

如果您使用的是 Windows,则 Python(x,y) 非常有用,但除此之外,祝您好运找到 Linux 预构建的二进制文件。它们或多或少已经不存在了... ubuntu 存储库似乎永久关闭了,而且我不知道在哪里可以获得它的预编译 tarball。不过,这可能会在不久的将来发生改变......希望它会改变,因为这对您来说是一个不错的选择!

老实说,如果你只需要 numpy、scipy 和 matplotlib,从源代码构建它们相对容易(特别是如果你不需要 scipy 也能摆脱困境),并且你总是可以构建自己的 python 解释器,然后使用 easy_install 来避免必须从源代码构建它们。当然,这是假设您正在使用的计算机上已经安装了基本的构建环境(gcc等)...这就是我在您的情况下所做的,无论如何...

如果您这样做当然,最好下载 python 源代码并构建您自己的 python 解释器,您将使用它来完成所有操作。然后安装 setuptools 和 easy_install 其余的。 (或者,您可以下载 numpy 等的源代码,然后为您刚刚构建的 python 解释器构建并安装它们。)

这显示了如何构建基础知识(python、numpy、scipy、matplotlib、ipython)的基本思想当前工作目录中名为“pythondist”的目录。

#! /bin/sh

builddir=$(pwd)/pythondist
mkdir -p $builddir/source
cd $builddir/source

wget 'http://python.org/ftp/python/2.6.5/Python-2.6.5.tgz'
wget 'http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e'
tar -xvzf Python-2.6.5.tgz

# Build python
cd $builddir/source/Python-2.6.5/

# The --prefix argument is the key!
./configure --prefix=$builddir

# Be sure to speed things up with the -j option if you're 
# on a multicore machine (e.g. make -j 4 build for a quadcore)
make build 
make install

# Now install setuptools
cd $builddir/source
tar -xvzf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11/

# The next key is to call this with the python you just built!
$builddir/bin/python setup.py build
$builddir/bin/python setup.py install

# Now just install numpy, scipy, ipython, matplotlib, etc through easy_install
$builddir/bin/easy_install numpy
$builddir/bin/easy_install scipy
$builddir/bin/easy_install matplotlib
$builddir/bin/easy_install ipython

编辑:脚本中的小错别字。如果 numpy 或 scipy 无法从 Egg​​ 中正确安装,请参阅安装说明。

这个脚本主要是为了演示在你的主目录中构建一个独立的python,并假设你正在构建的系统已经安装了正确的依赖项,但它至少为你指明了正确的方向。

如果 numpy 或 scipy 无法使用 easy_install 正确构建,请下载源 tarball 并尝试使用不同的参数从那里构建它们。 (根据我的经验,Numpy/Scipy 的 setup.py 自动检测错误的 fortran 编译器是常见问题)例如

cd $builddir/source
wget http://sourceforge.net/projects/numpy/files/NumPy/1.4.1/numpy-1.4.1.tar.gz/download
tar -xvzf numpy-1.4.1.tar.gz
cd numpy-1.4.1/
# If you don't specify an action (e.g. "build") this will enter an interactive
# mode to help diagnose problems... See the INSTALL.txt file, too!
$builddir/bin/python setup.py 

,在我的 OpenSUSE 11.2 系统上,我需要在构建 numpy 和 scipy 时指定“--fcompiler=gnu95”,就像我一样g77 和 gfortran 都已安装。否则事情将无法正确构建。

然而,在较旧的 RHEL 3 系统上,它可以通过 easy_install 完美地按原样构建。 YMMV,当然。祝你好运!

EPD (Enthought Python Distribution) is great, but even for academics, you can only get the 32-bit version free of charge. If you intend to do anything ram-intensive, it's not really an option.

Edit: This has since changed, and the 64-bit version is freely available for academic/educational use.

On the other hand, the Intel MLK library does make a difference, and it has lots of nifty (e.g. the latest version of mayavi) things built that can otherwise be a real pain to build from source. Also, as others have said, you can just untar it into your home folder and run it. You shouldn't need root access.

EPD is an absolutely great option if you don't ever need to use more than 2GB of ram, but you will have to pay to get 64-bit builds.

Python(x,y) is great if you're on windows, but otherwise, good luck finding the linux pre-built binaries. They more-or-less no longer exist... The ubuntu repository seems to be permanently down, and I don't know of anywhere to get a pre-compiled tarball for it anymore. This may all change in the near future, though... Hopefully it does, because it would be a great option for you!

Honestly, if you just need numpy, scipy, and matplotlib, they're relatively easy to build from source (especially so if you can get away without scipy), and you can always just build your own python interpreter and then use easy_install to avoid having to build them from source. This, of course, assumes that a basic build environment (gcc, etc) are already installed on the machine you're using... That's what I've done when I was in your situation, anyway...

If you go that route, it's best to download the python source code and build your own python interpreter that you'll use for everything. Then install setuptools and easy_install the rest. (Alternately, you can download the source code for numpy, etc and build and install them in for the python interpreter you just built.)

This shows a basic idea how to build the basics (python, numpy, scipy, matplotlib, ipython) under a directory called "pythondist" in the current working directory.

#! /bin/sh

builddir=$(pwd)/pythondist
mkdir -p $builddir/source
cd $builddir/source

wget 'http://python.org/ftp/python/2.6.5/Python-2.6.5.tgz'
wget 'http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e'
tar -xvzf Python-2.6.5.tgz

# Build python
cd $builddir/source/Python-2.6.5/

# The --prefix argument is the key!
./configure --prefix=$builddir

# Be sure to speed things up with the -j option if you're 
# on a multicore machine (e.g. make -j 4 build for a quadcore)
make build 
make install

# Now install setuptools
cd $builddir/source
tar -xvzf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11/

# The next key is to call this with the python you just built!
$builddir/bin/python setup.py build
$builddir/bin/python setup.py install

# Now just install numpy, scipy, ipython, matplotlib, etc through easy_install
$builddir/bin/easy_install numpy
$builddir/bin/easy_install scipy
$builddir/bin/easy_install matplotlib
$builddir/bin/easy_install ipython

EDIT: Minor typos in script. If numpy or scipy doesn't install properly from the egg, see the install notes.

This script is mainly intended to demonstrate building an independent python in your home directory, and assumes the system you're building on has the proper dependencies already installed, but it at least points you in the right direction.

If numpy or scipy don't build properly using easy_install, download the source tarballs and try building building them from there using different arguments. (Numpy/Scipy's setup.py autodetecting the wrong fortran compiler is common problem, in my experience) E.g.

cd $builddir/source
wget http://sourceforge.net/projects/numpy/files/NumPy/1.4.1/numpy-1.4.1.tar.gz/download
tar -xvzf numpy-1.4.1.tar.gz
cd numpy-1.4.1/
# If you don't specify an action (e.g. "build") this will enter an interactive
# mode to help diagnose problems... See the INSTALL.txt file, too!
$builddir/bin/python setup.py 

For example, on my OpenSUSE 11.2 system, I need to specify "--fcompiler=gnu95" when building numpy and scipy, as I have both g77 and gfortran installed. Otherwise things won't build correctly.

However, on an older RHEL 3 system, it builds perfectly as-is from easy_install. YMMV, of course. Good luck!

┼── 2024-09-07 04:12:56

如果您是学者,可以使用 Enthought 发行版 免费。它带有自己的安装程序并为您处理安装。这肯定比您自己从头开始安装 matplotlib 等更容易。安装计算机上不需要管理员访问权限,因为发行版提供了自己的 Python 二进制文件。我用过,发现简单又方便。

If you are an academic, you can use the Enthought distribution free of charge. It comes with its own installer and handles installation for you. This will definitely be easier than installing matplotlib etc. from scratch on your own. There is no requirement for admin access on the installation machine because the distribution provides its own Python binaries. I've used it and found it simple and convenient.

无悔心 2024-09-07 04:12:56

我个人会根据价格选择 Sage。您需要解决的主要问题是确保您使用 python 安装来访问您的库,无论您使用的是什么 python 套件。

I'd personally go for Sage on the basis of price. The main issue you will need to contend with is making sure you use your python install to access your libraries, regardless of the python suite you're using.

鹤舞 2024-09-07 04:12:56

python(x,y) 是一个免费的 Python 发行版,类似于 EPD(Enthought Python Distribution)。虽然两者都包含基本标准库,但存在一些差异,因此您应该找出哪一个更适合您的需求。 EPD 的一个有趣的方面是它最近改编了Intel MKL 库,因此可能有与 pythonxy 和标准 numpy 安装程序相比具有性能优势。

我不知道这些发行版如何在没有 root 访问权限的 Unix 机器上工作,您可能需要尝试一下。

另一方面,Sage 并不专注于成为一个发行版(请参阅维基百科页面),所以你无法真正比​​较它。

python(x,y) is a free Python distribution similar to EPD (Enthought Python Distribution). While both include the basic standard libraries there are some differences, so you should find out which one is a better fit for your needs. One interesting aspect of EPD is that it recently adapted the Intel MKL library, so there might be performance advantages over both pythonxy and the standard numpy installer.

I don't know how these distributions work on a Unix box without root access, this is something you might just have to try out.

Sage on the other hand isn't focused on being a distribution (see the Wikipedia page), so you can't really compare it.

孤者何惧 2024-09-07 04:12:56

SageMath 完全免费(兼容 GPL),该项目的三个主要目标中的第一个是成为一个自我包含开源数学软件的分发,尽管其体积很大,但很容易从源代码(或二进制文件)安装。您应该能够在不需要 root 访问权限的情况下设置 Sage 或 Sage 中的任何其他内容(例如网络笔记本)。

SageMath is completely free (GPL compatible), and the first of the three main goals of the project is to be a self-contained distribution of open source math software, which is easy to install from source (or from a binary), despite its large size. You should be able to setup Sage or anything else in Sage (e.g., the web notebook) without needing root access.

笑红尘 2024-09-07 04:12:56

我每天都使用 Sage。我是它的忠实粉丝,但如果您没有准备好进行大量更新、调整和配置,我不会推荐它。黄金时段还没有准备好。

如果您愿意付出努力让它运行并保持运行,网络笔记本界面会令人惊叹。我无法想象你能够在没有 root 访问权限的情况下运行它。

I use Sage on a daily basis. I'm a big fan, but I wouldn't recommend it if you're not prepared for lots of updating, tweaking, and configuring. It's not ready for prime time yet.

If you're willing to put in the effort to get it running and keep it running, the web notebook interface is amazing. I can't imagine that you would be able to get it running without root access though.

荒人说梦 2024-09-07 04:12:56

您可以使用 virtualenv 创建没有任何访问权限的虚拟隔离环境,然后调用 easy_install 进行安装(并在必要时编译)自动在当前目录中生成您需要的所有库,无需管理员权限。

使用 virtualenv 安装 matplotlib

唯一的条件是能够运行虚拟环境,因为你无法安装任何东西。您必须将其作为存档下载并手动调用 virtualenv.py。

You can use virtualenv to create your virtual isolated env wihtout any access and then call easy_install to install (and compiling if necessary) automatically all the libs you need in your current directory without admin rights.

Installing matplotlib with virtualenv

The only condition is to be able to run virtual env, given that you can't install anything. You will have to donwload it as a archive and call virtualenv.py manually.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文