I can't import TF2 in PyCharm. I installed it with reh requirements.txt and tried different Versions (latest and 2.0.0). However when I want to import it I get the following error:
Traceback (most recent call last):
File "C:/Users/A704601/PycharmProjects/Projekt/src/test.py", line 3, in <module>
import tensorflow as tf
File "C:\Users\A704601\PycharmProjects\Projekt\venv\lib\site-packages\tensorflow\__init__.py", line 98, in <module>
from tensorflow_core import *
File "C:\Users\A704601\PycharmProjects\Projekt\venv\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\Users\A704601\PycharmProjects\Projekt\venv\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
module = self._load()
File "C:\Users\A704601\PycharmProjects\Projekt\venv\lib\site-packages\tensorflow\__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "C:\Users\A704601\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\A704601\PycharmProjects\Projekt\venv\lib\site-packages\tensorflow_core\python\__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "C:\Users\A704601\PycharmProjects\Projekt\venv\lib\site-packages\tensorflow_core\core\framework\graph_pb2.py", line 7, in <module>
from google.protobuf import descriptor as _descriptor
File "C:\Users\A704601\PycharmProjects\Projekt\venv\lib\site-packages\google\protobuf\descriptor.py", line 47, in <module>
from google.protobuf.pyext import _message
ImportError: DLL load failed: Die angegebene Prozedur wurde nicht gefunden.
I have the latest Version of Windows 10 and PyCharm. I use Python 3.6 and I do not have a GPU but my CPU supports AVX. Furthermore this solution I found did not solve the problem:
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
As Rumo mentioned in the comments installing protobuf==3.6.0 fixed the issue
Related
This is what I am currently running in the PyCharm Project
Windows 10
PyCharm 2020.1.1 (Community Edition)
Python 3.7.7
TensorFlow 2.2.0
This is what I have in codes in terms of imports:
import math
import pandas_datareader as web
import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
from keras.models import Sequential
from keras.layers import Dense, LSTM
import matplotlib.pyplot as plt
plt.style.use('fivethirtyeight')
Here are the errors......
H:\Python\AI\venv\lib\site-packages\pandas_datareader\compat\__init__.py:7:
FutureWarning: pandas.util.testing is deprecated. Use the functions in
the public API at pandas.testing instead. from pandas.util.testing
import assert_frame_equal Using TensorFlow backend. Traceback (most
recent call last): File
"H:\Python\AI\venv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",
line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import * File "H:\Python\AI\venv\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",
line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper() File "H:\Python\AI\venv\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:\Users\Chan\AppData\Local\Programs\Python\Python37\lib\imp.py",
line 242, in load_module
return load_dynamic(name, filename, file) File "C:\Users\Chan\AppData\Local\Programs\Python\Python37\lib\imp.py",
line 342, in load_dynamic
return _load(spec) ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "H:/Python/AI/LSMT.py", line
7, in <module>
from keras.models import Sequential File "H:\Python\AI\venv\lib\site-packages\keras\__init__.py", line 3, in
<module>
from . import utils File "H:\Python\AI\venv\lib\site-packages\keras\utils\__init__.py", line 6,
in <module>
from . import conv_utils File "H:\Python\AI\venv\lib\site-packages\keras\utils\conv_utils.py", line
9, in <module>
from .. import backend as K File "H:\Python\AI\venv\lib\site-packages\keras\backend\__init__.py", line
1, in <module>
from .load_backend import epsilon File "H:\Python\AI\venv\lib\site-packages\keras\backend\load_backend.py",
line 90, in <module>
from .tensorflow_backend import * File "H:\Python\AI\venv\lib\site-packages\keras\backend\tensorflow_backend.py",
line 5, in <module>
import tensorflow as tf File "H:\Python\AI\venv\lib\site-packages\tensorflow\__init__.py", line 41,
in <module>
from tensorflow.python.tools import module_util as _module_util File
"H:\Python\AI\venv\lib\site-packages\tensorflow\python\__init__.py",
line 50, in <module>
from tensorflow.python import pywrap_tensorflow File "H:\Python\AI\venv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",
line 69, in <module>
raise ImportError(msg) ImportError: Traceback (most recent call last): File
"H:\Python\AI\venv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",
line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import * File "H:\Python\AI\venv\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",
line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper() File "H:\Python\AI\venv\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:\Users\Chan\AppData\Local\Programs\Python\Python37\lib\imp.py",
line 242, in load_module
return load_dynamic(name, filename, file) File "C:\Users\Chan\AppData\Local\Programs\Python\Python37\lib\imp.py",
line 342, 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.
Process finished with exit code 1
I have to tried uninstall, re-install, upgrade, change from Python 3.8 to 3.7, ..., but I still get an error.
It was the version issue.
I changed TensorFlow to 1.15, cudart64_100 error showed up.
I then installed CUDA 10.1 with cudart64_101.dll problem still exist.
Then I followed this post....
https://www.joe0.com/2019/10/19/how-resolve-tensorflow-2-0-error-could-not-load-dynamic-library-cudart64_100-dll-dlerror-cudart64_100-dll-not-found/
Downloaded, extracted the cudart64_100.dll provided by the OP....
Reinstalled TensorFlow 2.0.0.
Restarted my computer.
Problem Solved.
Only with the Future Warning; but no big deal. I can now run my program.
\pandas_datareader\compat\__init__.py:7: FutureWarning: pandas.util.testing is deprecated. Use the functions in the public API at pandas.testing instead.
from pandas.util.testing import assert_frame_equal
Using TensorFlow backend.
I am using Anaconda environment on Windows 10. I have installed tensorflow-gpu using pip and when I try to import tensorflow, I get this import error below. I have tried to use cpu version of tensorflow and to reinstall all packages with new conda environment. My python is version 3.7 and tensorflow-gpu version 2.1.0.
>>> import tensorflow as tf
Traceback (most recent call last):
File "C:\Users\ossik\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\ossik\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\ossik\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\ossik\anaconda3\envs\tensorflow-gpu\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\ossik\anaconda3\envs\tensorflow-gpu\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: Määritettyä osaa ei löydy.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\ossik\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\__init__.py", line 101, in <module>
from tensorflow_core import *
File "C:\Users\ossik\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\Users\ossik\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
module = self._load()
File "C:\Users\ossik\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "C:\Users\ossik\anaconda3\envs\tensorflow-gpu\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\ossik\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow_core\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\ossik\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\ossik\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\ossik\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\ossik\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\ossik\anaconda3\envs\tensorflow-gpu\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\ossik\anaconda3\envs\tensorflow-gpu\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: Määritettyä osaa ei löydy.
Failed to load the native TensorFlow runtime.
Do you have any idea what causes this error?
Try to downgrade and install tensorflow.
pip install tensorflow==2.0
if you use gpu
pip install --upgrade tensorflow-gpu==2.0
or try downloading these visual studio files
click here
This could be because you have a CPU(probably old), which can not support AVX instructions (for example, Intel Pentium or similar). You could solve this problem using this approach:
pip3 uninstall tensorflow
Go here: link with tensorflow 2.1.0 wheels which has been precompiled with SSE2 instructions.
Download wheel to your project, then install tensorflow using pip install <filename.wheel>.
And try again - error should be solved
I couldn't solve my problem with previous similar questions.
I installed tensorflow-gpu 2.0.0 along python 3.6, cuda 10 and cudnn 7.4.2.
now according to this page, these are compatible and tested:
https://www.tensorflow.org/install/source_windows#tested_build_configurations
when importing, this is the error its returning:
>>> import tensorflow
2020-02-05 15:17:43.900905: 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:\p6\lib\site-packages\tensorflow\__init__.py", line 98, in <module>
from tensorflow_core import *
File "C:\p6\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\p6\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
module = self._load()
File "C:\p6\lib\site-packages\tensorflow\__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "C:\p6\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\p6\lib\site-packages\tensorflow_core\python\__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "C:\p6\lib\site-packages\tensorflow_core\core\framework\graph_pb2.py", line 7, in <module>
from google.protobuf import descriptor as _descriptor
File "C:\p6\lib\site-packages\google\protobuf\descriptor.py", line 47, in <module>
from google.protobuf.pyext import _message
ImportError: DLL load failed: The specified procedure could not be found.
I have already tried reinstalling all of them. i've also checked and the PATH is also added in environment variables. got these errors on latest version of python, tensorflow-gpu, cuda, cudnn too.
could someone please help me with this?
There are 4 possible reasons for Tensorflow installation issues in windows
You need to install the MSVC 2019 redistributable from here
Your CPU does not support AVX2 instructions
Your CPU/Python is on 32 bits
There is a library that is in a different location/not installed on your system that cannot be loaded.
I'm new to Jython and PyDev. I need to run my Python code in Eclipse.
The Python code works in Spyder/Jupyter Notebooks. When I run the programm as Jython Run/Python Run, an error pops up.
How can I solve this problem?
console: Failed to install '': java.nio.charset.UnsupportedCharsetException: cp0.
C:\Users\Hai Mi\Anaconda3\Lib\site-packages\numpy\__init__.py:140: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
from . import _distributor_init
Traceback (most recent call last):
File "C:\Users\Hai Mi\workspace\Camunda\learning_classify.py", line 7, in <module>
import nltk
File "C:\Users\Hai Mi\Anaconda3\Lib\site-packages\nltk\__init__.py", line 129, in <module>
from nltk.collocations import *
File "C:\Users\Hai Mi\Anaconda3\Lib\site-packages\nltk\collocations.py", line 40, in <module>
from nltk.metrics import ContingencyMeasures, BigramAssocMeasures, TrigramAssocMeasures, QuadgramAssocMeasures
File "C:\Users\Hai Mi\Anaconda3\Lib\site-packages\nltk\metrics\__init__.py", line 16, in <module>
from nltk.metrics.scores import (
File "C:\Users\Hai Mi\Anaconda3\Lib\site-packages\nltk\metrics\scores.py", line 18, in <module>
from scipy.stats.stats import betai
File "C:\Users\Hai Mi\Anaconda3\Lib\site-packages\nltk\metrics\scores.py", line 18, in <module>
from scipy.stats.stats import betai
File "C:\Users\Hai Mi\Anaconda3\Lib\site-packages\scipy\__init__.py", line 62, in <module>
from numpy import show_config as show_numpy_config
File "C:\Users\Hai Mi\Anaconda3\Lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import core
File "C:\Users\Hai Mi\Anaconda3\Lib\site-packages\numpy\core\__init__.py", line 24, in <module>
from . import multiarray
File "C:\Users\Hai Mi\Anaconda3\Lib\site-packages\numpy\core\__init__.py", line 24, in <module>
from . import multiarray
File "C:\Users\Hai Mi\Anaconda3\Lib\site-packages\numpy\core\multiarray.py", line 14, in <module>
from . import overrides
File "C:\Users\Hai Mi\Anaconda3\Lib\site-packages\numpy\core\overrides.py", line 166
SyntaxError: unqualified exec is not allowed in function 'decorator' because it contains free variables
Looks like a similar issue was discussed here
How do I fix UnsupportedCharsetException in Eclipse Kepler/Luna with Jython/PyDev?
and adding
-Dpython.console.encoding=UTF-8
to the Run Configurations -> VM arguments could be a solution.
I've seen that a lot of questions have already asked this, but it seems to be very specific as none of the answers seem to work.
Let me explain the steps that I have taken to install everything:
I started with installing Python 3.7.4 and installed tensorflow after that. The command I ran is: pip install -q tensorflow=2.0.0-alpha0. This didn't seem to work and I soon figured out that this is because of the version of Python. Tensorflow doesn't support 3.7 yet, so I installed Python 3.6.0.
I then installed tensorflow again with the following command: pip3.6 install tensorflow. Note the explicit pip3.6. I then select python 3.6 in the configuration of Visual Code's Python Debugger. I ran the following code (single line) and gave me the following error:
Python
import tensorflow as tf
Output
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python36\lib\site-packages\tensorflow\__init__.py", line 98, in <module>
from tensorflow_core import *
File "C:\Program Files\Python36\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\Program Files\Python36\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
module = self._load()
File "C:\Program Files\Python36\lib\site-packages\tensorflow\__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "C:\Program Files\Python36\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Program Files\Python36\lib\site-packages\tensorflow_core\python\__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "C:\Program Files\Python36\lib\site-packages\tensorflow_core\core\framework\graph_pb2.py", line 7, in <module>
from google.protobuf import descriptor as _descriptor
File "C:\Program Files\Python36\lib\site-packages\google\protobuf\descriptor.py", line 47, in <module>
from google.protobuf.pyext import _message
ImportError: DLL load failed: The specified module could not be found.
After some searching, someone said that uninstalling tensorflow-estimator and tensorflow-gpu may work, because of unsupported gpu's. Even though I doubted this since I have an RTX 2080, I decided to give it a go, but I still got the same result.
I'm hoping any of you would be able to help me with this.
Thanks in advance!
UPDATE
After installing Anaconda and using conda to install my packages with (instead of pip) this issue has been resolved. However, a nice issue occurs. With the someline of code I get the following error (pretty much the same as the last one, but a different package module):
Traceback (most recent call last):
File "c:\Users\Meine Zeinstra\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\ptvsd_launcher.py", line 43, in <module>
main(ptvsdArgs)
File "c:\Users\Meine Zeinstra\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\lib\python\ptvsd\__main__.py", line 432, in main
run()
File "c:\Users\Meine Zeinstra\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\lib\python\ptvsd\__main__.py", line 316, in run_file
runpy.run_path(target, run_name='__main__')
File "C:\Users\Meine Zeinstra\.conda\envs\Python 3.6\lib\runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "C:\Users\Meine Zeinstra\.conda\envs\Python 3.6\lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "C:\Users\Meine Zeinstra\.conda\envs\Python 3.6\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "c:\Users\Meine Zeinstra\Documents\Projects\Python_Neural_Networks\Tutorial_1\Tutorial_1.py", line 1, in <module>
import tensorflow as tf
File "C:\Users\Meine Zeinstra\.conda\envs\Python 3.6\lib\site-packages\tensorflow\__init__.py", line 34, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\Meine Zeinstra\.conda\envs\Python 3.6\lib\site-packages\tensorflow\python\__init__.py", line 47, in <module>
import numpy as np
File "C:\Users\Meine Zeinstra\.conda\envs\Python 3.6\lib\site-packages\numpy\__init__.py", line 140, in <module>
from . import _distributor_init
File "C:\Users\Meine Zeinstra\.conda\envs\Python 3.6\lib\site-packages\numpy\_distributor_init.py", line 34, in <module>
from . import _mklinit
ImportError: DLL load failed: The specified module could not be found.
I hope you can help me with this new issue.