Not able to import matplotlib animation with "Permission denied: 'convert'" - python-3.x

When trying to import animation from matplotlib, we keep getting the following error:
PermissionError: [Errno 13] Permission denied: 'convert'
This is the complete log:
$ python
Python 3.7.4 (default, Aug 13 2019, 15:17:50)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from matplotlib import animation
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/ssy/miniconda3/envs/bao/lib/python3.7/site-packages/matplotlib/animation.py", line 737, in <module>
class ImageMagickWriter(ImageMagickBase, MovieWriter):
File "/Users/ssy/miniconda3/envs/bao/lib/python3.7/site-packages/matplotlib/animation.py", line 120, in wrapper
if writerClass.isAvailable():
File "/Users/ssy/miniconda3/envs/bao/lib/python3.7/site-packages/matplotlib/animation.py", line 730, in isAvailable
return super().isAvailable()
File "/Users/ssy/miniconda3/envs/bao/lib/python3.7/site-packages/matplotlib/animation.py", line 427, in isAvailable
return shutil.which(cls.bin_path()) is not None
File "/Users/ssy/miniconda3/envs/bao/lib/python3.7/site-packages/matplotlib/animation.py", line 724, in bin_path
binpath = mpl._get_executable_info('magick').executable
File "/Users/ssy/miniconda3/envs/bao/lib/python3.7/site-packages/matplotlib/__init__.py", line 384, in _get_executable_info
return impl([path, "--version"], r"^Version: ImageMagick (\S*)")
File "/Users/ssy/miniconda3/envs/bao/lib/python3.7/site-packages/matplotlib/__init__.py", line 324, in impl
args, stderr=subprocess.STDOUT, universal_newlines=True)
File "/Users/ssy/miniconda3/envs/bao/lib/python3.7/subprocess.py", line 395, in check_output
**kwargs).stdout
File "/Users/ssy/miniconda3/envs/bao/lib/python3.7/subprocess.py", line 472, in run
with Popen(*popenargs, **kwargs) as process:
File "/Users/ssy/miniconda3/envs/bao/lib/python3.7/subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "/Users/ssy/miniconda3/envs/bao/lib/python3.7/subprocess.py", line 1522, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: 'convert'
Any body knows why and how to resolve this?
We are using conda for managing the environment. Other packages all work fine. e.g.
>>> import numpy
>>> import matplotlib
>>> from numpy import arange
These all works fine.

Related

Tensorflow 15.2 with Python 3.7.3 running in raspberry pi 4

I have python 3.7.3 and Tensorflow 15.2 installed in raspberry pi 4. When I tried to do import Tensorflow as TD, it failed to load the native Tensorflow runtimes. Can you please help and advise how to resolve the following issue?
pi#raspberrypi:
~ $ python Python 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0] on linux Type "help",
"copyright",
"credits" or "license" for more information.
import tensorflow as tf Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py",
line 58,
in from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/pi/.local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py",
line 28,
in _pywrap_tensorflow_internal = swig_import_helper() File "/home/pi/.local/lib/python3.7/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 "/usr/lib/python3.7/imp.py",
line 242,
in load_module return load_dynamic(name, filename, file) File "/usr/lib/python3.7/imp.py",
line 342,
in load_dynamic return _load(spec)
ImportError: /home/pi/.local/lib/python3.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so:
undefined symbol: _PyThreadState_Current
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "",
line 1,
in File "/home/pi/.local/lib/python3.7/site-packages/tensorflow/init.py",
line 24,
in from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "/home/pi/.local/lib/python3.7/site-packages/tensorflow/python/init.py",
line 49,
in from tensorflow.python import pywrap_tensorflow File "/home/pi/.local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py",
line 74,
in raise ImportError(msg) ImportError:
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py",
line 58,
in from tensorflow.python.pywrap_tensorflow_internal import * File "/home/pi/.local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py",
line 28,
in _pywrap_tensorflow_internal = swig_import_helper() File "/home/pi/.local/lib/python3.7/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 "/usr/lib/python3.7/imp.py",
line 242,
in load_module return load_dynamic(name, filename, file) File "/usr/lib/python3.7/imp.py",
line 342,
in load_dynamic return _load(spec) ImportError: /home/pi/.local/lib/python3.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so:
undefined symbol: _PyThreadState_Current
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors for some common reasons and solutions. Included the entire stack trace above this error message when asking for help.

Error in python after 'import tensorflow' on windows [duplicate]

This question already has an answer here:
Tensorflow 2.0 on Windows (SSE2): How do you stop 'ImportError: DLL load failed: The specified module could not be found.' when importing tensorflow
(1 answer)
Closed 2 years ago.
After install TensorFlow for Python3 and type "import tensorflow" it wrote this long error.
Any ideas how to fix it?
C:\Users\marsa>python
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "C:\Users\marsa\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\marsa\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\marsa\AppData\Local\Programs\Python\Python37\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\marsa\AppData\Local\Programs\Python\Python37\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\marsa\AppData\Local\Programs\Python\Python37\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: Proces inicializace dynamicky připojované knihovny (DLL) se nezdařil.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\marsa\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\__init__.py", line 28, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\marsa\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\marsa\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\marsa\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\marsa\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\marsa\AppData\Local\Programs\Python\Python37\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\marsa\AppData\Local\Programs\Python\Python37\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\marsa\AppData\Local\Programs\Python\Python37\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: Proces inicializace dynamicky připojované knihovny (DLL) se nezdařil.
Failed to load the native TensorFlow runtime.
What operating system are you using? Are you in a virtualenv? Please make sure the same python interpreter used for installing is also used for testing. For example, you could do:
python -m pip install tensorflow
python -c "import tensorflow"
And this should not fail.

Dask Distributed client takes to long to initialize in jupyter lab

Trying to initialize a client with local cluster in Jupyter lab but hangs. This behaviour happens for python 3.5 and jupyter lab 0.35.
import dask.dataframe as dd
from dask import delayed
from distributed import Client
from distributed import LocalCluster
import pandas as pd
import numpy as np
import json
cluster = LocalCluster()
client = Cluster(cluster)
client
versions of the tools :
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
And the jupyter lab version is
pip list |grep jupyter
jupyter 1.0.0
jupyter-client 5.2.3
jupyter-console 6.0.0
jupyter-core 4.4.0
jupyterlab 0.35.3
jupyterlab-server 0.2.0
Dask version
pip list |grep dask
dask 0.20.0
What could be wrong?
EDIT: No exception on the terminal while trying to initialize client
Interrupting the Kernel gives the following exceptions:
Inside jupyter:
distributed.nanny - ERROR - Failed to restart worker after its process exited
Traceback (most recent call last):
File "/home/avlach/virtualenvs/staistics3/lib/python3.5/site-packages/distributed/nanny.py", line 291, in _on_exit
yield self.instantiate()
File "/home/avlach/virtualenvs/staistics3/lib/python3.5/site-packages/tornado/gen.py", line 1133, in run
value = future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
raise self._exception
File "/home/avlach/virtualenvs/staistics3/lib/python3.5/site-packages/tornado/gen.py", line 1141, in run
yielded = self.gen.throw(*exc_info)
File "/home/avlach/virtualenvs/staistics3/lib/python3.5/site-packages/distributed/nanny.py", line 226, in instantiate
self.process.start()
File "/home/avlach/virtualenvs/staistics3/lib/python3.5/site-packages/tornado/gen.py", line 1133, in run
value = future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
raise self._exception
File "/home/avlach/virtualenvs/staistics3/lib/python3.5/site-packages/tornado/gen.py", line 1141, in run
yielded = self.gen.throw(*exc_info)
File "/home/avlach/virtualenvs/staistics3/lib/python3.5/site-packages/distributed/nanny.py", line 370, in start
yield self.process.start()
File "/home/avlach/virtualenvs/staistics3/lib/python3.5/site-packages/tornado/gen.py", line 1133, in run
value = future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
raise self._exception
File "/home/avlach/virtualenvs/staistics3/lib/python3.5/site-packages/distributed/process.py", line 35, in _call_and_set_future
res = func(*args, **kwargs)
File "/home/avlach/virtualenvs/staistics3/lib/python3.5/site-packages/distributed/process.py", line 184, in _start
process.start()
File "/usr/lib/python3.5/multiprocessing/process.py", line 105, in start
self._popen = self._Popen(self)
File "/usr/lib/python3.5/multiprocessing/context.py", line 281, in _Popen
return Popen(process_obj)
File "/usr/lib/python3.5/multiprocessing/popen_forkserver.py", line 36, in __init__
super().__init__(process_obj)
File "/usr/lib/python3.5/multiprocessing/popen_fork.py", line 20, in __init__
self._launch(process_obj)
File "/usr/lib/python3.5/multiprocessing/popen_forkserver.py", line 52, in _launch
self.sentinel, w = forkserver.connect_to_new_process(self._fds)
File "/usr/lib/python3.5/multiprocessing/forkserver.py", line 66, in connect_to_new_process
client.connect(self._forkserver_address)
ConnectionRefusedError: [Errno 111] Connection refused
and on the terminal
Kernel interrupted: 1e7da6ed-2137-41ce-818e-3484c0a659cc
fd_event_list = self._epoll.poll(timeout, max_ev)
KeyboardInterrupt

ImportError loading tensorflow module

I have problem during import tensorflow.
Here is my recent stack trace:
(tensorflow) C:\Users\Vaidik>python
Python 3.5.5 |Anaconda, Inc.| (default, Apr 7 2018, 04:52:34) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
File "F:\Software\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "F:\Software\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "F:\Software\Anaconda\envs\tensorflow\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 "F:\Software\Anaconda\envs\tensorflow\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "F:\Software\Anaconda\envs\tensorflow\lib\imp.py", line 343, 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 "F:\Software\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\__init__.py", line 22, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "F:\Software\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "F:\Software\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "F:\Software\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "F:\Software\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "F:\Software\Anaconda\envs\tensorflow\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 "F:\Software\Anaconda\envs\tensorflow\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "F:\Software\Anaconda\envs\tensorflow\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/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
Please try to create a conda environment for the required python version and install tensorflow.
Follow the below steps:
conda create -n tf35 -c intel python=3.5 pip numpy
(tf35 is the environment name)
activate tf35
conda install -c anaconda tensorflow
Thanks
Uninstall tf using
conda uninstall tensorflow
then install it again
python3 -m pip install tensorflow==1.8.0 --user

Tensorflow 1.5 on Raspberry Pi3

I followed these instructions to compile tensorflow:
https://github.com/samjabrahams/tensorflow-on-raspberry-pi/blob/master/GUIDE.md
I pulled the newest bazel (0.9.0)from github and compiled it successfully. After that I pulled the newest tensorflow (1.5.0) from github then applied this command
grep -Rl 'lib64' | xargs sed -i 's/lib64/lib/g'
I skipped the editing of tensorflow/workspace.bzl. Then I ran the configuration script and provided the paths for python 3.5. Compilation was after one night successful with following command from tutorial:
bazel build -c opt --copt="-mfpu=neon-vfpv4" --copt="-funsafe-math-optimizations" --copt="-ftree-vectorize" --copt="-fomit-frame-pointer" --local_resources 1024,1.0,1.0 --verbose_failures tensorflow/tools/pip_package:build_pip_package
Then I builded the package:
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
Then the installation in python also worked without errors:
sudo pip3 install /tmp/tensorflow_pkg/tensorflow-1.5.0rc1-cp35-cp35m-linux_armv7l.whl --upgrade --force-reinstall
But then when I start python3 from my home directory and try to import tensorflow with: import tensorflow as tf following error appears:
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170124] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/usr/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /usr/local/lib/python3.5/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: _ZN10tensorflow9ConcatCPUINS_8bfloat16EEEvPNS_10DeviceBaseERKSt6vectorISt10unique_ptrINS_6TTypesIT_Li2EiE11ConstMatrixESt14default_deleteIS9_EESaISC_EEPNS8_6MatrixE
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/usr/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /usr/local/lib/python3.5/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: _ZN10tensorflow9ConcatCPUINS_8bfloat16EEEvPNS_10DeviceBaseERKSt6vectorISt10unique_ptrINS_6TTypesIT_Li2EiE11ConstMatrixESt14default_deleteIS9_EESaISC_EEPNS8_6MatrixE
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.
How can I fix this? Thank you in advance!
It is looking for ConcatCPU defined here:
https://github.com/tensorflow/tensorflow/blob/r1.5/tensorflow/core/kernels/concat_lib_cpu.cc#L51
undefined symbol: _ZN10tensorflow9ConcatCPUINS_8bfloat16EEEvPNS_10DeviceBaseERKSt6vectorISt10unique_ptrINS_6TTypesIT_Li2EiE11ConstMatrixESt14default_deleteIS9_EESaISC_EEPNS8_6MatrixE
So there may be something wrong with your bazelrc.
You have multiple options:
1) Dig in your bazelrc and check that concat_lib_cpu.cc is being compiled, check that the linker sees it, etc.
2) RECOMMENDED - Simply download the package from ci.tensorflow.org and install:
Python 3: http://ci.tensorflow.org/view/Nightly/job/nightly-pi-python3/lastSuccessfulBuild/
Python 2: http://ci.tensorflow.org/view/Nightly/job/nightly-pi/lastSuccessfulBuild/
3) Use Tensorflow Lite if you can, remember RPIs are limitted.
Good luck.

Resources