Install tensorflow on Windows in a virtual environment using anaconda - windows

I installed tensorflow on windows with anaconda following the tutorial in the official website.
But when I'm trying to import tensorflow on python, I have this error :
(tensorflow1) C:\Users\bromy>python
Python 3.5.4 |Anaconda, Inc.| (default, Nov 8 2017, 14:34:30) [MSC v.1900
64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "C:\Users\bromy\AppData\Local\conda\conda\envs\tensorflow1\lib\site-
packages\tensorflow\python\platform\self_check.py", line 75, in preload_check
ctypes.WinDLL(build_info.cudart_dll_name)
File "C:\Users\bromy\AppData\Local\conda\conda\envs\tensorflow1\lib\ctypes\__init__.py", line 351, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] Le module spécifié est introuvable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\bromy\AppData\Local\conda\conda\envs\tensorflow1\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "C:\Users\bromy\AppData\Local\conda\conda\envs\tensorflow1\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\bromy\AppData\Local\conda\conda\envs\tensorflow1\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 30, in <module>
self_check.preload_check()
File "C:\Users\bromy\AppData\Local\conda\conda\envs\tensorflow1\lib\site-packages\tensorflow\python\platform\self_check.py", line 82, in preload_check
% (build_info.cudart_dll_name, build_info.cuda_version_number))
ImportError: Could not find 'cudart64_80.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Download and install CUDA 8.0 from this URL: https://developer.nvidia.com/cuda-toolkit
I installed CUDA 8.0 but it didn't change anything
Do you have any ideas ?
Thank you

Related

Problem executing colcon build with Ros2 Foxy windows

I am getting the following tracebacks when I try to colcon build my workspace (I am using Ros2 Foxy in windows):
--- stderr: dynamixel_sdk_custom_interfaces
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\yimmi\AppData\Roaming\Python\Python38\site-packages\numpy\__init__.py", line 138, in <module>
from . import _distributor_init
File "C:\Users\yimmi\AppData\Roaming\Python\Python38\site-packages\numpy\_distributor_init.py", line 26, in <module>
WinDLL(os.path.abspath(filename))
File "ctypes\__init__.py", line 373, in __init__
OSError: [WinError 193] %1 no es una aplicaci¾n Win32 vßlida
CMake Error at C:/opt/ros/foxy/x64/share/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake:213 (message):
execute_process(C:/opt/ros/foxy/x64/python.exe -c 'import
numpy;print(numpy.get_include())') returned error code 1
Call Stack (most recent call first):
C:/opt/ros/foxy/x64/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include)
C:/opt/ros/foxy/x64/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions)
CMakeLists.txt:31 (rosidl_generate_interfaces)
Does anyone know how to solve it?
I notice this:
WinError 193
It looks your python runtime version is not match Numpy (CPU arch different?). Maybe you had installed Anacoda and it overrides the default python path.
You could try to check your python path.

getting import error, DLL file load failed, having python3.7 , installed tensorflow and keras, still the same errror

C:\Users\Raj Kubal>python
Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated. Libraries may fail to load. To activate this environment
please see https://conda.io/activation
>>> import tensorflow
Traceback (most recent call last):
File "C:\Users\Raj Kubal\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
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 "<stdin>", line 1, in <module>
File "C:\Users\Raj Kubal\anaconda3\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\Users\Raj Kubal\anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 40, in <module>
from tensorflow.python.eager import context
File "C:\Users\Raj Kubal\anaconda3\lib\site-packages\tensorflow\python\eager\context.py", line 35, in <module>
from tensorflow.python import pywrap_tfe
File "C:\Users\Raj Kubal\anaconda3\lib\site-packages\tensorflow\python\pywrap_tfe.py", line 28, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Raj Kubal\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 83, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Raj Kubal\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: The specified module could not be found.
Failed to load the native TensorFlow runtime.

Receive error when I installing gcutil in MacOS

I followed the instructions given by the official documents, but stuck in executing ./install.sh.
MacOS version:10.14.5 (18F132)
Python version:python2.7
After I download the zip file given by the gcloud website, I run the command ./install.sh.It told me
weiziyangdeMacBook-Pro:google-cloud-sdk weiziyang$ ./install.sh
Welcome to the Google Cloud SDK!
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
File "/usr/local/Cellar/python#2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/usr/local/Cellar/python#2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
File "/usr/local/Cellar/python#2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/usr/local/Cellar/python#2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
File "/usr/local/Cellar/python#2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/usr/local/Cellar/python#2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
File "/usr/local/Cellar/python#2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/usr/local/Cellar/python#2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
File "/usr/local/Cellar/python#2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/usr/local/Cellar/python#2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
File "/usr/local/Cellar/python#2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/usr/local/Cellar/python#2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
Traceback (most recent call last):
File "/Users/weiziyang/google-cloud-sdk/bin/bootstrapping/install.py", line 12, in <module>
import bootstrapping
File "/Users/weiziyang/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 32, in <module>
import setup # pylint:disable=g-import-not-at-top
File "/Users/weiziyang/google-cloud-sdk/bin/bootstrapping/setup.py", line 55, in <module>
from googlecloudsdk.core import properties
File "/Users/weiziyang/google-cloud-sdk/lib/googlecloudsdk/core/properties.py", line 27, in <module>
from googlecloudsdk.core import config
File "/Users/weiziyang/google-cloud-sdk/lib/googlecloudsdk/core/config.py", line 29, in <module>
from googlecloudsdk.core.util import files as file_utils
File "/Users/weiziyang/google-cloud-sdk/lib/googlecloudsdk/core/util/files.py", line 600, in <module>
class Checksum(object):
File "/Users/weiziyang/google-cloud-sdk/lib/googlecloudsdk/core/util/files.py", line 603, in Checksum
def __init__(self, algorithm=hashlib.sha256):
AttributeError: 'module' object has no attribute 'sha256'
I checked the module of python2, it provided that I haved installed hashlib correctly and has the attribute 'sha256'
weiziyangdeMacBook-Pro:google-cloud-sdk weiziyang$ python2
Python 2.7.10 (default, Feb 22 2019, 21:55:15)
[GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import hashlib
>>> hashlib.sha256
<built-in function openssl_sha256>
>>> exit()
I expect it can be installed correctly.
What worked for me was
brew uninstall all openssl and python packages listed by brew list
brew install python3
sudo ln -s /usr/local/bin/python3 /usr/local/bin/python and sudo ln -s /usr/local/bin/pip3 /usr/local/bin/pip
Installing gcloud with the Google Cloud SDK installer
https://cloud.google.com/sdk/docs/downloads-interactive
This is what I've done
Go to /usr/local/Cellar/ and remove all python folder except python#3.x.x then run ./install.sh again and then it will work.
The two Python versions you're using in the two examples above are different. The first Python you use is 2.7.15:
File "/usr/local/Cellar/python#2/2.7.15/...
And the second one is 2.7.10:
Python 2.7.10 (default, Feb 22 2019, 21:55:15)
It looks like your 2.7.15 installation of Python didn't install hashlib correctly (this can happen because of OpenSSL problems during installation, among other things). If I had to guess, the Cloud SDK install.sh script looks for a python executable, and python probably points to the broken 2.7.15 installation, while python2 probably points to the 2.7.10 installation on your system.
The problem is raised by the conflict of libssl.
So, the solution is that:
ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/

Py2app packaged pyqt4 programs can't run on other mac

I've written a python script and work well on my mac,but when I using py2app and run app with other mac.it's wrong.
Traceback (most recent call last):
File "/Users/dfrobot/Downloads/1.app/Contents/Resources/__boot__.py", line 137, in <module>
_run()
File "/Users/dfrobot/Downloads/1.app/Contents/Resources/__boot__.py", line 121, in _run
exec(compile(source, path, 'exec'), globals(), globals())
File "/Users/dfrobot/Downloads/1.app/Contents/Resources/1.py", line 4, in <module>
from PyQt4.QtCore import *
File "PyQt4/QtCore.pyc", line 14, in <module>
File "PyQt4/QtCore.pyc", line 10, in __load
File "imp.pyc", line 343, in load_dynamic
ImportError: dlopen(/Users/dfrobot/Downloads/1.app/Contents/Resources/lib/python3.5/lib-dynload/PyQt4/QtCore.so
, 2): Library not loaded: #rpath/QtCore.framework/Versions/5/QtCore
Referenced from: /Users/dfrobot/Downloads/1.app/Contents/Resources/lib/python3.5/lib-dynload/PyQt4/QtCore.so
Unexpectedly, when I installed QT on other mac, it work well. Why?

unable to get tensorflow working "KeyError: "Couldn't find field google.protobuf.GeneratedCodeInfo.Annotation.path"

I cannot get tensorflow to install, this is the error message i'm getting:
dhcp-3-6:~ M$ python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/tensorflow/__init__.py", line 23, in <module>
from tensorflow.python import *
File "/Library/Python/2.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "/Library/Python/2.7/site- packages/tensorflow/core/framework/graph_pb2.py", line 10, in <module>
from google.protobuf import descriptor_pb2
File "/Library/Python/2.7/site-packages/google/protobuf/descriptor_pb2.py", line 1495, in <module>
options=None),
File "/Library/Python/2.7/site-packages/google/protobuf/descriptor.py", line 505, in __new__
return _message.default_pool.FindFieldByName(full_name)
KeyError: "Couldn't find field google.protobuf.GeneratedCodeInfo.Annotation.path"
I have tried many forms but still cannot see how to get it working. Could you please give me some guidance?

Resources