How to install nvidia apex on Google Colab

时光总嘲笑我的痴心妄想 提交于 2020-06-27 09:03:27

问题


what I did is follow the instruction on the official github site

!git clone https://github.com/NVIDIA/apex
!cd apex
!pip install -v --no-cache-dir ./

it gives me the error:

ERROR: Directory './' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.
Exception information:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/base_command.py", line 178, in main
    status = self.run(options, args)
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/commands/install.py", line 326, in run
    self.name, wheel_cache
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/base_command.py", line 268, in populate_requirement_set
    wheel_cache=wheel_cache
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/req/constructors.py", line 248, in install_req_from_line
    "nor 'pyproject.toml' found." % name
pip._internal.exceptions.InstallationError: Directory './' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.

回答1:


(wanted to just add a comment but I don't have enough reputation...)

it works for me but the cd is actually not required. Also, I needed the two global options as suggested here: https://github.com/NVIDIA/apex/issues/86

%%writefile setup.sh

git clone https://github.com/NVIDIA/apex
pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./apex

then

!sh setup.sh



回答2:


Worked for me after adding CUDA_HOME enviroment variable:

%%writefile setup.sh

export CUDA_HOME=/usr/local/cuda-10.1
git clone https://github.com/NVIDIA/apex
pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./apex
!sh setup.sh



回答3:


First, create a file e.g. setup.sh as follows:

%%writefile setup.sh

git clone https://github.com/NVIDIA/apex
cd apex
pip install -v --no-cache-dir ./

Then, install it

!sh setup.sh


来源:https://stackoverflow.com/questions/57284345/how-to-install-nvidia-apex-on-google-colab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!