GDAL conda install on Mac OS Sierra error - python-3.x

I'm trying to install gdal on my new computer in the anaconda environment using conda but having issues. All I've done so far is install Anaconda for python 3.6 and install gdal as described here + a few other libraries using both conda and pip.
Trouble is when I try to run from "osgeo import gdal" in the iPython console in spyder I get this error:
Traceback (most recent call last):
File "<ipython-input-3-a04b80bf4e65>", line 1, in <module>
from osgeo import gdal
File "/anaconda/lib/python3.6/site-packages/osgeo/__init__.py", line 21, in <module>
_gdal = swig_import_helper()
File "/anaconda/lib/python3.6/site-packages/osgeo/__init__.py", line 17, in swig_import_helper
_mod = imp.load_module('_gdal', fp, pathname, description)
File "/anaconda/lib/python3.6/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/anaconda/lib/python3.6/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: dlopen(/anaconda/lib/python3.6/site-packages/osgeo/_gdal.cpython-36m-darwin.so, 2): Library not loaded: #rpath/libicui18n.58.dylib
Referenced from: /anaconda/lib/libgdal.20.dylib
Reason: image not found
Am I missing a step?

Related

Tensorflow is not running on miniconda and jupyter notebook

I have installed tensorflow using pip install, but it does not run.
When trying to run it, I receive the following error message:
(base) PS C:\WINDOWS\system32> python
Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
File "C:\ProgramData\Miniconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\ProgramData\Miniconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper()
File "C:\ProgramData\Miniconda3\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, descript
ion)
File "C:\ProgramData\Miniconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\ProgramData\Miniconda3\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\ProgramData\Miniconda3\lib\site-packages\tensorflow\__init__.py", line 98, in <module>
from tensorflow_core import *
File "C:\ProgramData\Miniconda3\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\ProgramData\Miniconda3\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
module = self._load()
File "C:\ProgramData\Miniconda3\lib\site-packages\tensorflow\__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "C:\ProgramData\Miniconda3\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\ProgramData\Miniconda3\lib\site-packages\tensorflow_core\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\ProgramData\Miniconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\ProgramData\Miniconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\ProgramData\Miniconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\ProgramData\Miniconda3\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:\ProgramData\Miniconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\ProgramData\Miniconda3\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
Failed to load the native TensorFlow runtime.
Please help me to run tensorflow.
uninstall tensorflow, then reinstall it using conda. Conda will install tensorflow 2.1.0, cuda toolkit 10.1.243 and cudnn 7.6.5. Pip does not install the toolkit or cudnn and you have to download these and change your environment path variable to point to the directories where they are stored. If you want to install tensorflow 2.2 first install tensorflow 2.1.0 with conda then use pip to install tensorflow 2.2 using pip install tensorflow ==2.2.0. Tensorflow 2.2 is compatible with the toolkit and cudnn versions installed by 2.1.
Try using pip install tensorflow instead of conda. Tensorflow works fine for me. But I haven't tried conda yet for installing tensorflow.

Anaconda not loading Tensorflow

Clean install of Windows10 with updates(iCore 5, 8Gb, 64bit). Installed Antivirus and Firewall. Installed Docker and pulled Tensorflow image and successfully created containers that works perfectly.
Then I downloaded and installed the latest Anaconda 64bit for Windows with all default settings on the host system. No python was installed before the time on the host system.
In the PATH I moved "%USERPROFILE%\AppData\Local\Microsoft\WindowsApps" down the list otherwise the python.exe inside this folder is default.
Here is a pic of the PATH variables on the host system.
Screenshot of PATH on host
On the host I did a pip upgrade and installed tensorflow successfully, but as you can see below when I try to import I get this error.
I think it is specific to Anaconda as I'm not getting this in the docker container, with only Tensorflow and Jupyter Notebook installed.
Have already looked at Request1 and Request2 that is similar in output but with no answers.
Any help or guidance will be appreciated.
(base) C:\Users\DNN>where python
C:\ProgramData\Anaconda3\python.exe
(base) C:\Users\DNN>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 as tf
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\ProgramData\Anaconda3\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:\ProgramData\Anaconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\ProgramData\Anaconda3\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 "<stdin>", line 1, in <module>
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 101, in <module>
from tensorflow_core import *
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
module = self._load()
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "C:\ProgramData\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\ProgramData\Anaconda3\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:\ProgramData\Anaconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\ProgramData\Anaconda3\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.
Managed to get some info on the Tensorflow Github release notes which I tried and it worked for me.
Installed the VSRedis as per article below, restarted and my Tensorflow was working on the host.
My Docker container worked because the host image is Linux, but here my host pc is Windows and needs the following it seems. Just a pity they don't include this in the Anaconda install. Really had to go fish for this one.
From the Github Release notes: here
Windows users: Officially-released tensorflow Pip packages are now built with Visual Studio 2019 version 16.4 in order to take advantage of the new /d2ReducedOptimizeHugeFunctions compiler flag. To use these new packages, you must install "Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019", available from Microsoft's website here.
MS Visual Studio Redistributable

Error while Installing tensorflow-gpu on MX150

I am trying to install tensorflow gpu on my laptop running MX150. I updated my NVIDIA driver, installed CUDA , installed CUDnn. But still not able to import Tensorflow. getting following error
>>> import tensorflow as tf
Traceback (most recent call last):
File "/home/rohan/anaconda3/envs/tensorflow_env/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/rohan/anaconda3/envs/tensorflow_env/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/rohan/anaconda3/envs/tensorflow_env/lib/python3.6/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 "/home/rohan/anaconda3/envs/tensorflow_env/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/home/rohan/anaconda3/envs/tensorflow_env/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: libcublas.so.8.0: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/rohan/anaconda3/envs/tensorflow_env/lib/python3.6/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/rohan/anaconda3/envs/tensorflow_env/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/rohan/anaconda3/envs/tensorflow_env/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 72, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/rohan/anaconda3/envs/tensorflow_env/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/rohan/anaconda3/envs/tensorflow_env/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/rohan/anaconda3/envs/tensorflow_env/lib/python3.6/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 "/home/rohan/anaconda3/envs/tensorflow_env/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/home/rohan/anaconda3/envs/tensorflow_env/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: libcublas.so.8.0: cannot open shared object file: No such file or directory
It looks like there is a mismatch between your python version and your CUDA version.
please check your versions by:
python --version
and
nvcc --version
What is yuor OS? What version of Tensorflow your are trying to run?
I suggest to uninstall tensorflow and reinstall it after you have the currect version of Python and CUDA. You can follow Tesnoeflow with gpu documentation.
Also check this issue which is similar to yours
libcublas.so.8.0 error with tensorflow
you need python version 3.7 with cuda toolkit 10.0
I also had the same error and solved it by setting the environmental variables for cuda path in your system advanced settings.
If you have installed two or more cuda versions make sure to delete rest from environment variables .
use the below code to check if gpu is being utilizd in jupyter notebook.
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())

Import error after installing tensorflow

I tried installing tensorflow as given in the link Installing Tensor flow
I installed it inside virtual environment. I am getting import error as given at the end in edit.
I've set the following environment variables.
PATH=/usr/local/cuda-8.0/bin:rest/of/the/path
LD_LIBARY_PATH=/home/harshit/Drivers/cudnn5.0/cuda/:/usr/local/cuda-8.0/lib64/:/usr/local/cuda/lib64/
Moreover, I also tried manually copying the files of cudnn but still no luck. That is, I have libcudnn.so.5 in both /usr/local/cuda/lib64 and /usr/local/cuda-8.0/lib64.
As given in other related posts, problem is usually due to environment paths but I feel they are quite correct in my case, but still error persists.
Please help!
Edit- Here is the complete error traceback-
(env) harshit#echo:~$ python
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "/home/harshit/Documents/projects/tensorflowplay/env/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/harshit/Documents/projects/tensorflowplay/env/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/harshit/Documents/projects/tensorflowplay/env/lib/python3.5/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 "/home/harshit/Documents/projects/tensorflowplay/env/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/home/harshit/Documents/projects/tensorflowplay/env/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: libcudnn.so.5: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/harshit/Documents/projects/tensorflowplay/env/lib/python3.5/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/harshit/Documents/projects/tensorflowplay/env/lib/python3.5/site-packages/tensorflow/python/__init__.py", line 51, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/harshit/Documents/projects/tensorflowplay/env/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/harshit/Documents/projects/tensorflowplay/env/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/harshit/Documents/projects/tensorflowplay/env/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/harshit/Documents/projects/tensorflowplay/env/lib/python3.5/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 "/home/harshit/Documents/projects/tensorflowplay/env/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/home/harshit/Documents/projects/tensorflowplay/env/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: libcudnn.so.5: cannot open shared object file: No such file or directory
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
I think your libcudnn.so files are not linked correctly.
Please do
$ sudo ldconfig
This will show you the files in /path/to/cuda-8.0/lib64 that are not linked properly.
These should be libcudnn.so and libcudnn.so.5 (as per your error).
Try to attempt the following commands on your terminal:
If you have cudnn v6 (like I have):
$ cd /path/to/cuda-8.0/lib64
Please remove libcudnn.so.6 and libcudnn.so from this folder if you have copied these manually from the NVIDIA CUDNN package.
$ sudo ln -s libcudnn.so.6.0.21 libcudnn.so.6
$ sudo ln -s libcudnn.so.6 libcudnn.so
$ sudo ldconfig
Please change the file names according to the version of cudnn you are using.

Unable to Install Tensorflow with Python 3 on Ubuntu 12.04 LTS

I have already have a virtual environment installation of Tensorflow on my computer, although it runs Python 2.7. Now I want to work with Tensorflow running in Python 3.5.
For Python 3, I've created a virtual environment since the default Python environment on my computer is Python 2.7. I'm attempting a Pip installation of Tensorflow in a Python 3 virtual environment that I have named py3k. The installation procedure throws errors that I'm finding difficulty in debugging.
Here's what I did:
anirudh#anirudh-Vostro-3445:~$ source activate py3k
(py3k) anirudh#anirudh-Vostro-3445:~$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0rc0-cp35-cp35m-linux_x86_64.whl
(py3k) anirudh#anirudh-Vostro-3445:~$ sudo pip3 install --upgrade $TF_BINARY_URL
/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/_vendor/pkg_resources/__init__.py:80: UserWarning: Support for Python 3.0-3.2 has been dropped. Future versions will fail here.
warnings.warn(msg)
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 9, in <module>
load_entry_point('pip==8.1.2', 'console_scripts', 'pip3')()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 337, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2280, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 1990, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/__init__.py", line 16, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/vcs/mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/download.py", line 36, in <module>
from pip.utils.ui import DownloadProgressBar, DownloadProgressSpinner
File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/utils/ui.py", line 15, in <module>
from pip._vendor.progress.bar import Bar, IncrementalBar
File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/_vendor/progress/bar.py", line 48
empty_fill = u'∙'
^
SyntaxError: invalid syntax
cp35 from https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0rc0-cp35-cp35m-linux_x86_64.whl means C python 3.5
You have python 3.2 on your machine
I recommend installing Ubuntu 15.04

Resources