MooreThreads / torch_musa

torch_musa is an open source repository based on PyTorch, which can make full use of the super computing power of MooreThreads graphics cards.
Other
298 stars 17 forks source link

如何实现在pycharm运行?(ImportError: Please try running Python from a different directory!) #36

Open 1012lq opened 6 months ago

1012lq commented 6 months ago

1 D7274068DDB94FBFE776A3FDB7F93F4E 前边看到有朋友有同样的报错,但最后没看到答案,如图,同样的conda环境,在命令行里(已经进入docker')能够成功运行,但pycharm里不能运行。

uniartisan commented 6 months ago

I also use conda to install musa_torch, however this problem occurred when I installed the pip package. I used the conda virtual environment and the python version was 3.10.x. Have you faced similar problem?

pip install torch-2.0.0-cp310-cp310-linux_x86_64-S80_S3000.whl 
ERROR: torch-2.0.0-cp310-cp310-linux_x86_64-S80_S3000.whl is not a valid wheel filename.
1012lq commented 6 months ago

I also use conda to install musa_torch, however this problem occurred when I installed the pip package. I used the conda virtual environment and the python version was 3.10.x. Have you faced similar problem?

pip install torch-2.0.0-cp310-cp310-linux_x86_64-S80_S3000.whl 
ERROR: torch-2.0.0-cp310-cp310-linux_x86_64-S80_S3000.whl is not a valid wheel filename.

you need to rename your whl name as torch-2.0.0-cp310-cp310-linux_x86.whl

uniartisan commented 6 months ago

I also use conda to install musa_torch, however this problem occurred when I installed the pip package. I used the conda virtual environment and the python version was 3.10.x. Have you faced similar problem?

pip install torch-2.0.0-cp310-cp310-linux_x86_64-S80_S3000.whl 
ERROR: torch-2.0.0-cp310-cp310-linux_x86_64-S80_S3000.whl is not a valid wheel filename.

you need to rename your whl name as torch-2.0.0-cp310-cp310-linux_x86.whl

Thank you! I changed their name and installed them successfully. However, there is something wrong when I try to torch.musa.is_available(). I have installed many drivers, such as mccl, mudnn and so on. Could you please tell me how can you acheive that?

hanhaowen-mt commented 6 months ago

~/.bashrc里面有如下内容:

. /opt/conda/etc/profile.d/conda.sh
conda activate py38
export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
export LIBRARY_PATH="/opt/intel/oneapi/mkl/lib/intel64:${LIBRARY_PATH}"
export LD_LIBRARY_PATH="/usr/local/musa/lib:${LD_LIBRARY_PATH}"

按道理每次新建terminal的时候都会执行里面的内容,然后LD_LIBRARY_PATH就被更新了,于是能找到mudnn,但是vscode和pycharm这种ide内嵌的terminal似乎执行的初始化脚本和普通的ssh客户端不一样,于是没有执行~/.bashrc里面的内容,导致LD_LIBRARY_PATH没有被更新