https://colab.research.google.com/github/tensorflow/docs/blob/master/site/en/tutorials/quickstart/beginner.ipynb?hl=ko

(venv) (base) j:\AI>deactivate
(base) j:\AI>.\venv\Scripts\activate

(venv) (base) j:\AI>pip install --upgrade tensorflow
Collecting tensorflow
  Downloading https://files.pythonhosted.org/packages/54/5f/e1b2d83b808f978f51b7ce109315154da3a3d4151aa59686002681f2e109/tensorflow-2.0.0-cp37-cp37m-win_amd64.whl (48.1MB)
     |███████▌                        | 11.1MB 1.3MB/s eta 0:00:29  

 

--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) <ipython-input-2-64156d691fe5> in <module> ----> 1 import tensorflow as tf ModuleNotFoundError: No module named 'tensorflow'

 


(venv) (base) j:\AI>jupyter notebook
[I 02:46:29.893 NotebookApp] The port 8888 is already in use, trying another port.
[I 02:46:29.894 NotebookApp] The port 8889 is already in use, trying another port.
[I 02:46:29.995 NotebookApp] JupyterLab extension loaded from J:\Anaconda3\lib\site-packages\jupyterlab
[I 02:46:29.996 NotebookApp] JupyterLab application directory is J:\Anaconda3\share\jupyter\lab
[I 02:46:30.041 NotebookApp] Serving notebooks from local directory: j:\AI
[I 02:46:30.041 NotebookApp] The Jupyter Notebook is running at:
[I 02:46:30.042 NotebookApp] http://localhost:8890/?token=170a7f76196b6eee0b173ea61c2cff69e4fe980b73e5a456
[I 02:46:30.044 NotebookApp]  or http://127.0.0.1:8890/?token=170a7f76196b6eee0b173ea61c2cff69e4fe980b73e5a456
[I 02:46:30.045 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 02:46:30.165 NotebookApp]

    To access the notebook, open this file in a browser:
        file:///C:/Users/joe/AppData/Roaming/jupyter/runtime/nbserver-46908-open.html
    Or copy and paste one of these URLs:
        http://localhost:8890/?token=170a7f76196b6eee0b173ea61c2cff69e4fe980b73e5a456
     or http://127.0.0.1:8890/?token=170a7f76196b6eee0b173ea61c2cff69e4fe980b73e5a456
[I 02:46:46.732 NotebookApp] Creating new notebook in
[I 02:46:47.969 NotebookApp] Kernel started: 89448ba3-29ae-43e7-a188-e19883fe88ea

 

 

--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) <ipython-input-1-64156d691fe5> in <module> ----> 1 import tensorflow as tf ModuleNotFoundError: No module named 'tensorflow'

 

 

(venv) (base) j:\AI>pip install --upgrade tensorflow
Requirement already up-to-date: tensorflow in j:\ai\venv\lib\site-packages (2.0.0)
Requirement already satisfied, skipping upgrade: gast==0.2.2 in j:\ai\venv\lib\site-packages (from tensorflow) (0.2.2)
Requirement already satisfied, skipping upgrade: wrapt>=1.11.1 in j:\anaconda3\lib\site-packages (from tensorflow) (1.11.2)
Requirement already satisfied, skipping upgrade: opt-einsum>=2.3.2 in j:\ai\venv\lib\site-packages (from tensorflow) (3.1.0)
Requirement already satisfied, skipping upgrade: keras-preprocessing>=1.0.5 in j:\ai\venv\lib\site-packages (from tensorflow) (1.1.0)
Requirement already satisfied, skipping upgrade: protobuf>=3.6.1 in j:\ai\venv\lib\site-packages (from tensorflow) (3.10.0)
Requirement already satisfied, skipping upgrade: termcolor>=1.1.0 in j:\ai\venv\lib\site-packages (from tensorflow) (1.1.0)
Requirement already satisfied, skipping upgrade: grpcio>=1.8.6 in j:\ai\venv\lib\site-packages (from tensorflow) (1.25.0)
Requirement already satisfied, skipping upgrade: absl-py>=0.7.0 in j:\ai\venv\lib\site-packages (from tensorflow) (0.8.1)
Requirement already satisfied, skipping upgrade: tensorflow-estimator<2.1.0,>=2.0.0 in j:\ai\venv\lib\site-packages (from tensorflow) (2.0.1)
Requirement already satisfied, skipping upgrade: astor>=0.6.0 in j:\ai\venv\lib\site-packages (from tensorflow) (0.8.0)
Requirement already satisfied, skipping upgrade: six>=1.10.0 in j:\anaconda3\lib\site-packages (from tensorflow) (1.13.0)
Requirement already satisfied, skipping upgrade: wheel>=0.26 in j:\ai\venv\lib\site-packages (from tensorflow) (0.33.6)
Requirement already satisfied, skipping upgrade: tensorboard<2.1.0,>=2.0.0 in j:\ai\venv\lib\site-packages (from tensorflow) (2.0.1)
Requirement already satisfied, skipping upgrade: google-pasta>=0.1.6 in j:\ai\venv\lib\site-packages (from tensorflow) (0.1.8)
Requirement already satisfied, skipping upgrade: numpy<2.0,>=1.16.0 in j:\anaconda3\lib\site-packages (from tensorflow) (1.17.3)
Requirement already satisfied, skipping upgrade: keras-applications>=1.0.8 in j:\ai\venv\lib\site-packages (from tensorflow) (1.0.8)
Requirement already satisfied, skipping upgrade: setuptools in j:\ai\venv\lib\site-packages (from protobuf>=3.6.1->tensorflow) (42.0.1)
Requirement already satisfied, skipping upgrade: google-auth-oauthlib<0.5,>=0.4.1 in j:\ai\venv\lib\site-packages (from tensorboard<2.1.0,>=2.0.0->tensorflow) (0.4.1)
Requirement already satisfied, skipping upgrade: werkzeug>=0.11.15 in j:\anaconda3\lib\site-packages (from tensorboard<2.1.0,>=2.0.0->tensorflow) (0.16.0)
Requirement already satisfied, skipping upgrade: markdown>=2.6.8 in j:\ai\venv\lib\site-packages (from tensorboard<2.1.0,>=2.0.0->tensorflow) (3.1.1)
Requirement already satisfied, skipping upgrade: google-auth<2,>=1.6.3 in j:\ai\venv\lib\site-packages (from tensorboard<2.1.0,>=2.0.0->tensorflow) (1.7.1)
Requirement already satisfied, skipping upgrade: h5py in j:\anaconda3\lib\site-packages (from keras-applications>=1.0.8->tensorflow) (2.9.0)
Requirement already satisfied, skipping upgrade: requests-oauthlib>=0.7.0 in j:\ai\venv\lib\site-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.1.0,>=2.0.0->tensorflow) (1.3.0)
Requirement already satisfied, skipping upgrade: cachetools<3.2,>=2.0.0 in j:\ai\venv\lib\site-packages (from google-auth<2,>=1.6.3->tensorboard<2.1.0,>=2.0.0->tensorflow) (3.1.1)
Requirement already satisfied, skipping upgrade: pyasn1-modules>=0.2.1 in j:\ai\venv\lib\site-packages (from google-auth<2,>=1.6.3->tensorboard<2.1.0,>=2.0.0->tensorflow) (0.2.7)
Requirement already satisfied, skipping upgrade: rsa<4.1,>=3.1.4 in j:\ai\venv\lib\site-packages (from google-auth<2,>=1.6.3->tensorboard<2.1.0,>=2.0.0->tensorflow) (4.0)
Requirement already satisfied, skipping upgrade: requests>=2.0.0 in j:\anaconda3\lib\site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.1.0,>=2.0.0->tensorflow) (2.22.0)
Requirement already satisfied, skipping upgrade: oauthlib>=3.0.0 in j:\ai\venv\lib\site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.1.0,>=2.0.0->tensorflow) (3.1.0)
Requirement already satisfied, skipping upgrade: pyasn1<0.5.0,>=0.4.6 in j:\ai\venv\lib\site-packages (from pyasn1-modules>=0.2.1->google-auth<2,>=1.6.3->tensorboard<2.1.0,>=2.0.0->tensorflow) (0.4.8)
Requirement already satisfied, skipping upgrade: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in j:\anaconda3\lib\site-packages (from requests>=2.0.0->requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.1.0,>=2.0.0->tensorflow) (1.24.2)
Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in j:\anaconda3\lib\site-packages (from requests>=2.0.0->requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.1.0,>=2.0.0->tensorflow) (2019.9.11)
Requirement already satisfied, skipping upgrade: chardet<3.1.0,>=3.0.2 in j:\anaconda3\lib\site-packages (from requests>=2.0.0->requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.1.0,>=2.0.0->tensorflow) (3.0.4)
Requirement already satisfied, skipping upgrade: idna<2.9,>=2.5 in j:\anaconda3\lib\site-packages (from requests>=2.0.0->requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.1.0,>=2.0.0->tensorflow) (2.8)

(venv) (base) j:\AI>python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
2019-11-26 02:48:42.169374: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
tf.Tensor(2040.7914, shape=(), dtype=float32)

 

 

python3 했더니 Microsoft store 로 넘어감. 3.7 버전이 있음. 게다가 받다가 지속 오류도 해결책도 없음ㅋㅋㅋ

 

ㅋㅋㅋ 언제 제대로 통합되려나 블로그에서 다들 고생하네. anaconda도 결국 텐서랑 다른 회사라 그런가 봄.

나중에 구글이 만든거 있으면 써야 하겠지만 아나콘다가 그걸 하려는 "움직임"이니 아나콘다 포스팅을 최우선으로 생각해야함.

 

 

https://www.tensorflow.org/install/pip?hl=ko

 

Install TensorFlow with pip  |  TensorFlow

TensorFlow 2 packages are available tensorflow —Latest stable release for CPU-only tensorflow-gpu —Latest stable release with GPU support (Ubuntu and Windows) tf-nightly —Preview build (unstable). Ubuntu and Windows include GPU support. Older versions of T

www.tensorflow.org

 

https://docs.anaconda.com/anaconda/user-guide/tasks/tensorflow/

 

TensorFlow — Anaconda documentation

TensorFlow Anaconda makes it easy to install TensorFlow, enabling your data science, machine learning, and artificial intelligence workflows. This page shows how to install TensorFlow with the conda package manager included in Anaconda and Miniconda. Tenso

docs.anaconda.com

(base) PS C:\Users\joe> j:
(base) PS J:\> cd ai
(base) PS J:\ai> conda create -n tf tensorflow
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: J:\Anaconda3\envs\tf

  added / updated specs:
    - tensorflow


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    _tflow_select-2.3.0        |              mkl           3 KB
    absl-py-0.8.1              |           py37_0         162 KB
    astor-0.8.0                |           py37_0          47 KB
    gast-0.2.2                 |           py37_0         155 KB
    google-pasta-0.1.8         |             py_0          43 KB
    grpcio-1.16.1              |   py37h351948d_1         850 KB
    keras-applications-1.0.8   |             py_0          33 KB
    keras-preprocessing-1.1.0  |             py_1          36 KB
    libmklml-2019.0.5          |                0        17.4 MB
    libprotobuf-3.10.1         |       h7bd577a_0         2.3 MB
    markdown-3.1.1             |           py37_0         132 KB

 

 

(base) PS J:\ai> conda activate tf-gpu                                                                                  (tf-gpu) PS J:\ai>     

 

 

 

(tf-gpu) PS J:\ai> python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"             2019-11-26 03:03:21.854070: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
2019-11-26 03:03:24.622058: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2019-11-26 03:03:24.789283: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties:
name: GeForce GTX 1050 major: 6 minor: 1 memoryClockRate(GHz): 1.544
pciBusID: 0000:09:00.0
2019-11-26 03:03:24.799864: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
2019-11-26 03:03:24.808384: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
2019-11-26 03:03:24.813627: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
2019-11-26 03:03:24.824682: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties:
name: GeForce GTX 1050 major: 6 minor: 1 memoryClockRate(GHz): 1.544
pciBusID: 0000:09:00.0
2019-11-26 03:03:24.835336: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
2019-11-26 03:03:24.845828: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
2019-11-26 03:03:25.924409: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-11-26 03:03:25.931410: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165]      0
2019-11-26 03:03:25.936123: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0:   N
2019-11-26 03:03:25.941687: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 1340 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1050, pci bus id: 0000:09:00.0, compute capability: 6.1)
tf.Tensor(-753.7468, shape=(), dtype=float32)

 

 

 

 

(tf-gpu) PS J:\ai> python                                                                                               Python 3.7.5 (default, Oct 31 2019, 15:18:51) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
2019-11-26 03:04:57.218292: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll

 

 

 

powershell 실행 후 

(base) PS C:\Users\joe> conda activate tf-gpu                                                                           (tf-gpu) PS C:\Users\joe> python                                                                                        Python 3.7.5 (default, Oct 31 2019, 15:18:51) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
2019-11-26 03:20:09.553228: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
>>>           

 

Ctrl+Z로 들어가서 conda install jupter로 또 설치해 주면

 

- DEBUG menuinst_win32:__init__(199): Menu: name: 'Anaconda${PY_VER} ${PLATFORM}', prefix: 'J:\Anaconda3\envs\tf-gpu', env_name: 'tf-gpu', mode: 'user', used_mode: 'user'
DEBUG menuinst_win32:create(323): Shortcut cmd is J:\Anaconda3\python.exe, args are ['J:\\Anaconda3\\cwp.py', 'J:\\Anaconda3\\envs\\tf-gpu', 'J:\\Anaconda3\\envs\\tf-gpu\\python.exe', 'J:\\Anaconda3\\envs\\tf-gpu\\Scripts\\jupyter-notebook-script.py', '"%USERPROFILE%/"']
done
(tf-gpu) PS C:\Users\joe> jupyter                                                                                                            usage: jupyter [-h] [--version] [--config-dir] [--data-dir] [--runtime-dir]
               [--paths] [--json]
               [subcommand]
jupyter: error: one of the arguments --version subcommand --config-dir --data-dir --runtime-dir --paths is required
(tf-gpu) PS C:\Users\joe> jupyter-notebook.exe                                                                                               [I 03:23:32.823 NotebookApp] The port 8888 is already in use, trying another port.
[I 03:23:32.824 NotebookApp] The port 8889 is already in use, trying another port.
[I 03:23:32.825 NotebookApp] The port 8890 is already in use, trying another port.
[I 03:23:32.826 NotebookApp] The port 8891 is already in use, trying another port.
[I 03:23:32.827 NotebookApp] The port 8892 is already in use, trying another port.
[I 03:23:32.842 NotebookApp] Serving notebooks from local directory: C:\Users\joe
[I 03:23:32.842 NotebookApp] The Jupyter Notebook is running at:
[I 03:23:32.842 NotebookApp] http://localhost:8885/?token=10b1fc0f61009ba912020010a7d5e4e6bbf8b1cbe4150bda
[I 03:23:32.843 NotebookApp]  or http://127.0.0.1:8885/?token=10b1fc0f61009ba912020010a7d5e4e6bbf8b1cbe4150bda
[I 03:23:32.843 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 03:23:32.978 NotebookApp]

    To access the notebook, open this file in a browser:
        file:///C:/Users/joe/AppData/Roaming/jupyter/runtime/nbserver-48628-open.html
    Or copy and paste one of these URLs:
        http://localhost:8885/?token=10b1fc0f61009ba912020010a7d5e4e6bbf8b1cbe4150bda
     or http://127.0.0.1:8885/?token=10b1fc0f61009ba912020010a7d5e4e6bbf8b1cbe4150bda
[I 03:23:39.939 NotebookApp] Kernel started: 1d586540-b64f-4613-9299-ad68c7b7fd96
2019-11-26 03:23:41.799195: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll

 

import tensorflow as tf 에 에러가 없다. 이제 conda 패키지 매니저가 지원하는 패키지는 모두 설치할 수 있고 python 3.7.5와의 궁합도 잘 맞을 것 같다.

 

걍 다 묶어서 패키지로 만들지... 20년 동안 지켜봐도(내가 8살 때는 리눅스 안했었으니) 아직도 마음에 들지 않는 리눅스 패키지 매니저 처럼(레드헷 계열이던 데비안 계열이던) 똑같은 길을 아나콘다가 걷는 것 같다.

 

요즘엔 폴더를 예쁘게 컨스트럭팅 하지는 않으니 주피터 한번 더 까는 것도 ㄱㅊ.

 

내가 만드는 것도 아니라 소스 정리 보다는 이론을 정확하게 하는게 더 중요한 상태.

 

내 스타일과 맞지 않아서 정립된 후 쓰려고 했는데 이제 슬 들어가야 한다. AI로.

 

'Blog History' 카테고리의 다른 글

개 발 일 지 034  (1) 2019.12.04
개 발 일 지 033  (0) 2019.11.26
개 발 일 지 031  (0) 2019.11.26
개 발 일 지 030  (0) 2019.11.25
개 발 일 지 029  (0) 2019.11.24

+ Recent posts