Issue with Installing Tensorflow - python

I have an issue with the installation of Tensorflow
I just completed installing Tensorflow with
$ pip install --user --upgrade tensorflow
and these are the last lines I get after this installation
Successfully built absl-py gast
Installing collected packages: wheel, six, grpcio, absl-py, numpy, gast, astor, tensorflow, h5py, werkzeug, se tuptools
Successfully installed absl-py-0.7.1 astor-0.8.0 gast-0.2.2 grpcio-1.21.1 h5py-2.9.0 numpy-1.16.4 setuptools-4 1.0.1 six-1.12.0 tensorflow-1.13.1 werkzeug-0.15.4 wheel-0.33.4 `````
and then when I enter the following command:
$ pip install --upgrade tensorflow
I do get a bunch of requirement already up-to-date as per the below .
Requirement already up-to-date: tensorflow in c:\users\xxx\appdata\roaming\python\python36\site-packages
Requirement already up-to-date: tensorflow-estimator<1.14.0rc0,>=1.13.0 in c:\programdata\anaconda3\lib\site-p ackages (from tensorflow)
Requirement already up-to-date: numpy>=1.13.3 in c:\users\xxx\appdata\roaming\python\python36\site-packag es (from tensorflow)
Requirement already up-to-date: gast>=0.2.0 in c:\users\xxx\appdata\roaming\python\python36\site-packages (from tensorflow)
Requirement already up-to-date: six>=1.10.0 in c:\users\xxx\appdata\roaming\python\python36\site-packages (from tensorflow)
Requirement already up-to-date: keras-preprocessing>=1.0.5 in c:\programdata\anaconda3\lib\site-packages (from tensorflow)
Requirement already up-to-date: tensorboard<1.14.0,>=1.13.0 in c:\programdata\anaconda3\lib\site-packages (fro m tensorflow)
Requirement already up-to-date: astor>=0.6.0 in c:\users\xxxx\appdata\roaming\python\python36\site-package s (from tensorflow)
Requirement already up-to-date: termcolor>=1.1.0 in c:\programdata\anaconda3\lib\site-packages (from tensorflo w)
Requirement already up-to-date: wheel>=0.26 in c:\users\xxxx\appdata\roaming\python\python36\site-packages (from tensorflow)
Requirement already up-to-date: keras-applications>=1.0.6 in c:\programdata\anaconda3\lib\site-packages (from tensorflow)
Requirement already up-to-date: grpcio>=1.8.6 in c:\users\xxxx\appdata\roaming\python\python36\site-packag es (from tensorflow)
Requirement already up-to-date: protobuf>=3.6.1 in c:\programdata\anaconda3\lib\site-packages (from tensorflow )
Which I interpret as everything is installed and upgraded ( am I wrong here ? )
Now my issue is that when I try to import Tensorflow let say in Jupyter notebook , I get the following error message
ImportError: Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\ProgramData\Anaconda3\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\ProgramData\Anaconda3\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
Any idea what could be the reason and what i need to change to get tensorflow up and running ?
Thanks guys in advance for any help with the above issue .

I've solved this problem by downgrading tensorflow to version 2.0 using this command:
pip install tensorflow==2.0
and then use like this :
from tensorflow.keras.applications import vgg19
from tensorflow.keras.models import load_model
I hope it helps.

Related

Problems installing pyinstaller

I tried pip install and received this:
Requirement already satisfied: pyinstaller in c:\users\sinwe\appdata\local\programs\python\python39\lib\site-packages (4.5.1)
Requirement already satisfied: altgraph in c:\users\sinwe\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (0.17)
Requirement already satisfied: pyinstaller-hooks-contrib>=2020.6 in c:\users\sinwe\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (2021.2)
Requirement already satisfied: pywin32-ctypes>=0.2.0 in c:\users\sinwe\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (0.2.0)
Requirement already satisfied: pefile>=2017.8.1 in c:\users\sinwe\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (2021.5.24)
Requirement already satisfied: setuptools in c:\users\sinwe\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (49.2.1)
Requirement already satisfied: future in c:\users\sinwe\appdata\local\programs\python\python39\lib\site-packages (from pefile>=2017.8.1->pyinstaller) (0.18.2)
I then installed using setup.py
To check whether it is installed, in cmd:
pyinstaller --version
and I received this:
Traceback (most recent call last):
File "C:\Users\sinwe\AppData\Local\Programs\Python\Python39\Scripts\pyinstaller-script.py", line 33, in <module>
sys.exit(load_entry_point('pyinstaller==4.5.1', 'console_scripts', 'pyinstaller')())
File "C:\Users\sinwe\AppData\Local\Programs\Python\Python39\Scripts\pyinstaller-script.py", line 25, in importlib_load_entry_point
return next(matches).load()
StopIteration
Could anyone provide a solution?
Try to uninstall pyinstaller using:
pip uninstall pyinstaller
in the cmd, and upgrade pip:
pip install --upgrade pip
And then try to install pyinstaller again:
pip install pyinstaller

I need help in installing tensorflow, keras, and pytorch

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 requires TensorFlow 2.2 or higher. Install TensorFlow via
pip install TensorFlow
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

Can't install tensorflow properly

System information
Windows10 64bit
Python version 3.8
Tryed to install in a virtualenv using conda and pip
CUDA/cuDNN version: 9.2
GPU model and memory: NVIDIA GeForce GTX 950M
Problem
I created a virtual environment and there I started to install necessary packages. When I tried to run a script that used tensorflow, it could not imported it.
After searching for this, I tried to import it in jupyter notebook, but it didn't work.
Then, I tried to add this to my code but it didn't work either:
tf.compat.v1.enable_eager_execution(
config=None, device_policy=None, execution_mode=None
)
I tried to install tensorflow in that environment using first conda and then pip.
Sequence of commands / steps executed
-Running the script:
d:\software\anaconda_envs\sweaver\avgn_paper-vizmerge\avgn\utils\json.py:64: ResourceWarning: unclosed file <_io.TextIOWrapper name='D:\\Software\\Anaconda_envs\\sweaver\\avgn_paper-vizmerge\\data\\processed\\sociable_weaver_damelio\\2020-08-21_09-35-13\\JSON\\2018-10-19_09-00-00-000001.JSON' mode='r' encoding='cp1252'>
return json.load(open(json_loc), object_pairs_hook=OrderedDict)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
HBox(children=(FloatProgress(value=0.0, description='loading json', max=1.0, style=ProgressStyle(description_w…
[Parallel(n_jobs=-1)]: Using backend LokyBackend with 8 concurrent workers.
[Parallel(n_jobs=-1)]: Done 1 out of 1 | elapsed: 3.0s finished
HBox(children=(FloatProgress(value=0.0, description='getting unique individuals', max=1.0, style=ProgressStyle…
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-43-e50f361ab3a6> in <module>
1 # create a dataset object
----> 2 dataset = DataSet(DATASET_ID, hparams = hparams)
d:\software\anaconda_envs\sweaver\avgn_paper-vizmerge\avgn\dataset.py in __init__(self, DATASET_ID, hparams, default_rate, build_mel_matrix)
43
44 if build_mel_matrix:
---> 45 self.build_mel_matrix()
46
47 def _get_wav_json_files(self):
d:\software\anaconda_envs\sweaver\avgn_paper-vizmerge\avgn\dataset.py in build_mel_matrix(self, rate)
66 if rate is None:
67 rate = self.sample_json["samplerate_hz"]
---> 68 self.mel_matrix = prepare_mel_matrix(self.hparams, rate)
69
70 def _get_unique_individuals(self):
d:\software\anaconda_envs\sweaver\avgn_paper-vizmerge\avgn\signalprocessing\filtering.py in prepare_mel_matrix(hparams, rate, return_numpy, GPU_backend)
71 os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # see issue #152
72 os.environ["CUDA_VISIBLE_DEVICES"] = ""
---> 73 import tensorflow as tf
74
75 tf.compat.v1.enable_eager_execution(
ModuleNotFoundError: No module named 'tensorflow'
-Import it in jupyter notebook
import sys
!conda install --yes --prefix {sys.prefix} tensorflow
UnsatisfiableError: The following specifications were found to be incompatible with the existing python installation in your environment:
Specifications:
- tensorflow -> python[version'3.5.*|3.6.*|3.7.*'
Your python: python=3.8
The following specifications were found to be incompatible with your CUDA driver:
- feature:/win-64::__cuda==9.2=0
Your installed CUDA driver is: 9.2
-When I tried to install it through conda:
(D:\Software\Anaconda_envs\sweaver) D:\Software\Anaconda_envs\sweaver>conda install tensorflow
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: -
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
Examining #/win-64::__cuda==9.2=0: 67%|████████████████████████████████▋ | 2/3 [00:00<00:00, 18.17it/s]|Examining conflict for __cuda: 67%|███████████████████████████████████▎ | 2/3 [00:00<00:00, 3.77it/s]|failed
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
Specifications:
- tensorflow -> python[version='3.5.*|3.6.*|3.7.*']
Your python: python=3.8
If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.
The following specifications were found to be incompatible with your system:
- feature:/win-64::__cuda==9.2=0
- feature:|#/win-64::__cuda==9.2=0
Your installed version is: 9.2
-When I tried to install it using pip:
(D:\Software\Anaconda_envs\sweaver) D:\Software\Anaconda_envs\sweaver>pip install tensorflow
Collecting tensorflow
Using cached tensorflow-2.3.0-cp38-cp38-win_amd64.whl (342.5 MB)
Requirement already satisfied: wrapt>=1.11.1 in d:\software\anaconda_envs\sweaver\lib\site-packages (from tensorflow) (1.11.2)
Collecting keras-preprocessing<1.2,>=1.1.1
Using cached Keras_Preprocessing-1.1.2-py2.py3-none-any.whl (42 kB)
Collecting tensorboard<3,>=2.3.0
Using cached tensorboard-2.3.0-py3-none-any.whl (6.8 MB)
Requirement already satisfied: grpcio>=1.8.6 in d:\software\anaconda_envs\sweaver\lib\site-packages (from tensorflow) (1.31.0)
Collecting numpy<1.19.0,>=1.16.0
Using cached numpy-1.18.5-cp38-cp38-win_amd64.whl (12.8 MB)
Collecting opt-einsum>=2.3.2
Using cached opt_einsum-3.3.0-py3-none-any.whl (65 kB)
Requirement already satisfied: absl-py>=0.7.0 in d:\software\anaconda_envs\sweaver\lib\site-packages (from tensorflow) (0.10.0)
Requirement already satisfied: wheel>=0.26 in d:\software\anaconda_envs\sweaver\lib\site-packages (from tensorflow) (0.34.2)
Collecting scipy==1.4.1
Using cached scipy-1.4.1-cp38-cp38-win_amd64.whl (31.0 MB)
Collecting astunparse==1.6.3
Using cached astunparse-1.6.3-py2.py3-none-any.whl (12 kB)
Requirement already satisfied: h5py<2.11.0,>=2.10.0 in d:\software\anaconda_envs\sweaver\lib\site-packages (from tensorflow) (2.10.0)
Collecting protobuf>=3.9.2
Using cached protobuf-3.13.0-py2.py3-none-any.whl (438 kB)
Collecting google-pasta>=0.1.8
Using cached google_pasta-0.2.0-py3-none-any.whl (57 kB)
Requirement already satisfied: tensorflow-estimator<2.4.0,>=2.3.0 in d:\software\anaconda_envs\sweaver\lib\site-packages (from tensorflow) (2.3.0)
Requirement already satisfied: gast==0.3.3 in d:\software\anaconda_envs\sweaver\lib\site-packages (from tensorflow) (0.3.3)
Requirement already satisfied: six>=1.12.0 in d:\software\anaconda_envs\sweaver\lib\site-packages (from tensorflow) (1.15.0)
Processing c:\users\bf\appdata\local\pip\cache\wheels\a0\16\9c\5473df82468f958445479c59e784896fa24f4a5fc024b0f501\termcolor-1.1.0-py3-none-any.whl
Requirement already satisfied: werkzeug>=0.11.15 in d:\software\anaconda_envs\sweaver\lib\site-packages (from tensorboard<3,>=2.3.0->tensorflow) (1.0.1)
Collecting markdown>=2.6.8
Using cached Markdown-3.2.2-py3-none-any.whl (88 kB)
Collecting google-auth-oauthlib<0.5,>=0.4.1
Using cached google_auth_oauthlib-0.4.1-py2.py3-none-any.whl (18 kB)
Requirement already satisfied: setuptools>=41.0.0 in d:\software\anaconda_envs\sweaver\lib\site-packages (from tensorboard<3,>=2.3.0->tensorflow) (49.6.0.post20200814)
Collecting tensorboard-plugin-wit>=1.6.0
Using cached tensorboard_plugin_wit-1.7.0-py3-none-any.whl (779 kB)
Requirement already satisfied: requests<3,>=2.21.0 in d:\software\anaconda_envs\sweaver\lib\site-packages (from tensorboard<3,>=2.3.0->tensorflow) (2.24.0)
Requirement already satisfied: google-auth<2,>=1.6.3 in d:\software\anaconda_envs\sweaver\lib\site-packages (from tensorboard<3,>=2.3.0->tensorflow) (1.20.1)
Collecting requests-oauthlib>=0.7.0
Using cached requests_oauthlib-1.3.0-py2.py3-none-any.whl (23 kB)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in d:\software\anaconda_envs\sweaver\lib\site-packages (from requests<3,>=2.21.0->tensorboard<3,>=2.3.0->tensorflow) (1.25.10)
Requirement already satisfied: certifi>=2017.4.17 in d:\software\anaconda_envs\sweaver\lib\site-packages (from requests<3,>=2.21.0->tensorboard<3,>=2.3.0->tensorflow) (2020.6.20)
Requirement already satisfied: chardet<4,>=3.0.2 in d:\software\anaconda_envs\sweaver\lib\site-packages (from requests<3,>=2.21.0->tensorboard<3,>=2.3.0->tensorflow) (3.0.4)
Requirement already satisfied: idna<3,>=2.5 in d:\software\anaconda_envs\sweaver\lib\site-packages (from requests<3,>=2.21.0->tensorboard<3,>=2.3.0->tensorflow) (2.10)
Requirement already satisfied: pyasn1-modules>=0.2.1 in d:\software\anaconda_envs\sweaver\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 d:\software\anaconda_envs\sweaver\lib\site-packages (from google-auth<2,>=1.6.3->tensorboard<3,>=2.3.0->tensorflow) (4.5)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in d:\software\anaconda_envs\sweaver\lib\site-packages (from google-auth<2,>=1.6.3->tensorboard<3,>=2.3.0->tensorflow) (4.1.1)
Collecting oauthlib>=3.0.0
Using cached oauthlib-3.1.0-py2.py3-none-any.whl (147 kB)
Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in d:\software\anaconda_envs\sweaver\lib\site-packages (from pyasn1-modules>=0.2.1->google-auth<2,>=1.6.3->tensorboard<3,>=2.3.0->tensorflow) (0.4.8)
ERROR: Error while checking for conflicts. Please file an issue on pip's issue tracker: https://github.com/pypa/pip/issues/new
Traceback (most recent call last):
File "D:\Software\Anaconda_envs\sweaver\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3021, in _dep_map
return self.__dep_map
File "D:\Software\Anaconda_envs\sweaver\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2815, in __getattr__
raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Software\Anaconda_envs\sweaver\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3012, in _parsed_pkg_info
return self._pkg_info
File "D:\Software\Anaconda_envs\sweaver\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2815, in __getattr__
raise AttributeError(attr)
AttributeError: _pkg_info
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Software\Anaconda_envs\sweaver\lib\site-packages\pip\_internal\commands\install.py", line 535, in _determine_conflicts
return check_install_conflicts(to_install)
File "D:\Software\Anaconda_envs\sweaver\lib\site-packages\pip\_internal\operations\check.py", line 108, in check_install_conflicts
package_set, _ = create_package_set_from_installed()
File "D:\Software\Anaconda_envs\sweaver\lib\site-packages\pip\_internal\operations\check.py", line 50, in create_package_set_from_installed
package_set[name] = PackageDetails(dist.version, dist.requires())
File "D:\Software\Anaconda_envs\sweaver\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2736, in requires
dm = self._dep_map
File "D:\Software\Anaconda_envs\sweaver\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3023, in _dep_map
self.__dep_map = self._compute_dependencies()
File "D:\Software\Anaconda_envs\sweaver\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3032, in _compute_dependencies
for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
File "D:\Software\Anaconda_envs\sweaver\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3014, in _parsed_pkg_info
metadata = self.get_metadata(self.PKG_INFO)
File "D:\Software\Anaconda_envs\sweaver\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1420, in get_metadata
value = self._get(path)
File "D:\Software\Anaconda_envs\sweaver\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1616, in _get
with open(path, 'rb') as stream:
FileNotFoundError: [Errno 2] No such file or directory: 'd:\\software\\anaconda_envs\\sweaver\\lib\\site-packages\\numpy-1.19.1.dist-info\\METADATA'
Installing collected packages: numpy, keras-preprocessing, protobuf, markdown, oauthlib, requests-oauthlib, google-auth-oauthlib, tensorboard-plugin-wit, tensorboard, opt-einsum, scipy, astunparse, google-pasta, termcolor, tensorflow
Attempting uninstall: numpy
Found existing installation: numpy 1.19.1
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'd:\\software\\anaconda_envs\\sweaver\\lib\\site-packages\\numpy-1.19.1.dist-info\\RECORD'
Maybe it's a problem of compatibility between tensorflow and numpy? But the file 'd:\software\anaconda_envs\sweaver\lib\site-packages\numpy-1.19.1.dist-info\RECORD' actually does not exist.
I searched in my packages and there is a folder of numpy, numpy-1.18.5.dist-info and numpy-1.19.1.dist-info, but inside the last one, there are only two files: LICENSES_bundled.txt and REQUESTED.
Then, I deleted the folder numpy-1.19.1dist-info and intalled tensorflow through the command line using --user to allow the installation, but it got installed in other place.
So, I use:
import sys
sys.path.append()
in every py file of tensorflow but still didn't work. Also one of the files (pywrap_tensorflow_internal.py) was empty, showing that there was some problem in installation.
Hope you can help me.
Sometimes conda has issues. I had the same problem. All you have to do is create a new environment again and try do downgrade your Python version to 3.7

I have installed Tensorflow but I can not import it in Python: ImportError: cannot import name 'descriptor' from 'google.protobuf' (unknown location) [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I have installed Tensorflow successfully in my Windows 10 Notebook:
(base) C:\WINDOWS\system32>pip install tensorflow-gpu
Requirement already satisfied: tensorflow-gpu in c:\users\alienware\anaconda3\lib\site-packages (2.0.0)
Requirement already satisfied: gast==0.2.2 in c:\users\alienware\anaconda3\lib\site-packages (from tensorflow-gpu) (0.2.2)
Requirement already satisfied: opt-einsum>=2.3.2 in c:\users\alienware\anaconda3\lib\site-packages (from tensorflow-gpu) (3.1.0)
Requirement already satisfied: numpy<2.0,>=1.16.0 in c:\users\alienware\anaconda3\lib\site-packages (from tensorflow-gpu) (1.16.5)
Requirement already satisfied: keras-applications>=1.0.8 in c:\users\alienware\anaconda3\lib\site-packages (from tensorflow-gpu) (1.0.8)
Requirement already satisfied: keras-preprocessing>=1.0.5 in c:\users\alienware\anaconda3\lib\site-packages (from tensorflow-gpu) (1.1.0)
Requirement already satisfied: six>=1.10.0 in c:\users\alienware\anaconda3\lib\site-packages (from tensorflow-gpu) (1.12.0)
Requirement already satisfied: termcolor>=1.1.0 in c:\users\alienware\anaconda3\lib\site-packages (from tensorflow-gpu) (1.1.0)
Requirement already satisfied: tensorflow-estimator<2.1.0,>=2.0.0 in c:\users\alienware\anaconda3\lib\site-packages (from tensorflow-gpu) (2.0.0)
Requirement already satisfied: grpcio>=1.8.6 in c:\users\alienware\anaconda3\lib\site-packages (from tensorflow-gpu) (1.24.1)
Requirement already satisfied: google-pasta>=0.1.6 in c:\users\alienware\anaconda3\lib\site-packages (from tensorflow-gpu) (0.1.7)
Requirement already satisfied: wheel>=0.26 in c:\users\alienware\anaconda3\lib\site-packages (from tensorflow-gpu) (0.33.6)
Requirement already satisfied: protobuf>=3.6.1 in c:\users\alienware\anaconda3\lib\site-packages (from tensorflow-gpu) (3.10.0)
Requirement already satisfied: wrapt>=1.11.1 in c:\users\alienware\anaconda3\lib\site-packages (from tensorflow-gpu) (1.11.2)
Requirement already satisfied: tensorboard<2.1.0,>=2.0.0 in c:\users\alienware\anaconda3\lib\site-packages (from tensorflow-gpu) (2.0.0)
Requirement already satisfied: astor>=0.6.0 in c:\users\alienware\anaconda3\lib\site-packages (from tensorflow-gpu) (0.8.0)
Requirement already satisfied: absl-py>=0.7.0 in c:\users\alienware\anaconda3\lib\site-packages (from tensorflow-gpu) (0.8.1)
Requirement already satisfied: h5py in c:\users\alienware\anaconda3\lib\site-packages (from keras-applications>=1.0.8->tensorflow-gpu) (2.10.0)
Requirement already satisfied: setuptools in c:\users\alienware\anaconda3\lib\site-packages (from protobuf>=3.6.1->tensorflow-gpu) (41.4.0)
Requirement already satisfied: werkzeug>=0.11.15 in c:\users\alienware\anaconda3\lib\site-packages (from tensorboard<2.1.0,>=2.0.0->tensorflow-gpu) (0.16.0)
Requirement already satisfied: markdown>=2.6.8 in c:\users\alienware\anaconda3\lib\site-packages (from tensorboard<2.1.0,>=2.0.0->tensorflow-gpu) (3.1.1)
However, when I try to import it in Python I get an error message:
C:\WINDOWS\system32>conda activate base
(base) C:\WINDOWS\system32>python
Python 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tensorflow'
>>>
When I run conda list I get:
Update
I followed Rachayita's advise below but I have installed Tensorflow 1.4 and I want tensorflow-gpu 2.0
From my base Anaconda environment I uninstalled tensorflow-gpu 2.0 which was installed and then re-installed it with pip following the official tensorflow documentation.
When I tried to import it in python I got the following error message:
(base) C:\Users\Alienware>python
Python 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
2019-10-22 23:35:53.390099: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Alienware\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 98, in <module>
from tensorflow_core import *
File "C:\Users\Alienware\Anaconda3\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\Users\Alienware\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
module = self._load()
File "C:\Users\Alienware\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "C:\Users\Alienware\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\Alienware\Anaconda3\lib\site-packages\tensorflow_core\python\__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "C:\Users\Alienware\Anaconda3\lib\site-packages\tensorflow_core\core\framework\graph_pb2.py", line 7, in <module>
from google.protobuf import descriptor as _descriptor
ImportError: cannot import name 'descriptor' from 'google.protobuf' (unknown location)
You should install it with Anaconda by running the following commands on the Anaconda prompt:
> conda create -n tf-gpu tensorflow-gpu
> conda activate tf-gpu
Here is the complete documentation - https://docs.anaconda.com/anaconda/user-guide/tasks/tensorflow/
Did you run "pip install tensorflow-gpu" after "conda activate base"?
If not then that is what you need to do since tensorflow will not be installed in your virtual enviroment "base".
You have to install tensorflow using pip install tensorflow and not tensorflow-gpu

Module 'Tabula' not found in python spyder

I tried to run this code:
from tabula import read_pdf
df = read_pdf("../pdf/Documentacao.pdf")
print(df)
And got this:
runfile('C:/Users/Henri/git/Git/PDS1/dev/lib/planilhas01.py', wdir='C:/Users/Henri/git/Git/PDS1/dev/lib')
Traceback (most recent call last):
File "<ipython-input-4-e12a8a26bbfa>", line 1, in <module>
runfile('C:/Users/Henri/git/Git/PDS1/dev/lib/planilhas01.py', wdir='C:/Users/Henri/git/Git/PDS1/dev/lib')
File "C:\Users\Henri\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
execfile(filename, namespace)
File "C:\Users\Henri\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/Henri/git/Git/PDS1/dev/lib/planilhas01.py", line 1, in <module>
from tabula import read_pdf
ModuleNotFoundError: No module named 'tabula'
This is what my anaconda says:
(base) C:\Users\Henri>pip install tabula-py
Requirement already satisfied: tabula-py in c:\users\henri\miniconda3\lib\site-packages (1.4.1)
Requirement already satisfied: pandas in c:\users\henri\miniconda3\lib\site-packages (from tabula-py) (0.25.1)
Requirement already satisfied: distro in c:\users\henri\miniconda3\lib\site-packages (from tabula-py) (1.4.0)
Requirement already satisfied: numpy in c:\users\henri\miniconda3\lib\site-packages (from tabula-py) (1.17.2)
Requirement already satisfied: python-dateutil>=2.6.1 in c:\users\henri\miniconda3\lib\site-packages (from pandas->tabula-py) (2.8.0)
Requirement already satisfied: pytz>=2017.2 in c:\users\henri\miniconda3\lib\site-packages (from pandas->tabula-py) (2019.3)
Requirement already satisfied: six>=1.5 in c:\users\henri\miniconda3\lib\site-packages (from python-dateutil>=2.6.1->pandas->tabula-py) (1.12.0)
I think is something about directories, but what ??
(base) C:\Users\Henri>pip install tabula-py
Requirement already satisfied: tabula-py in c:\users\henri\miniconda3\lib\site-packages (1.4.1)
I think is installed, just you need to make sure which Python environment yre installing it because maybe is installed in python3 directory, not python2.

Categories

Resources