安装lap安装报错就直接上
conda install -c conda-forge lap
Linux 安装 Pycuda 时可能会遇到这个问题:
第一种问题:
src/cpp/cuda.hpp:14:18: fatal error: cuda.h: No such file or directory
#include <cuda.h>
^
error: command '/usr/bin/gcc' failed with exit code 1
解决方法:
export PATH=/usr/local/cuda-11.7/bin:/usr/local/cuda/bin:$PATH // 即 cuda 的路径这里在root 模式下再包含一遍即可
pip install pycuda -i https://pypi.tuna.tsinghua.edu.cn/simple
第二种问题:
出现Python.h报错的问题
解决方法:
ubuntu:
Python2x:
apt-get intsall -y python-dev
Python3x:
apt-get intsall -y python3-dev
centos:
Python2x:
yum intsall -y python-devel
Python3x:
yum intsall -y python3-devel
第三种问题:
Installing 'pycuda.cuda' as data is deprecated, please list it in `packages`.
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
解决方法:
进pycuda的官网下载 https://pypi.org/project/pycuda/#files
方式一:
// 下载
wget https://files.pythonhosted.org/packages/5a/56/4682a5118a234d15aa1c8768a528aac4858c7b04d2674e18d586d3dfda04/pycuda-2021.1.tar.gz
// 解压
tar xvzf pycuda-2021.1.tar.gz
cd pycuda-2021.1
./configure.py --cuda-root=/home/xx/software/cuda-11.7/install/ --boost-compiler=gcc --cxxflags=-std=c++11
// 编译
python setup.py build
// 安装
python setup.py install
方式二:
// 下载pycuda源码
wget https://files.pythonhosted.org/packages/5a/56/4682a5118a234d15aa1c8768a528aac4858c7b04d2674e18d586d3dfda04/pycuda-2021.1.tar.gz
// 解压
tar -xvzf pycuda-2021.1.tar.gz
cd pycuda-2021.1
vim setup.py
// 在下图位置添加conf[“CXXFLAGS”].append(’-std=c++11’)
// 运行
python3 setup.py install