apex icon indicating copy to clipboard operation
apex copied to clipboard

could not install with "pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./"

Open songtaoshi opened this issue 5 years ago • 6 comments

1158a4d (from https://pypi.tuna.tsinghua.edu.cn/simple/pip/), version: 8.0.1 [101/1230] Found link https://pypi.tuna.tsinghua.edu.cn/packages/e7/a0/bd35f5f978a5e925953ce02fa0f078a232f0f10fcbe543d8cfc043f74fda/pip-8.0.2-py2.py3-none-any.whl#sha256=249a6f3194be8c2e8cb4d4be3f6fd16a9f1e3336218 caffa8e7419e3816f9988 (from https://pypi.tuna.tsinghua.edu.cn/simple/pip/), version: 8.0.2 Found link https://pypi.tuna.tsinghua.edu.cn/packages/ce/15/ee1f9a84365423e9ef03d0f9ed0eba2fb00ac1fffdd33e7b52aea914d0f8/pip-8.0.2.tar.gz#sha256=46f4bd0d8dfd51125a554568d646fe4200a3c2c6c36b9f2d06d221214 8439521 (from https://pypi.tuna.tsinghua.edu.cn/simple/pip/), version: 8.0.2 Found link https://pypi.tuna.tsinghua.edu.cn/packages/ae/d4/2b127310f5364610b74c28e2e6a40bc19e2d3c9a9a4e012d3e333e767c99/pip-8.0.3-py2.py3-none-any.whl#sha256=b0335bc837f9edb5aad03bd43d0973b084a1cbe616f 8188dc23ba13234dbd552 (from https://pypi.tuna.tsinghua.edu.cn/simple/pip/), version: 8.0.3 Found link https://pypi.tuna.tsinghua.edu.cn/packages/22/f3/14bc87a4f6b5ec70b682765978a6f3105bf05b6781fa97e04d30138bd264/pip-8.0.3.tar.gz#sha256=30f98b66f3fe1069c529a491597d34a1c224a68640c82caf2ade5f88a a1405e8 (from https://pypi.tuna.tsinghua.edu.cn/simple/pip/), version: 8.0.3 Found link https://pypi.tuna.tsinghua.edu.cn/packages/1e/c7/78440b3fb882ed001e6e12d8770bd45e73d6eced4e57f7c072b829ce8a3d/pip-8.1.0-py2.py3-none-any.whl#sha256=a542b99e08002ead83200198e19a3983270357e1cb4 fe704247990b5b35471dc (from https://pypi.tuna.tsinghua.edu.cn/simple/pip/), version: 8.1.0 Found link https://pypi.tuna.tsinghua.edu.cn/packages/3c/72/6981d5adf880adecb066a1a1a4c312a17f8d787a3b85446967964ac66d55/pip-8.1.0.tar.gz#sha256=d8faa75dd7d0737b16d50cd0a56dc91a631c79ecfd8d38b80f6ee929e c82043e (from https://pypi.tuna.tsinghua.edu.cn/simple/pip/), version: 8.1.0 Found link https://pypi.tuna.tsinghua.edu.cn/packages/31/6a/0f19a7edef6c8e5065f4346137cc2a08e22e141942d66af2e1e72d851462/pip-8.1.1-py2.py3-none-any.whl#sha256=44b9c342782ab905c042c207d995aa069edc02621dd bdc2b9f25954a0fdac25c (from https://pypi.tuna.tsinghua.edu.cn/simple/pip/), version: 8.1.1 Found link https://pypi.tuna.tsinghua.edu.cn/packages/41/27/9a8d24e1b55bd8c85e4d022da2922cb206f183e2d18fee4e320c9547e751/pip-8.1.1.tar.gz#sha256=3e78d3066aaeb633d185a57afdccf700aa2e660436b4af618bcb6ff0f a511798 (from https://pypi.tuna.tsinghua.edu.cn/simple/pip/), version: 8.1.1 Found link https://pypi.tuna.tsinghua.edu.cn/packages/9c/32/004ce0852e0a127f07f358b715015763273799bd798956fa930814b60f39/pip-8.1.2-py2.py3-none-any.whl#sha256=6464dd9809fb34fc8df2bf49553bb11dac4c13d2ffa 7a4f8038ad86a4ccb92a1 (from https://pypi.tuna.tsinghua.edu.cn/simple/pip/), version: 8.1.2 Found link https://pypi.tuna.tsinghua.edu.cn/packages/e7/a8/7556133689add8d1a54c0b14aeff0acb03c64707ce100ecd53934da1aa13/pip-8.1.2.tar.gz#sha256=4d24b03ffa67638a3fa931c09fd9e0273ffa904e95ebebe7d4b1a54c9 3d7b732 (from https://pypi.tuna.tsinghua.edu.cn/simple/pip/), version: 8.1.2 Found link https://pypi.tuna.tsinghua.edu.cn/packages/3f/ef/935d9296acc4f48d1791ee56a73781271dce9712b059b475d3f5fa78487b/pip-9.0.0-py2.py3-none-any.whl#sha256=c856ac18ca01e7127456f831926dc67cc7d3ab663f4 c13b1ec156e36db4de574 (from https://pypi.tuna.tsinghua.edu.cn/simple/pip/) (requires-python:>=2.6,!=3.0.,!=3.1.,!=3.2.), version: 9.0.0 Found link https://pypi.tuna.tsinghua.edu.cn/packages/5e/53/eaef47e5e2f75677c9de0737acc84b659b78a71c4086f424f55346a341b5/pip-9.0.0.tar.gz#sha256=f62fb70e7e000e46fce12aaeca752e5281a5446977fe5a75ab4189a43 b3f8793 (from https://pypi.tuna.tsinghua.edu.cn/simple/pip/) (requires-python:>=2.6,!=3.0.,!=3.1.,!=3.2.), version: 9.0.0 Found link https://pypi.tuna.tsinghua.edu.cn/packages/b6/ac/7015eb97dc749283ffdec1c3a88ddb8ae03b8fad0f0e611408f196358da3/pip-9.0.1-py2.py3-none-any.whl#sha256=690b762c0a8460c303c089d5d0be034fb15a5ea2b75 bdf565f40421f542fefb0 (from https://pypi.tuna.tsinghua.edu.cn/simple/pip/) (requires-python:>=2.6,!=3.0.,!=3.1.,!=3.2.), version: 9.0.1 Found link https://pypi.tuna.tsinghua.edu.cn/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz#sha256=09f243e1a7b461f654c26a725fa373211bb7ff17a9300058b205c6165 8ca940d (from https://pypi.tuna.tsinghua.edu.cn/simple/pip/) (requires-python:>=2.6,!=3.0.,!=3.1.,!=3.2.), version: 9.0.1 Found link https://pypi.tuna.tsinghua.edu.cn/packages/e7/f9/e801dcea22886cd513f6bd2e8f7e581bd6f67bb8e8f1cd8e7b92d8539280/pip-9.0.2-py2.py3-none-any.whl#sha256=b135491ddb061f39719b8472d8abb59c613816a2b86 069c332db74d1cd208ab2 (from https://pypi.tuna.tsinghua.edu.cn/simple/pip/) (requires-python:>=2.6,!=3.0.,!=3.1.,!=3.2.), version: 9.0.2 Found link https://pypi.tuna.tsinghua.edu.cn/packages/e5/8f/3fc66461992dc9e9fcf5e005687d5f676729172dda640df2fd8b597a6da7/pip-9.0.2.tar.gz#sha256=88110a224e9d30e5d76592a0b2130ef10e7e67a6426e8617bb918fffb fe91fe5 (from https://pypi.tuna.tsinghua.edu.cn/simple/pip/) (requires-python:>=2.6,!=3.0.,!=3.1.,!=3.2.), version: 9.0.2 Found link https://pypi.tuna.tsinghua.edu.cn/packages/ac/95/a05b56bb975efa78d3557efa36acaf9cf5d2fd0ee0062060493687432e03/pip-9.0.3-py2.py3-none-any.whl#sha256=c3ede34530e0e0b2381e7363aded78e0c3329165493 7e7373032fda04e8803e5 (from https://pypi.tuna.tsinghua.edu.cn/simple/pip/) (requires-python:>=2.6,!=3.0.,!=3.1.,!=3.2.), version: 9.0.3 Found link https://pypi.tuna.tsinghua.edu.cn/packages/c4/44/e6b8056b6c8f2bfd1445cc9990f478930d8e3459e9dbf5b8e2d2922d64d3/pip-9.0.3.tar.gz#sha256=7bf48f9a693be1d58f49f7af7e0ae9fe29fd671cde8a55e6edca3581c 4ef5796 (from https://pypi.tuna.tsinghua.edu.cn/simple/pip/) (requires-python:>=2.6,!=3.0.,!=3.1.,!=3.2.), version: 9.0.3 Given no hashes to check 147 links for project 'pip': discarding no candidates Removed build tracker: '/tmp/pip-req-tracker-grqq0eov'

songtaoshi avatar Aug 28 '20 04:08 songtaoshi

my torch version is 1.6.0.
cuda 10.2

songtaoshi avatar Aug 28 '20 05:08 songtaoshi

I experience the same issue. pytorch version 1.6.0

SimonKitSangChu avatar Aug 28 '20 23:08 SimonKitSangChu

Same issue at first. torch==1.6.0+cu101 torchvision==0.7.0+cu101 cuda 10.1

If you scrool up and see what the real error is, it might be like mine:

fatal error: Python.h: No such file or directory
     #include <Python.h>
               ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Running setup.py install for apex ... error

And fix: https://stackoverflow.com/questions/21530577/fatal-error-python-h-no-such-file-or-directory

samo1petar avatar Sep 02 '20 13:09 samo1petar

the same for Ubuntu 20.04 from NVIDIA docker with:

  • python 3.6
  • pytorch 1.5
    Compiling cuda extensions with
    nvcc: NVIDIA (R) Cuda compiler driver
    Copyright (c) 2005-2020 NVIDIA Corporation
    Built on Tue_Sep_15_19:10:02_PDT_2020
    Cuda compilation tools, release 11.1, V11.1.74
    Build cuda_11.1.TC455_06.29069683_0
    from /usr/local/cuda/bin

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-req-build-ygqahid7/setup.py", line 152, in <module>
        check_cuda_torch_binary_vs_bare_metal(torch.utils.cpp_extension.CUDA_HOME)
      File "/tmp/pip-req-build-ygqahid7/setup.py", line 106, 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.2.
    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
ERROR: Command errored out with exit status 1: /usr/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-ygqahid7/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-ygqahid7/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-zzt8rg3v/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.6/apex Check the logs for full command output.
Exception information:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/req/req_install.py", line 852, in install
    req_description=str(self.req),
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/operations/install/legacy.py", line 86, in install
    raise LegacyInstallFailure
pip._internal.operations.install.legacy.LegacyInstallFailure

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/base_command.py", line 228, in _main
    status = self.run(options, args)
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/req_command.py", line 182, in wrapper
    return func(self, options, args)
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/commands/install.py", line 406, in run
    pycompile=options.compile,
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/req/__init__.py", line 90, in install_given_reqs
    pycompile=pycompile,
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/req/req_install.py", line 856, in install
    six.reraise(*exc.parent)
  File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/six.py", line 703, in reraise
    raise value
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/operations/install/legacy.py", line 76, in install
    cwd=unpacked_source_directory,
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/utils/subprocess.py", line 277, 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.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-ygqahid7/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-ygqahid7/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-zzt8rg3v/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.6/apex Check the logs for full command output.
1 location(s) to search for versions of pip:
* https://pypi.org/simple/pip/
Fetching project page and analyzing links: https://pypi.org/simple/pip/
Getting page https://pypi.org/simple/pip/
Found index url https://pypi.org/simple
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /simple/pip/ HTTP/1.1" 200 14495

Borda avatar Oct 24 '20 20:10 Borda

@Borda The installation raises this RuntimeError, so you would need to either build PyTorch from source using the same CUDA toolkit or install the binaries with a matching CUDA version:

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.2.
    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).

ptrblck avatar Oct 28 '20 01:10 ptrblck

The same case

  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 11.6.
  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).

lix19937 avatar Oct 23 '24 02:10 lix19937