質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
CUDA

CUDAは並列計算プラットフォームであり、Nvidia GPU(Graphics Processing Units)向けのプログラミングモデルです。CUDAは様々なプログラミング言語、ライブラリ、APIを通してNvidiaにインターフェイスを提供します。

JupyterLab

JupyterLabは、Jupyter notebookの後継の対話型開発環境(IDE)です。データの可視化がインタラクティブで、プラグイン作成により新しいコンポーネントの追加および既存のコンポーネントも統合可能。サーバに閉じているため、データ分析に向いています。

Visual Studio

Microsoft Visual StudioはMicrosoftによる統合開発環境(IDE)です。多種多様なプログラミング言語に対応しています。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Q&A

解決済

1回答

1878閲覧

Windows 10 + Anaconda でtensorflow-gpu1.14を使いたい (stackoverflowとの重複)

i113

総合スコア74

CUDA

CUDAは並列計算プラットフォームであり、Nvidia GPU(Graphics Processing Units)向けのプログラミングモデルです。CUDAは様々なプログラミング言語、ライブラリ、APIを通してNvidiaにインターフェイスを提供します。

JupyterLab

JupyterLabは、Jupyter notebookの後継の対話型開発環境(IDE)です。データの可視化がインタラクティブで、プラグイン作成により新しいコンポーネントの追加および既存のコンポーネントも統合可能。サーバに閉じているため、データ分析に向いています。

Visual Studio

Microsoft Visual StudioはMicrosoftによる統合開発環境(IDE)です。多種多様なプログラミング言語に対応しています。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

0グッド

0クリップ

投稿2022/01/29 17:02

編集2022/01/30 04:37

最終的にはAnaconda Navigator から起動したJupyter Labでtensorflow-gpuを使いたいと思っています。

環境は以下のとおりです。
Windows 10 (RTX2060Super搭載)
Microsoft Visual Studio 2019
Nvidia CUDA 11.6
Anaconda3.9

ここからAnacondaプロンプトを用いて以下のようにインストールを試みました。

Anacondaプロンプト

1> conda create -n twne 2> conda activate twne 3(twne)> conda install python=3.6.10 4(twne)> pip3 install torch==1.10.1+cu113 torchvision==0.11.2+cu113 torchaudio===0.10.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html 5(twne)> conda install tensorflow-gpu=1.14 6(twne)> nvcc -V 7nvcc: NVIDIA (R) Cuda compiler driver 8Copyright (c) 2005-2021 NVIDIA Corporation 9Built on Fri_Dec_17_18:28:54_Pacific_Standard_Time_2021 10Cuda compilation tools, release 11.6, V11.6.55 11Build cuda_11.6.r11.6/compiler.30794723_0 12(twne)>nvidia-smi 13Sat Jan 29 17:04:27 2022 14+-----------------------------------------------------------------------------+ 15| NVIDIA-SMI 456.71 Driver Version: 456.71 CUDA Version: 11.1 | 16|-------------------------------+----------------------+----------------------+ 17| GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC | 18| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | 19|===============================+======================+======================| 20| 0 GeForce RTX 206... WDDM | 00000000:08:00.0 On | N/A | 21| 29% 30C P8 19W / 175W | 1502MiB / 8192MiB | 11% Default | 22+-------------------------------+----------------------+----------------------+ 23 24+-----------------------------------------------------------------------------+ 25| Processes: | 26| GPU GI CI PID Type Process name GPU Memory | 27| ID ID Usage | 28|=============================================================================| 29| 0 N/A N/A 1424 C+G Insufficient Permissions N/A | 30| 0 N/A N/A 2208 C+G ...8wekyb3d8bbwe\Cortana.exe N/A | 31| 0 N/A N/A 7796 C+G C:\Windows\explorer.exe N/A | 32| 0 N/A N/A 8740 C+G ...5n1h2txyewy\SearchApp.exe N/A | 33| 0 N/A N/A 10004 C+G ...i\Application\vivaldi.exe N/A | 34| 0 N/A N/A 10256 C+G ...cw5n1h2txyewy\LockApp.exe N/A | 35| 0 N/A N/A 10872 C+G Insufficient Permissions N/A | 36| 0 N/A N/A 11724 C+G ...nputApp\TextInputHost.exe N/A | 37| 0 N/A N/A 12424 C+G ...lPanel\SystemSettings.exe N/A | 38| 0 N/A N/A 14316 C+G ...llpaper\RainWallpaper.exe N/A | 39| 0 N/A N/A 14568 C+G ...inWallpaper\videocore.exe N/A | 40| 0 N/A N/A 14576 C+G ...inWallpaper\videocore.exe N/A | 41| 0 N/A N/A 15348 C+G ...ram Files\LGHUB\lghub.exe N/A | 42| 0 N/A N/A 16256 C+G ...aming\Spotify\Spotify.exe N/A | 43| 0 N/A N/A 16908 C+G ...4.0.3.0\GoogleDriveFS.exe N/A | 44| 0 N/A N/A 18548 C+G ...t\GoogleIMEJaRenderer.exe N/A | 45| 0 N/A N/A 19144 C+G ...ions\Sancan210\Sancan.exe N/A | 46| 0 N/A N/A 20204 C+G ...ekyb3d8bbwe\YourPhone.exe N/A | 47+-----------------------------------------------------------------------------+ 48(twne)>python 49Python 3.6.13 |Anaconda, Inc.| (default, Mar 16 2021, 11:37:27) [MSC v.1916 64 bit (AMD64)] on win32 50Type "help", "copyright", "credits" or "license" for more information. 51>>> from tensorflow.python.client import device_lib 52C:\Users\hoge\anaconda3\envs\twne\lib\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. 53 _np_qint8 = np.dtype([("qint8", np.int8, 1)]) 54C:\Users\hoge\anaconda3\envs\twne\lib\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. 55 _np_quint8 = np.dtype([("quint8", np.uint8, 1)]) 56575859 (略) 60616263C:\Users\hoge\anaconda3\envs\twne\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. 64 np_resource = np.dtype([("resource", np.ubyte, 1)]) 65>>> print(device_lib.list_local_devices()) 662022-01-29 17:12:54.466889: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2 67686970 (略) 717273742022-01-29 17:12:54.881165: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/device:GPU:0 with 6734 MB memory) -> physical GPU (device: 0, name: GeForce RTX 2060 SUPER, pci bus id: 0000:08:00.0, compute capability: 7.5) 75[name: "/device:CPU:0" 76device_type: "CPU" 77memory_limit: 268435456 78locality { 79} 80incarnation: 11278547066770496530 81, name: "/device:GPU:0" 82device_type: "GPU" 83memory_limit: 7061500724 84locality { 85 bus_id: 1 86 links { 87 } 88} 89incarnation: 16847822037550859714 90physical_device_desc: "device: 0, name: GeForce RTX 2060 SUPER, pci bus id: 0000:08:00.0, compute capability: 7.5" 91] 92>>> 93(twne)>

この状況で、Anaconda Navigator から起動したJupyter Labで以下のコードを実行しましたが失敗しました。

python(JupyterLab)

1%cd .\stylegan2 2from function import *

python(JupyterLab)

1C:\Users\hoge\painter\stylegan2 2C:\Users\hoge\anaconda3\envs\twne\lib\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. 3 _np_qint8 = np.dtype([("qint8", np.int8, 1)]) 4C:\Users\hoge\anaconda3\envs\twne\lib\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. 5 _np_quint8 = np.dtype([("quint8", np.uint8, 1)]) 6789 () 10111213C:\Users\hoge\anaconda3\envs\twne\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. 14 np_resource = np.dtype([("resource", np.ubyte, 1)]) 15Setting up TensorFlow plugin "fused_bias_act.cu": Preprocessing... Failed! 16--------------------------------------------------------------------------- 17RuntimeError Traceback (most recent call last) 18<ipython-input-1-5a9fc02cd5e9> in <module> 19 1 # 関数定義 20 2 get_ipython().run_line_magic('cd', '.\\stylegan2') 21----> 3 from function import * 22 23~\painter\stylegan2\function.py in <module> 24 8 25 9 tflib.init_tf() 26---> 10 _G, _D, Gs = pickle.load(open("../network-tadne.pkl", "rb")) 27 11 # _G = Instantaneous snapshot of the generator. Mainly useful for resuming a previous training run. 28 12 # _D = Instantaneous snapshot of the discriminator. Mainly useful for resuming a previous training run. 29303132 () 33343536~\painter\stylegan2\dnnlib\tflib\custom_ops.py in _run_cmd(cmd) 37 59 status = pipe.close() 38 60 if status is not None: 39---> 61 raise RuntimeError('NVCC returned an error. See below for full command line and output log:\n\n%s\n\n%s' % (cmd, output)) 40 62 41 63 def _prepare_nvcc_cli(opts): 42 43RuntimeError: NVCC returned an error. See below for full command line and output log: 44 45nvcc "C:\Users\hoge\painter\stylegan2\dnnlib\tflib\ops\fused_bias_act.cu" --preprocess -o "C:\Users\hoge\AppData\Local\Temp\tmpgwzv8k1u\fused_bias_act_tmp.cu" --keep --keep-dir "C:\Users\hoge\AppData\Local\Temp\tmpgwzv8k1u" --disable-warnings --include-path "C:\Users\hoge\anaconda3\envs\twne\lib\site-packages\tensorflow\include" --include-path "C:\Users\hoge\anaconda3\envs\twne\lib\site-packages\tensorflow\include\external\protobuf_archive\src" --include-path "C:\Users\hoge\anaconda3\envs\twne\lib\site-packages\tensorflow\include\external\com_google_absl" --include-path "C:\Users\hoge\anaconda3\envs\twne\lib\site-packages\tensorflow\include\external\eigen_archive" --compiler-bindir "C:/Program Files (x86)/Microsoft Visual Studio 14.0/vc/bin" 2>&1 46 47nvcc fatal : nvcc cannot find a supported version of Microsoft Visual Studio. Only the versions between 2017 and 2019 (inclusive) are supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.

最後のメッセージを読むと『Visual Studioのバージョンが違うので2017か2019にしろ』と書かれていますが、Visual Studio 2019はインストール済みで、実際、他の仮想環境ではtensorflowではありませんが、GPUを利用したシステムが動いています。どうすればいいでしょうか?
イメージ説明

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

nvcc のコマンドライン:
... --compiler-bindir "C:/Program Files (x86)/Microsoft Visual Studio 14.0/vc/bin"

ここが不可解。Visual Studio 2019 なら version 16.x のはず。

投稿2022/01/29 23:36

episteme

総合スコア16614

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

i113

2022/01/30 04:42

どうも有難う御座います。 調べてみると version 14.x は2015のようです。2015なんてインストールした覚えないのですが... どうすれば version 16.x をインストールできますか? フォルダ構成を見ると、 "C:\Program Files (x86)\Microsoft Visual Studio 14.0" "C:\Program Files (x86)\Microsoft Visual Studio\2019" がどちらも存在します。
i113

2022/01/30 07:13

解決しました。 Visual Studio installerを起動し[変更]ボタンを押すと、インストール詳細欄の『MSVC140 - VS 2015 C++...』のチェックボックスにチェックが付いていたのでチェックをはずして[変更]。 "C:\Program Files (x86)\Microsoft Visual Studio 14.0"が消えたので再度Pythonコードを実行すると今度は「\stylegan2\dnnlib\tflib\custom_ops.pyのcompiler_bindir_search_pathを確認しろ」というエラーが出るので確認したところ、以下のようになっていました。 'C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx64/x64', 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64', 'C:/Program Files (x86)/Microsoft Visual Studio 14.0/vc/bin', 1行目と3行目を消し、2行目の14.23.28105を実際のナンバリングに書き換え、Anacondaを再起動したとこ上手くいきました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問