matplotlib permissions denied on cygwin - matplotlib

I tried to run this line import pylab as pl
File "lab.py", line 9, in <module>
import pylab as pl
File "/usr/lib/python2.7/site-packages/matplotlib-1.4.3-py2.7-cygwin-1.7.35-x86_64.egg/pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "/usr/lib/python2.7/site-packages/matplotlib-1.4.3-py2.7-cygwin-1.7.35-x86_64.egg/matplotlib/pylab.py", line 231, in <module>
import matplotlib.finance
File "/usr/lib/python2.7/site-packages/matplotlib-1.4.3-py2.7-cygwin-1.7.35-x86_64.egg/matplotlib/finance.py", line 36, in <module>
from matplotlib.dates import date2num
File "/usr/lib/python2.7/site-packages/matplotlib-1.4.3-py2.7-cygwin-1.7.35-x86_64.egg/matplotlib/dates.py", line 137, in <module>
import matplotlib.ticker as ticker
File "/usr/lib/python2.7/site-packages/matplotlib-1.4.3-py2.7-cygwin-1.7.35-x86_64.egg/matplotlib/ticker.py", line 158, in <module>
from matplotlib import transforms as mtransforms
File "/usr/lib/python2.7/site-packages/matplotlib-1.4.3-py2.7-cygwin-1.7.35-x86_64.egg/matplotlib/transforms.py", line 39, in <module>
from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,
File "/usr/lib/python2.7/site-packages/matplotlib-1.4.3-py2.7-cygwin-1.7.35-x86_64.egg/matplotlib/_path.py", line 7, in <module>
__bootstrap__()
File "/usr/lib/python2.7/site-packages/matplotlib-1.4.3-py2.7-cygwin-1.7.35-x86_64.egg/matplotlib/_path.py", line 6, in __bootstrap__
imp.load_dynamic(__name__,__file__)
ImportError: Permission denied
Is it due to some config which has to be done after installation of matplotlib?

Related

Failed to import from tf_agents.agents.categorical_dqn import categorical_dqn_agent

Im getting this error when importing this command on python
from tf_agents.agents.categorical_dqn import categorical_dqn_agent
Traceback (most recent call last):
File "<pyshell#19>", line 1, in <module>
from tf_agents.agents.categorical_dqn import categorical_dqn_agent
File "C:\Users\kasun\AppData\Local\Programs\Python\Python310\lib\site-packages\tf_agents\agents\__init__.py", line 17, in <module>
from tf_agents.agents import tf_agent
File "C:\Users\kasun\AppData\Local\Programs\Python\Python310\lib\site-packages\tf_agents\agents\tf_agent.py", line 26, in <module>
from tf_agents.specs import tensor_spec
File "C:\Users\kasun\AppData\Local\Programs\Python\Python310\lib\site-packages\tf_agents\specs\__init__.py", line 20, in <module>
from tf_agents.specs.distribution_spec import DistributionSpec
File "C:\Users\kasun\AppData\Local\Programs\Python\Python310\lib\site-packages\tf_agents\specs\distribution_spec.py", line 22, in <module>
import tensorflow_probability as tfp
File "C:\Users\kasun\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorflow_probability\__init__.py", line 23, in <module>
from tensorflow_probability.python import * # pylint: disable=wildcard-import
File "C:\Users\kasun\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorflow_probability\python\__init__.py", line 138, in <module>
dir(globals()[pkg_name]) # Forces loading the package from its lazy loader.
File "C:\Users\kasun\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorflow_probability\python\internal\lazy_loader.py", line 57, in __dir__
module = self._load()
File "C:\Users\kasun\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorflow_probability\python\internal\lazy_loader.py", line 40, in _load
module = importlib.import_module(self.__name__)
File "C:\Users\kasun\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\kasun\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorflow_probability\python\experimental\__init__.py", line 31, in <module>
from tensorflow_probability.python.experimental import bijectors
File "C:\Users\kasun\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorflow_probability\python\experimental\bijectors\__init__.py", line 17, in <module>
from tensorflow_probability.python.bijectors.ldj_ratio import forward_log_det_jacobian_ratio
File "C:\Users\kasun\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorflow_probability\python\bijectors\__init__.py", line 19, in <module>
from tensorflow_probability.python.bijectors.absolute_value import AbsoluteValue
File "C:\Users\kasun\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorflow_probability\python\bijectors\absolute_value.py", line 19, in <module>
from tensorflow_probability.python.bijectors import bijector
File "C:\Users\kasun\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorflow_probability\python\bijectors\bijector.py", line 26, in <module>
from tensorflow_probability.python.internal import batch_shape_lib
File "C:\Users\kasun\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorflow_probability\python\internal\batch_shape_lib.py", line 23, in <module>
from tensorflow_probability.python.internal import prefer_static as ps
File "C:\Users\kasun\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorflow_probability\python\internal\prefer_static.py", line 26, in <module>
from tensorflow_probability.python.internal.backend import numpy as nptf
File "C:\Users\kasun\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorflow_probability\python\internal\backend\numpy\__init__.py", line 18, in <module>
from tensorflow_probability.python.internal.backend.numpy import bitwise
File "C:\Users\kasun\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorflow_probability\python\internal\backend\numpy\bitwise.py", line 19, in <module>
from tensorflow_probability.python.internal.backend.numpy import _utils as utils
File "C:\Users\kasun\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorflow_probability\python\internal\backend\numpy\_utils.py", line 22, in <module>
from tensorflow_probability.python.internal.backend.numpy import nest
File "C:\Users\kasun\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorflow_probability\python\internal\backend\numpy\nest.py", line 68, in <module>
assert_same_structure = dm_tree.assert_same_structure
AttributeError: module 'tree' has no attribute 'assert_same_structure'
I tried this:
pip3 install dm-tree
but it also didnt work
Try:
pip install --upgrade dm-tree

Bad values in fds_to_keep

I am running tensorflow within a microservice built using Klein/Twisted. I recently upgraded to a new version of scikit-learn (20.0), and am getting an error ValueError: bad value(s) in fds_to_keep. When I revert the version of scikit-learn to 19.2 the error is eliminated. I looked at the changelog for scikit-learn, and in version 20.0 they started using joblib for parallel computation. Below I am including a stack trace for the error. I am using Twisted version 19.7.
Any insights or advice on how to debug further is much appreciated.
I have tried newer versions of scikit-learn e.g.21.3, but the error remains.
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/calamari_ocr/ocr/predictor.py", line 106, in __init__
backend = create_backend_from_proto(self.network_params, restore=self.checkpoint, processes=processes)
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/calamari_ocr/ocr/backends/factory.py", line 28, in create_backend_from_proto
from calamari_ocr.ocr.backends.tensorflow_backend.tensorflow_backend import TensorflowBackend
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/calamari_ocr/ocr/backends/tensorflow_backend/tensorflow_backend.py", line 4, in <module>
from calamari_ocr.ocr.backends.tensorflow_backend.tensorflow_model import TensorflowModel
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/calamari_ocr/ocr/backends/tensorflow_backend/tensorflow_model.py", line 3, in <module>
import tensorflow.contrib.cudnn_rnn as cudnn_rnn
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/__init__.py", line 37, in <module>
from tensorflow.contrib import cudnn_rnn
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/cudnn_rnn/__init__.py", line 38, in <module>
from tensorflow.contrib.cudnn_rnn.python.layers import *
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/cudnn_rnn/python/layers/__init__.py", line 23, in <module>
from tensorflow.contrib.cudnn_rnn.python.layers.cudnn_rnn import *
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/cudnn_rnn/python/layers/cudnn_rnn.py", line 20, in <module>
from tensorflow.contrib.cudnn_rnn.python.ops import cudnn_rnn_ops
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/cudnn_rnn/python/ops/cudnn_rnn_ops.py", line 22, in <module>
from tensorflow.contrib.rnn.python.ops import lstm_ops
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/rnn/__init__.py", line 93, in <module>
from tensorflow.contrib.rnn.python.ops.rnn_cell import *
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/rnn/python/ops/rnn_cell.py", line 24, in <module>
from tensorflow.contrib.layers.python.layers import layers
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/layers/__init__.py", line 116, in <module>
from tensorflow.contrib.layers.python.layers import *
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/layers/python/layers/__init__.py", line 33, in <module>
from tensorflow.contrib.layers.python.layers.target_column import *
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/layers/python/layers/target_column.py", line 24, in <module>
from tensorflow.contrib.losses.python.losses import loss_ops
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/losses/__init__.py", line 25, in <module>
from tensorflow.contrib.losses.python import metric_learning
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/losses/python/metric_learning/__init__.py", line 25, in <module>
from tensorflow.contrib.losses.python.metric_learning.metric_loss_ops import *
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/losses/python/metric_learning/metric_loss_ops.py", line 34, in <module>
from sklearn import metrics
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/sklearn/__init__.py", line 76, in <module>
from .base import clone
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/sklearn/base.py", line 16, in <module>
from .utils import _IS_32BIT
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/sklearn/utils/__init__.py", line 17, in <module>
from . import _joblib
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/sklearn/utils/_joblib.py", line 8, in <module>
import joblib
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/joblib/__init__.py", line 119, in <module>
from .parallel import Parallel
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/joblib/parallel.py", line 22, in <module>
from ._multiprocessing_helpers import mp
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/joblib/_multiprocessing_helpers.py", line 34, in <module>
_sem = Semaphore()
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/multiprocessing/context.py", line 82, in Semaphore
return Semaphore(value, ctx=self.get_context())
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/multiprocessing/synchronize.py", line 127, in __init__
SemLock.__init__(self, SEMAPHORE, value, SEM_VALUE_MAX, ctx=ctx)
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/multiprocessing/synchronize.py", line 81, in __init__
register(self._semlock.name)
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/multiprocessing/semaphore_tracker.py", line 83, in register
self._send('REGISTER', name)
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/multiprocessing/semaphore_tracker.py", line 90, in _send
self.ensure_running()
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/multiprocessing/semaphore_tracker.py", line 71, in ensure_running
pid = util.spawnv_passfds(exe, args, fds_to_pass)
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/multiprocessing/util.py", line 403, in spawnv_passfds
False, False, None)
ValueError: bad value(s) in fds_to_keep

Receive error when I run an executable created after py2exe conversion

After running my setup.py file and attempt to run the newly created .exe file I receive an error log that says:
Traceback (most recent call last):
File "Healthy_temp.py", line 7, in <module>
File "pandas\__init__.pyc", line 42, in <module>
File "pandas\core\api.pyc", line 26, in <module>
File "pandas\core\groupby\__init__.pyc", line 1, in <module>
File "pandas\core\groupby\groupby.pyc", line 37, in <module>
File "pandas\core\frame.pyc", line 100, in <module>
File "pandas\core\series.pyc", line 4390, in <module>
File "pandas\core\generic.pyc", line 10138, in _add_series_or_dataframe_operations
File "pandas\core\window.pyc", line 14, in <module>
File "pandas\_libs\window.pyc", line 12, in <module>
File "pandas\_libs\window.pyc", line 10, in __load
File "pandas\_libs\skiplist.pxd", line 31, in initpandas._libs.window
ImportError: No module named skiplist
My setup.py file is here:
from distutils.core import setup
import py2exe
import matplotlib
from PyQt4 import QtCore, QtGui
from AboutDialog import Ui_Dialog
from matplotlibwidget import MatplotlibWidget
import sys
from os import walk
from os import getcwd
import pandas
import numpy
from glob import glob
from datetime import datetime
from math import isnan
import sip
# setup(windows=['Healthy_temp.py'])
setup(options={'py2exe': {'bundle_files': 3, 'compressed': True}}, windows=[
'Healthy_temp.py'], zipfile=None,
data_files=matplotlib.get_py2exe_datafiles())
What can I do to correct this problem?
Add 'pandas._libs.skiplist' to the "includes" option list.

import tensorflow.contrib.layers as layers reported an error

The TF version is 1.9.0 and cython version is 0.28.4, when import tensorflow.contrib.layers as layers, there is an error occured,
Traceback (most recent call last):
File "train.py", line 9, in <module>
import tensorflow.contrib.layers as layers
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/__init__.py", line 39, in <module>
from tensorflow.contrib import distributions
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/distributions/__init__.py", line 40, in <module>
from tensorflow.contrib.distributions.python.ops.estimator import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/distributions/python/ops/estimator.py", line 21, in <module>
from tensorflow.contrib.learn.python.learn.estimators.head import _compute_weighted_loss
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/__init__.py", line 95, in <module>
from tensorflow.contrib.learn.python.learn import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/__init__.py", line 28, in <module>
from tensorflow.contrib.learn.python.learn import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/__init__.py", line 30, in <module>
from tensorflow.contrib.learn.python.learn import estimators
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/__init__.py", line 302, in <module>
from tensorflow.contrib.learn.python.learn.estimators.dnn import DNNClassifier
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/dnn.py", line 35, in <module>
from tensorflow.contrib.learn.python.learn.estimators import dnn_linear_combined
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py", line 36, in <module>
from tensorflow.contrib.learn.python.learn.estimators import estimator
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 52, in <module>
from tensorflow.contrib.learn.python.learn.learn_io import data_feeder
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/learn_io/__init__.py", line 26, in <module>
from tensorflow.contrib.learn.python.learn.learn_io.dask_io import extract_dask_data
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/learn_io/dask_io.py", line 33, in <module>
import dask.dataframe as dd
File "/usr/local/lib/python3.5/dist-packages/dask/dataframe/__init__.py", line 3, in <module>
from .core import (DataFrame, Series, Index, _Frame, map_partitions,
File "/usr/local/lib/python3.5/dist-packages/dask/dataframe/core.py", line 20, in <module>
from .. import array as da
File "/usr/local/lib/python3.5/dist-packages/dask/array/__init__.py", line 4, in <module>
from .core import (Array, block, concatenate, stack, from_array, store,
File "/usr/local/lib/python3.5/dist-packages/dask/array/core.py", line 50, in <module>
from ..bytes.core import get_mapper, get_fs_token_paths
File "/usr/local/lib/python3.5/dist-packages/dask/bytes/__init__.py", line 4, in <module>
from .core import read_bytes, open_files, open_text_files
File "/usr/local/lib/python3.5/dist-packages/dask/bytes/core.py", line 10, in <module>
from .compression import seekable_files, files as compress_files
File "/usr/local/lib/python3.5/dist-packages/dask/bytes/compression.py", line 31, in <module>
import snappy
File "/usr/local/lib/python3.5/dist-packages/snappy/__init__.py", line 7, in <module>
from .SnapPy import (AbelianGroup, HolonomyGroup, FundamentalGroup,
File "cython/core/basic.pyx", line 45, in init SnapPy
File "/usr/local/lib/python3.5/dist-packages/snappy/horoviewer.py", line 3, in <module>
from .CyOpenGL import *
File "opengl/CyOpenGL.pyx", line 36, in init CyOpenGL
AttributeError: type object 'CyOpenGL.vector3' has no attribute '__reduce_cython__'
I thought there is something wrong with Cython's verion, but I am not sure since. How can I fix it?
Now, I can not figure out how did this error come out, but still, there is a workaround that is using tf.layers.dense to replace it
tf.layers.dense(...) # tf.contrib.layers.fully_connected(...)
This error is nasty when you don't have root permission to update dependencies.
Reference:
Are tf.layers.dense() and tf.contrib.layers.fully_connected() interchangeable?

cannot import matplotlib.pylab with matplotlib installed

I understand that there have been several questions asked on this topic, however, I didn't find them able to solve my problem.
I installed matplotlib on the maching under /python-path/site-packages, both library and python are 64bits,
so I could import matplotlib no problem, but when I tried to import matplotlib.pylab or pylab, it gives me the following error
Traceback (most recent call last):
File "shownet.py", line 40, in <module>
import matplotlib.pylab
File "/usr/lib64/python2.6/site-packages/matplotlib/pylab.py", line 247, in <module>
from matplotlib.pyplot import *
File "/usr/lib64/python2.6/site-packages/matplotlib/pyplot.py", line 78, in <module>
new_figure_manager, draw_if_interactive, show = pylab_setup()
File "/usr/lib64/python2.6/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup
globals(),locals(),[backend_name])
File "/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_gtkagg.py", line 10, in <module>
from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\
File "/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_gtk.py", line 8, in <module>
import gtk; gdk = gtk.gdk
File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line 64, in <module>
_init()
File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line 52, in _init
_gtk.init_check()
Would anyone know why this is so?
Also this is on linux, and I built it using setup.py