When I import Tensorflow
, Keras
or Pytorch
I face these errors:
I'm using Window 10 and my CPU supports AVX. Also I was preparing my project on Python(Anaconda) and installed Keras
, TensorFlow
using pip
( pip install keras
) and Pytorch
using conda
I activated my virtual environment( Test_01
) before download, and I checked it again with conda list
after download.
After checking those 3 programs are installed, I imported them with ipython
on Anaconda prompt. and this what I faced:
========================================================================
(Test_01) C:\Users\User>ipython
Python 3.8.3 (default, Jul 2 2020, 17:30:36) [MSC v.1916 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import tensorflow
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-d6579f534729> in <module>
----> 1 import tensorflow
ModuleNotFoundError: No module named 'tensorflow'
In [2]: import keras
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
C:\Anaconda3\lib\site-packages\keras\__init__.py in <module>
2 try:
----> 3 from tensorflow.keras.layers.experimental.preprocessing import RandomRotation
4 except ImportError:
ModuleNotFoundError: No module named 'tensorflow'
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
<ipython-input-2-88d96843a926> in <module>
----> 1 import keras
C:\Anaconda3\lib\site-packages\keras\__init__.py in <module>
3 from tensorflow.keras.layers.experimental.preprocessing import RandomRotation
4 except ImportError:
----> 5 raise ImportError(
6 'Keras requires TensorFlow 2.2 or higher. '
7 'Install TensorFlow via `pip install tensorflow`')
ImportError: Keras requires TensorFlow 2.2 or higher. Install TensorFlow via `pip install tensorflow`
In [3]: import torch
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-3-eb42ca6e4af3> in <module>
----> 1 import torch
ModuleNotFoundError: No module named 'torch'
===========================================================================
Keras
error message says:
Keras
requiresTensorFlow
2.2 or higher. Install TensorFlow via pip installTensorFlow
also, tensorflow and pytorch says
ModuleNotFoundError: No module named 'tensorflow'
ModuleNotFoundError: No module named 'torch'
So I installed TensorFlow
with pip
again, and it says:
(Test_01) C:\Users\User>pip install tensorflow
Requirement already satisfied: tensorflow in c:\anaconda3\envs\test_01\lib\site-packages (2.3.1)
Requirement already satisfied: grpcio>=1.8.6 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (1.33.2)
Requirement already satisfied: wrapt>=1.11.1 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (1.12.1)
Requirement already satisfied: gast==0.3.3 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (0.3.3)
Requirement already satisfied: protobuf>=3.9.2 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (3.13.0)
Requirement already satisfied: tensorboard<3,>=2.3.0 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (2.3.0)
Requirement already satisfied: tensorflow-estimator<2.4.0,>=2.3.0 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (2.3.0)
Requirement already satisfied: google-pasta>=0.1.8 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (0.2.0)
Requirement already satisfied: absl-py>=0.7.0 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (0.11.0)
Requirement already satisfied: six>=1.12.0 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (1.15.0)
Requirement already satisfied: wheel>=0.26 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (0.35.1)
Requirement already satisfied: keras-preprocessing<1.2,>=1.1.1 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (1.1.2)
Collecting numpy<1.19.0,>=1.16.0
Using cached numpy-1.18.5-cp38-cp38-win_amd64.whl (12.8 MB)
Requirement already satisfied: termcolor>=1.1.0 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (1.1.0)
Requirement already satisfied: astunparse==1.6.3 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (1.6.3)
Requirement already satisfied: opt-einsum>=2.3.2 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (3.3.0)
Requirement already satisfied: h5py<2.11.0,>=2.10.0 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (2.10.0)
Requirement already satisfied: setuptools in c:\anaconda3\envs\test_01\lib\site-packages (from protobuf>=3.9.2->tensorflow) (50.3.0.post20201006)
Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorboard<3,>=2.3.0->tensorflow) (0.4.2)
Requirement already satisfied: markdown>=2.6.8 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorboard<3,>=2.3.0->tensorflow) (3.3.3)
Requirement already satisfied: requests<3,>=2.21.0 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorboard<3,>=2.3.0->tensorflow) (2.24.0)
Requirement already satisfied: google-auth<2,>=1.6.3 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorboard<3,>=2.3.0->tensorflow) (1.23.0)
Requirement already satisfied: werkzeug>=0.11.15 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorboard<3,>=2.3.0->tensorflow) (1.0.1)
Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorboard<3,>=2.3.0->tensorflow) (1.7.0)
Requirement already satisfied: requests-oauthlib>=0.7.0 in c:\anaconda3\envs\test_01\lib\site-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard<3,>=2.3.0->tensorflow) (1.3.0)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\anaconda3\envs\test_01\lib\site-packages (from requests<3,>=2.21.0->tensorboard<3,>=2.3.0->tensorflow) (1.25.11)
Requirement already satisfied: chardet<4,>=3.0.2 in c:\anaconda3\envs\test_01\lib\site-packages (from requests<3,>=2.21.0->tensorboard<3,>=2.3.0->tensorflow) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in c:\anaconda3\envs\test_01\lib\site-packages (from requests<3,>=2.21.0->tensorboard<3,>=2.3.0->tensorflow) (2020.6.20)
Requirement already satisfied: idna<3,>=2.5 in c:\anaconda3\envs\test_01\lib\site-packages (from requests<3,>=2.21.0->tensorboard<3,>=2.3.0->tensorflow) (2.10)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in c:\anaconda3\envs\test_01\lib\site-packages (from google-auth<2,>=1.6.3->tensorboard<3,>=2.3.0->tensorflow) (4.1.1)
Requirement already satisfied: pyasn1-modules>=0.2.1 in c:\anaconda3\envs\test_01\lib\site-packages (from google-auth<2,>=1.6.3->tensorboard<3,>=2.3.0->tensorflow) (0.2.8)
Requirement already satisfied: rsa<5,>=3.1.4; python_version >= "3.5" in c:\anaconda3\envs\test_01\lib\site-packages (from google-auth<2,>=1.6.3->tensorboard<3,>=2.3.0->tensorflow) (4.6)
Requirement already satisfied: oauthlib>=3.0.0 in c:\anaconda3\envs\test_01\lib\site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard<3,>=2.3.0->tensorflow) (3.1.0)
Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in c:\anaconda3\envs\test_01\lib\site-packages (from pyasn1-modules>=0.2.1->google-auth<2,>=1.6.3->tensorboard<3,>=2.3.0->tensorflow) (0.4.8)
Installing collected packages: numpy
Attempting uninstall: numpy
Found existing installation: numpy 1.19.2
Uninstalling numpy-1.19.2:
Successfully uninstalled numpy-1.19.2
ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts.
We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default.
torch 1.6.0 requires future, which is not installed.
Successfully installed numpy-1.18.5
===============================================================================
I promise I checked that I installed and executed them on same environment(Test_01) so Can you tell me: What Should I do ? and How can I check my 'CUDA' version? I tried it with 'nvxx --version' on cmd and nothing works
First, i should thank you all of you made comment in my post. I found that visual studio c++ was not installed, so i installed it to my labtop. You can found it here https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.