如何在没有root / admin特权的情况下安装PyCUDA

时间:2019-04-15 22:31:10

标签: python cuda installation pycuda

美好的一天,

我正在SSH连接到的服务器上运行CUDA。我也想为某些特定的应用程序运行pycuda,但是似乎每个安装过程都需要某种形式的超级用户特权,而我没有这种特权。

我已经尝试使用pip install pycuda进行安装,并且得到以下输出,该结果显示安装程序试图访问/ usr / lib目录,该目录由root拥有,并且只能为其他用户读取和执行。为什么会失败:

[twagenhals@login-1 pycuda_test]$ pip install pycuda
Collecting pycuda
  Using cached https://files.pythonhosted.org/packages/58/33/cced4891eddd1a3ac561ff99081019fddc7838a07cace272c941e3c2f915/pycuda-2018.1.1.tar.gz
Collecting pytools>=2011.2 (from pycuda)
  Using cached https://files.pythonhosted.org/packages/ac/a3/f54f7190315ad41b7334d8733350e7fcefded8f25e0b45e2329b80279921/pytools-2019.1.tar.gz
Collecting pytest>=2 (from pycuda)
  Downloading https://files.pythonhosted.org/packages/5d/c3/54f607bc9817fd284073ac68e99123f86616f431f9d29a855474b7cf00eb/pytest-4.4.1-py2.py3-none-any.whl (223kB)
    100% |################################| 225kB 2.2MB/s
Requirement already satisfied: decorator>=3.2.0 in /usr/lib/python2.7/site-packages (from pycuda)
Collecting appdirs>=1.4.0 (from pycuda)
  Using cached https://files.pythonhosted.org/packages/56/eb/810e700ed1349edde4cbdc1b2a21e28cdf115f9faf263f6bbf8447c1abf3/appdirs-1.4.3-py2.py3-none-any.whl
Requirement already satisfied: mako in /usr/lib/python2.7/site-packages (from pycuda)
Requirement already satisfied: six>=1.8.0 in /usr/lib/python2.7/site-packages (from pytools>=2011.2->pycuda)
Requirement already satisfied: numpy>=1.6.0 in /usr/lib64/python2.7/site-packages (from pytools>=2011.2->pycuda)
Collecting funcsigs>=1.0; python_version < "3.0" (from pytest>=2->pycuda)
  Using cached https://files.pythonhosted.org/packages/69/cb/f5be453359271714c01b9bd06126eaf2e368f1fddfff30818754b5ac2328/funcsigs-1.0.2-py2.py3-none-any.whl
Collecting pathlib2>=2.2.0; python_version < "3.6" (from pytest>=2->pycuda)
  Using cached https://files.pythonhosted.org/packages/2a/46/c696dcf1c7aad917b39b875acdc5451975e3a9b4890dca8329983201c97a/pathlib2-2.3.3-py2.py3-none-any.whl
Collecting attrs>=17.4.0 (from pytest>=2->pycuda)
  Using cached https://files.pythonhosted.org/packages/23/96/d828354fa2dbdf216eaa7b7de0db692f12c234f7ef888cc14980ef40d1d2/attrs-19.1.0-py2.py3-none-any.whl
Collecting pluggy>=0.9 (from pytest>=2->pycuda)
  Using cached https://files.pythonhosted.org/packages/84/e8/4ddac125b5a0e84ea6ffc93cfccf1e7ee1924e88f53c64e98227f0af2a5f/pluggy-0.9.0-py2.py3-none-any.whl
Collecting atomicwrites>=1.0 (from pytest>=2->pycuda)
  Using cached https://files.pythonhosted.org/packages/52/90/6155aa926f43f2b2a22b01be7241be3bfd1ceaf7d0b3267213e8127d41f4/atomicwrites-1.3.0-py2.py3-none-any.whl
Collecting py>=1.5.0 (from pytest>=2->pycuda)
  Using cached https://files.pythonhosted.org/packages/76/bc/394ad449851729244a97857ee14d7cba61ddb268dce3db538ba2f2ba1f0f/py-1.8.0-py2.py3-none-any.whl
Collecting more-itertools<6.0.0,>=4.0.0; python_version <= "2.7" (from pytest>=2->pycuda)
  Using cached https://files.pythonhosted.org/packages/2f/9d/dcfe59e213093695f108508af1214cf9cd95cc5489e46877ec5cb56369e5/more_itertools-5.0.0-py2-none-any.whl
Requirement already satisfied: setuptools in /usr/lib/python2.7/site-packages (from pytest>=2->pycuda)
Requirement already satisfied: MarkupSafe>=0.9.2 in /usr/lib64/python2.7/site-packages (from mako->pycuda)
Collecting scandir; python_version < "3.5" (from pathlib2>=2.2.0; python_version < "3.6"->pytest>=2->pycuda)
  Using cached https://files.pythonhosted.org/packages/df/f5/9c052db7bd54d0cbf1bc0bb6554362bba1012d03e5888950a4f5c5dadc4e/scandir-1.10.0.tar.gz
Installing collected packages: appdirs, pytools, funcsigs, scandir, pathlib2, attrs, pluggy, atomicwrites, py, more-itertools, pytest, pycuda
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 365, in run
    strip_file_prefix=options.strip_file_prefix,
  File "/usr/lib/python2.7/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 854, in install
    strip_file_prefix=strip_file_prefix
  File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 1069, in move_wheel_files
    strip_file_prefix=strip_file_prefix,
  File "/usr/lib/python2.7/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/lib/python2.7/site-packages/pip/wheel.py", line 323, in clobber
    shutil.copyfile(srcfile, destfile)
  File "/usr/lib64/python2.7/shutil.py", line 83, in copyfile
    with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/usr/lib/python2.7/site-packages/appdirs.pyc'
You are using pip version 9.0.1, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

我也尝试按照其维基here上的安装说明进行操作。我尝试遵循他们的命令,但当他们执行su -c "make install"时,我尝试只做make install,但是在使用root拥有的我没有读取特权的目录时也会发生类似的问题:

[twagenhals@login-1 pycuda-2018.1.1]$ make install
ctags -R src || true
/bin/sh: ctags: command not found
/usr/bin/python setup.py install
running install
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: '/usr/lib64/python2.7/site-packages/test-easy-install-23306.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /usr/lib64/python2.7/site-packages/

Perhaps your account does not have write access to this directory?  If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.  If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

  https://setuptools.readthedocs.io/en/latest/easy_install.html

Please make the appropriate changes for your system and try again.

make: *** [Makefile:12: install] Error 1

我还可以尝试其他方法吗?预先感谢。

0 个答案:

没有答案