Simpletransformers: Apex issues

Created on 15 Feb 2020  路  5Comments  路  Source: ThilinaRajapakse/simpletransformers

Hi, I used your package last year using colab with commands below and it worked just fine.

However, when I ran these commands again today, some errors emerged.

I wonder whether it's the CUDA version that causing these errors.

Also, if my environment is windows, what other possible commands should I try to install apex.
( I tried pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" . & pip install -v --no-cache-dir but can't help.)

------------------------ Commands ------------------------------------------------------------------------

!pip3 install torch torchvision
!git clone https://gist.github.com/f7b7c7758a46da49f84bc68b47997d69.git

cd f7b7c7758a46da49f84bc68b47997d69/

!wget https://developer.nvidia.com/compute/cuda/9.2/Prod2/local_installers/cuda-repo-ubuntu1604-9-2-local_9.2.148-1_amd64
!dpkg --install cuda-repo-ubuntu1604-9-2-local_9.2.148-1_amd64
!apt-key add /var/cuda-repo-9-2-local/7fa2af80.pub
!apt-get update
!apt-get install cuda
!cat /usr/local/cuda/version.txt
!pip install http://download.pytorch.org/whl/cu92/torch-0.4.1-cp36-cp36m-linux_x86_64.whl
!pip install torchvision
!pip install pytorch-pretrained-bert

---------------------------- Errors --------------------------------------------------------------------------

Cloning into 'apex'...
remote: Enumerating objects: 101, done.
remote: Counting objects: 100% (101/101), done.
remote: Compressing objects: 100% (69/69), done.
remote: Total 5780 (delta 63), reused 49 (delta 32), pack-reused 5679
Receiving objects: 100% (5780/5780), 13.58 MiB | 8.20 MiB/s, done.
Resolving deltas: 100% (3735/3735), done.
/usr/local/lib/python3.6/dist-packages/pip/_internal/commands/install.py:283: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.
cmdoptions.check_install_build_global(options)
Created temporary directory: /tmp/pip-ephem-wheel-cache-fbzzql6p
Created temporary directory: /tmp/pip-req-tracker-h7ezqz0t
Created requirements tracker '/tmp/pip-req-tracker-h7ezqz0t'
Created temporary directory: /tmp/pip-install-ffbmef7r
Processing /content/f7b7c7758a46da49f84bc68b47997d69/apex
Created temporary directory: /tmp/pip-req-build-80yea4k8
Added file:///content/f7b7c7758a46da49f84bc68b47997d69/apex to build tracker '/tmp/pip-req-tracker-h7ezqz0t'
Running setup.py (path:/tmp/pip-req-build-80yea4k8/setup.py) egg_info for package from file:///content/f7b7c7758a46da49f84bc68b47997d69/apex
Running command python setup.py egg_info
torch.__version__ = 1.4.0
running egg_info
creating /tmp/pip-req-build-80yea4k8/pip-egg-info/apex.egg-info
writing /tmp/pip-req-build-80yea4k8/pip-egg-info/apex.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-req-build-80yea4k8/pip-egg-info/apex.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-req-build-80yea4k8/pip-egg-info/apex.egg-info/top_level.txt
writing manifest file '/tmp/pip-req-build-80yea4k8/pip-egg-info/apex.egg-info/SOURCES.txt'
writing manifest file '/tmp/pip-req-build-80yea4k8/pip-egg-info/apex.egg-info/SOURCES.txt'
/tmp/pip-req-build-80yea4k8/setup.py:46: UserWarning: Option --pyprof not specified. Not installing PyProf dependencies!
warnings.warn("Option --pyprof not specified. Not installing PyProf dependencies!")
Source in /tmp/pip-req-build-80yea4k8 has version 0.1, which satisfies requirement apex==0.1 from file:///content/f7b7c7758a46da49f84bc68b47997d69/apex
Removed apex==0.1 from file:///content/f7b7c7758a46da49f84bc68b47997d69/apex from build tracker '/tmp/pip-req-tracker-h7ezqz0t'
Skipping wheel build for apex, due to binaries being disabled for it.
Installing collected packages: apex
Created temporary directory: /tmp/pip-record-ao89_tgj
Running command /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-80yea4k8/setup.py'"'"'; _file__='"'"'/tmp/pip-req-build-80yea4k8/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file_);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, _file_, '"'"'exec'"'"'))' --cpp_ext --cuda_ext install --record /tmp/pip-record-ao89_tgj/install-record.txt --single-version-externally-managed --compile
torch.__version__ = 1.4.0
/tmp/pip-req-build-80yea4k8/setup.py:46: UserWarning: Option --pyprof not specified. Not installing PyProf dependencies!
warnings.warn("Option --pyprof not specified. Not installing PyProf dependencies!")

Compiling cuda extensions with
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:24:38_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89
from /usr/local/cuda/bin

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-req-build-80yea4k8/setup.py", line 103, in <module>
    check_cuda_torch_binary_vs_bare_metal(torch.utils.cpp_extension.CUDA_HOME)
  File "/tmp/pip-req-build-80yea4k8/setup.py", line 80, in check_cuda_torch_binary_vs_bare_metal
    "https://github.com/NVIDIA/apex/pull/323#discussion_r287021798.  "
RuntimeError: Cuda extensions are being compiled with a version of Cuda that does not match the version used to compile Pytorch binaries.  Pytorch binaries were compiled with Cuda 10.1.
In some cases, a minor-version mismatch will not cause later errors:  https://github.com/NVIDIA/apex/pull/323#discussion_r287021798.  You can try commenting out this check (at your own risk).
Running setup.py install for apex ... error

Cleaning up...
Removing source in /tmp/pip-req-build-80yea4k8
Removed build tracker '/tmp/pip-req-tracker-h7ezqz0t'
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-80yea4k8/setup.py'"'"'; _file__='"'"'/tmp/pip-req-build-80yea4k8/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file_);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, _file_, '"'"'exec'"'"'))' --cpp_ext --cuda_ext install --record /tmp/pip-record-ao89_tgj/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
Exception information:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/base_command.py", line 153, in _main
status = self.run(options, args)
File "/usr/local/lib/python3.6/dist-packages/pip/_internal/commands/install.py", line 455, in run
use_user_site=options.use_user_site,
File "/usr/local/lib/python3.6/dist-packages/pip/_internal/req/__init__.py", line 62, in install_given_reqs
**kwargs
File "/usr/local/lib/python3.6/dist-packages/pip/_internal/req/req_install.py", line 888, in install
cwd=self.unpacked_source_directory,
File "/usr/local/lib/python3.6/dist-packages/pip/_internal/utils/subprocess.py", line 275, in runner
spinner=spinner,
File "/usr/local/lib/python3.6/dist-packages/pip/_internal/utils/subprocess.py", line 242, in call_subprocess
raise InstallationError(exc_msg)
pip._internal.exceptions.InstallationError: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-80yea4k8/setup.py'"'"'; _file__='"'"'/tmp/pip-req-build-80yea4k8/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file_);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, _file_, '"'"'exec'"'"'))' --cpp_ext --cuda_ext install --record /tmp/pip-record-ao89_tgj/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

stale

Most helpful comment

Here are the commands that work for me on Colab:

%%writefile setup.sh

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

Then:

!sh setup.sh

All 5 comments

Here are the commands that work for me on Colab:

%%writefile setup.sh

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

Then:

!sh setup.sh

pip install pytorch-pretrained-bert

The current library is transformers although I am not sure whether this is aliased to point to the current library as well.

Cool ! Thanks a lot, it works fine.

But it would be better if there is anyone there who knows how to install that in windows.

The reasons is that I want to use my personal gpu to run theses models, so I might need either install apex in my laptops (windows).

Or I could just use "connect to local runtime" on Colab to achieve the same thing?

You would probably save yourself a lot of time and effort by just installing a linux distribution alongside windows and using it for ML work. Getting Apex to work on Windows is quite tricky and I'm not aware of any straightforward method to do it. NVidia says you might be able to get it to work by building Pytorch from source but they don't officially support Apex on windows either.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Sharing-Sam-Work picture Sharing-Sam-Work  路  6Comments

rohanvartak1996 picture rohanvartak1996  路  3Comments

krrishdholakia picture krrishdholakia  路  7Comments

Jashjeet picture Jashjeet  路  6Comments

marctorsoc picture marctorsoc  路  6Comments