最近使用ubuntu安装pycuda时报错
subset/bpl_subset/libs/python/src/converter/arg_to_python_base.o
<command-line>: fatal error: /usr/local/cuda/include/stdc-predef.h: 权限不够
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pycuda
Failed to build pycuda
ERROR: Could not build wheels for pycuda, which is required to install pyproject.toml-based projects
一直在找最后一条的错误信息,忽略了前面那句权限不够。
cd到/usr/local/cuda目录下
使用ls命令
查看权限发现include颜色和其他的不同,是蓝绿色的,没有权限
使用sudo chmod 777 include赋权限
cd /usr/local/cuda-11.7/
ls
sudo chmod 777 include
继续pip install pycuda ,运行成功
pip install pycuda
Defaulting to user installation because normal site-packages is not writeable
Collecting pycuda
Using cached pycuda-2023.1.tar.gz (1.7 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting pytools>=2011.2 (from pycuda)
Using cached pytools-2023.1.1-py2.py3-none-any.whl.metadata (2.7 kB)
Collecting appdirs>=1.4.0 (from pycuda)
Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Collecting mako (from pycuda)
Using cached Mako-1.3.0-py3-none-any.whl.metadata (2.9 kB)
Collecting platformdirs>=2.2.0 (from pytools>=2011.2->pycuda)
Using cached platformdirs-4.0.0-py3-none-any.whl.metadata (11 kB)
Requirement already satisfied: typing-extensions>=4.0 in ./.local/lib/python3.10/site-packages (from pytools>=2011.2->pycuda) (4.8.0)
Requirement already satisfied: MarkupSafe>=0.9.2 in ./.local/lib/python3.10/site-packages (from mako->pycuda) (2.1.3)
Using cached pytools-2023.1.1-py2.py3-none-any.whl (70 kB)
Using cached Mako-1.3.0-py3-none-any.whl (78 kB)
Using cached platformdirs-4.0.0-py3-none-any.whl (17 kB)
Building wheels for collected packages: pycuda
Building wheel for pycuda (pyproject.toml) ... done
Created wheel for pycuda: filename=pycuda-2023.1-cp310-cp310-linux_x86_64.whl size=661263 sha256=8d250013fb662277fe30d7e3a88dfeb9838420974e524b1ad1f504cbad360935
Stored in directory: /home/lww/.cache/pip/wheels/46/65/06/b997165edd2fd9690c3497ca54ea4485b571d7bd959c21c6c4
Successfully built pycuda
Installing collected packages: appdirs, platformdirs, mako, pytools, pycuda
Successfully installed appdirs-1.4.4 mako-1.3.0 platformdirs-4.0.0 pycuda-2023.1 pytools-2023.1.1