I try to use
import sklearn
But I get the error message at following:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-7e12b462961d> in <module>()
1
----> 2 import sklearn
~/Downloads/anaconda/lib/python3.6/site-packages/sklearn/__init__.py in
<module>()
148 'clone']
149
--> 150 from .daal4sklearn import dispatcher
151 dispatcher.enable()
152
~/Downloads/anaconda/lib/python3.6/site-packages/sklearn/daal4sklearn/dispatcher.py in <module>()
7 from ..linear_model.ridge import Ridge
8
----> 9 from .k_means import fit as kmeans_fit
10 from .pca import _fit_full as pca_fit_full
11 from .pairwise import daal_pairwise_distances
~/Downloads/anaconda/lib/python3.6/site-packages/sklearn/daal4sklearn/k_means.py in <module>()
5 from ..cluster.k_means_ import k_means
6 from ..externals.six import string_types
----> 7 from .utils import getArrayFromNumericTable, make_csr_table, make_HomogenNumericTable
8 from daal.data_management import CSRNumericTable
9 from daal.data_management import
HomogenNumericTable,HomogenNumericTable_Float32,HomogenNumericTable_Intc
~/Downloads/anaconda/lib/python3.6/site-packages/sklearn/daal4sklearn/utils.py in <module>()
1 import numpy as np
2 from scipy import sparse as sp
----> 3 from daal.data_management import readOnly, NumericTableIface, BlockDescriptor, BlockDescriptor_Float32, packed_mask
4 from daal.data_management import HomogenNumericTable, HomogenNumericTable_Float32, HomogenNumericTable_Intc, CSRNumericTable
5
~/Downloads/anaconda/lib/python3.6/site-packages/daal/__init__.py in <module>()
55 fp.close()
56 return _mod
---> 57 _daal = swig_import_helper()
58 del swig_import_helper
59 else:
~/Downloads/anaconda/lib/python3.6/site-packages/daal/__init__.py in swig_import_helper()
51 if fp is not None:
52 try:
---> 53 _mod = imp.load_module('_daal', fp, pathname, description)
54 finally:
55 fp.close()
~/Downloads/anaconda/lib/python3.6/imp.py in load_module(name, file, filename, details)
241 return load_dynamic(name, filename, opened_file)
242 else:
--> 243 return load_dynamic(name, filename, file)
244 elif type_ == PKG_DIRECTORY:
245 return load_package(name, filename)
~/Downloads/anaconda/lib/python3.6/imp.py in load_dynamic(name, path, file)
341 spec = importlib.machinery.ModuleSpec(
342 name=name, loader=loader, origin=path)
--> 343 return _load(spec)
344
345 else:
ImportError: dlopen(/Users/Monday123/Downloads/anaconda/lib/python3.6/site-packages/daal/_daal.cpython-36m-darwin.so, 2): Library not loaded: #rpath/libdaal_core.dylib
Referenced from: /Users/Monday123/Downloads/anaconda/lib/python3.6/site-packages/daal/_daal.cpython-36m-darwin.so
Reason: image not found
I can see there are few similar issues but mine relate to Library not loaded: #rpath/libdaal_core.dylib. Not sure how to fix this.
Many Thanks
Related
I am trying to run this demo notebook on colab and I am getting the following pytorch error when importing LayoutLMv2ForTokenClassification:
from transformers import LayoutLMv2ForTokenClassification
Error:
ModuleNotFoundError Traceback (most recent call last)
~\PycharmProjects\playground\camelot\camelotenv\lib\site-packages\transformers\utils\import_utils.py in _get_module(self, module_name)
1029 try:
-> 1030 return importlib.import_module("." + module_name, self.__name__)
1031 except Exception as e:
~\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py in import_module(name, package)
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
128
~\AppData\Local\Programs\Python\Python39\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
~\AppData\Local\Programs\Python\Python39\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
~\AppData\Local\Programs\Python\Python39\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)
~\AppData\Local\Programs\Python\Python39\lib\importlib\_bootstrap.py in _load_unlocked(spec)
~\AppData\Local\Programs\Python\Python39\lib\importlib\_bootstrap_external.py in exec_module(self, module)
~\AppData\Local\Programs\Python\Python39\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\PycharmProjects\playground\camelot\camelotenv\lib\site-packages\transformers\models\layoutlmv2\modeling_layoutlmv2.py in <module>
48 import detectron2
---> 49 from detectron2.modeling import META_ARCH_REGISTRY
50
~\PycharmProjects\playground\camelot\camelotenv\lib\site-packages\detectron2\modeling\__init__.py in <module>
19 )
---> 20 from .meta_arch import (
21 META_ARCH_REGISTRY,
~\PycharmProjects\playground\camelot\camelotenv\lib\site-packages\detectron2\modeling\meta_arch\__init__.py in <module>
5
----> 6 from .panoptic_fpn import PanopticFPN
7
~\PycharmProjects\playground\camelot\camelotenv\lib\site-packages\detectron2\modeling\meta_arch\panoptic_fpn.py in <module>
13 from .build import META_ARCH_REGISTRY
---> 14 from .rcnn import GeneralizedRCNN
15 from .semantic_seg import build_sem_seg_head
~\PycharmProjects\playground\camelot\camelotenv\lib\site-packages\detectron2\modeling\meta_arch\rcnn.py in <module>
17 from ..proposal_generator import build_proposal_generator
---> 18 from ..roi_heads import build_roi_heads
19 from .build import META_ARCH_REGISTRY
~\PycharmProjects\playground\camelot\camelotenv\lib\site-packages\detectron2\modeling\roi_heads\__init__.py in <module>
14 )
---> 15 from .roi_heads import (
16 ROI_HEADS_REGISTRY,
~\PycharmProjects\playground\camelot\camelotenv\lib\site-packages\detectron2\modeling\roi_heads\roi_heads.py in <module>
16 from ..matcher import Matcher
---> 17 from ..poolers import ROIPooler
18 from ..proposal_generator.proposal_utils import add_ground_truth_to_proposals
~\PycharmProjects\playground\camelot\camelotenv\lib\site-packages\detectron2\modeling\poolers.py in <module>
9 from detectron2.structures import Boxes
---> 10 from detectron2.utils.tracing import assert_fx_safe
11
~\PycharmProjects\playground\camelot\camelotenv\lib\site-packages\detectron2\utils\tracing.py in <module>
3 import torch
----> 4 from torch.fx._symbolic_trace import _orig_module_call
5 from torch.fx._symbolic_trace import is_fx_tracing as is_fx_tracing_current
ModuleNotFoundError: No module named 'torch.fx._symbolic_trace'
The above exception was the direct cause of the following exception:
RuntimeError Traceback (most recent call last)
<ipython-input-36-b5a73c6d310a> in <module>
4 device_ids = [0,1]
5
----> 6 from transformers import LayoutLMv2ForTokenClassification, TrainingArguments, Trainer
7 from datasets import load_metric
8 import numpy as np
~\AppData\Local\Programs\Python\Python39\lib\importlib\_bootstrap.py in _handle_fromlist(module, fromlist, import_, recursive)
~\PycharmProjects\playground\camelot\camelotenv\lib\site-packages\transformers\utils\import_utils.py in __getattr__(self, name)
1019 elif name in self._class_to_module.keys():
1020 module = self._get_module(self._class_to_module[name])
-> 1021 value = getattr(module, name)
1022 else:
1023 raise AttributeError(f"module {self.__name__} has no attribute {name}")
~\PycharmProjects\playground\camelot\camelotenv\lib\site-packages\transformers\utils\import_utils.py in __getattr__(self, name)
1018 value = self._get_module(name)
1019 elif name in self._class_to_module.keys():
-> 1020 module = self._get_module(self._class_to_module[name])
1021 value = getattr(module, name)
1022 else:
~\PycharmProjects\playground\camelot\camelotenv\lib\site-packages\transformers\utils\import_utils.py in _get_module(self, module_name)
1030 return importlib.import_module("." + module_name, self.__name__)
1031 except Exception as e:
-> 1032 raise RuntimeError(
1033 f"Failed to import {self.__name__}.{module_name} because of the following error (look up to see its"
1034 f" traceback):\n{e}"
RuntimeError: Failed to import transformers.models.layoutlmv2.modeling_layoutlmv2 because of the following error (look up to see its traceback):
No module named 'torch.fx._symbolic_trace'
Can anyone please help?
Thanks!
This is issue from importing torch.fix flag check for symbolic trace and new commit error of detectron (use 5aeb252b194b93dc2879b4ac34bc51a31b5aee13 this checkout and install )
for temporary work
or clone pytorch with new commit
I'm using the latest version of win32com on Windows 7 and Python 3.6. import win32com.client working fine until recently. I'm now getting an UnpicklingError exception.
I've tried reinstalling the latest version globally as well as in a separate virtual environment.
In [1]: import win32com.client
---------------------------------------------------------------------------
UnpicklingError Traceback (most recent call last)
<ipython-input-1-acfbed532f32> in <module>()
----> 1 import win32com.client
C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\__init__.py in <module>()
9 import pythoncom
10 from . import dynamic
---> 11 from . import gencache
12 import sys
13 import pywintypes
C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\gencache.py in <module>()
658
659 # Boot up
--> 660 __init__()
661
662 def usage():
C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\gencache.py in __init__()
58 # Initialize the module. Called once explicitly at module import below
59 try:
---> 60 _LoadDicts()
61 except IOError:
62 Rebuild()
C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\gencache.py in _LoadDicts()
111 try:
112 p = pickle.Unpickler(f)
--> 113 version = p.load()
114 global clsidToTypelib
115 clsidToTypelib = p.load()
UnpicklingError: invalid load key, '\x00'.
I am using Python with anaconda distribution for converting a satellite image to array for further processing.But while using .ReadAsArray() function the below error is occurring.I have tried to search about the error but no proper results are coming.I have installed everything using conda command.
from osgeo import gdal
ds = gdal.Open('/home/alay/Desktop/Studies/2010/ndvi01jun2010.tif')
band = ds.GetRasterBand(1)
img= band.ReadAsArray()
The error occuring after executing the above code
ImportError Traceback (most recent call last)
~/.local/lib/python3.6/site-packages/osgeo/gdal_array.py in
swig_import_helper()
17 try:
---> 18 fp, pathname, description = imp.find_module('_gdal_array', [dirname(__file__)])
19 except ImportError:
~/anaconda3/lib/python3.6/imp.py in find_module(name, path)
296 else:
--> 297 raise ImportError(_ERR_MSG.format(name), name=name)
298
ImportError: No module named '_gdal_array'
During handling of the above exception, another exception occurred:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-4-eae4e7981f3a> in <module>()
----> 1 img= band.ReadAsArray()
~/.local/lib/python3.6/site-packages/osgeo/gdal.py in ReadAsArray(self, xoff, yoff, win_xsize, win_ysize, buf_xsize, buf_ysize, buf_type, buf_obj, resample_alg, callback, callback_data)
2603 parameters should generally not be specified if buf_obj is specified. The array is returned"""
2604
-> 2605 from . import gdalnumeric
2606
2607 return gdalnumeric.BandReadAsArray( self, xoff, yoff,
~/.local/lib/python3.6/site-packages/osgeo/gdalnumeric.py in <module>()
----> 1 from osgeo.gdal_array import *
2 from numpy import *
~/.local/lib/python3.6/site-packages/osgeo/gdal_array.py in <module>()
26 fp.close()
27 return _mod
---> 28 _gdal_array = swig_import_helper()
29 del swig_import_helper
30 else:
~/.local/lib/python3.6/site-packages/osgeo/gdal_array.py in swig_import_helper()
18 fp, pathname, description = imp.find_module('_gdal_array', [dirname(__file__)])
19 except ImportError:
---> 20 import _gdal_array
21 return _gdal_array
22 if fp is not None:
ModuleNotFoundError: No module named '_gdal_array'
I'm trying to use Google's Colaboratory. The first line of output was hopeful.
Using TensorFlow backend.
But then I got this error message.
ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory
That error apparently triggered another error. (Sorry for the long stack trace, but the error message itself suggested including it when asking for help.)
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
<ipython-input-6-0b846698ae4a> in <module>()
2 import numpy as np
3 import matplotlib.pylab as plt
----> 4 from keras.models import Sequential
5 from keras.layers import Dense, InputLayer
6
/usr/local/lib/python3.6/dist-packages/keras/__init__.py in <module>()
1 from __future__ import absolute_import
2
----> 3 from . import utils
4 from . import activations
5 from . import applications
/usr/local/lib/python3.6/dist-packages/keras/utils/__init__.py in <module>()
4 from . import data_utils
5 from . import io_utils
----> 6 from . import conv_utils
7
8 # Globally-importable utils.
/usr/local/lib/python3.6/dist-packages/keras/utils/conv_utils.py in <module>()
7 from six.moves import range
8 import numpy as np
----> 9 from .. import backend as K
10
11
/usr/local/lib/python3.6/dist-packages/keras/backend/__init__.py in <module>()
82 elif _BACKEND == 'tensorflow':
83 sys.stderr.write('Using TensorFlow backend.\n')
---> 84 from .tensorflow_backend import *
85 else:
86 raise ValueError('Unknown backend: ' + str(_BACKEND))
/usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py in <module>()
3 from __future__ import print_function
4
----> 5 import tensorflow as tf
6 from tensorflow.python.training import moving_averages
7 from tensorflow.python.ops import tensor_array_ops
/usr/local/lib/python3.6/dist-packages/tensorflow/__init__.py in <module>()
22
23 # pylint: disable=g-bad-import-order
---> 24 from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
25 # pylint: disable=wildcard-import
26 from tensorflow.tools.api.generator.api import * # pylint: disable=redefined-builtin
/usr/local/lib/python3.6/dist-packages/tensorflow/python/__init__.py in <module>()
47 import numpy as np
48
---> 49 from tensorflow.python import pywrap_tensorflow
50
51 # Protocol buffers
/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py in <module>()
72 for some common reasons and solutions. Include the entire stack trace
73 above this error message when asking for help.""" % traceback.format_exc()
---> 74 raise ImportError(msg)
75
76 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python3.6/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.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: libcublas.so.9.0: 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.
Below that was a suggestion to consult https://www.tensorflow.org/install/install_sources#common_installation_problems.
But that page is about installing TensorFlow from source. I'm not trying to install from source. I just want a runnable version that I can call.
Any suggestions would be appreciated.
Thanks.
When I try to import a module from sklearn a receive an error:
In [1]: import sklearn
In [2]: from sklearn.linear_model import Lasso
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-b932cb9c16f8> in <module>()
----> 1 from sklearn.linear_model import Lasso
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/__init__.py in <module>()
10 # complete documentation.
11
---> 12 from .base import LinearRegression
13
14 from .bayes import BayesianRidge, ARDRegression
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/base.py in <module>()
26 from ..externals.joblib import Parallel, delayed
27 from ..base import BaseEstimator, ClassifierMixin, RegressorMixin
---> 28 from ..utils import as_float_array, atleast2d_or_csr, safe_asarray
29 from ..utils.extmath import safe_sparse_dot
30 from ..utils.sparsefuncs import mean_variance_axis0, inplace_column_scale
/usr/local/lib/python3.4/dist-packages/sklearn/utils/__init__.py in <module>()
9
10 from .murmurhash import murmurhash3_32
---> 11 from .validation import (as_float_array, check_arrays, safe_asarray,
12 assert_all_finite, array2d, atleast2d_or_csc,
13 atleast2d_or_csr, warn_if_not_float,
/usr/local/lib/python3.4/dist-packages/sklearn/utils/validation.py in <module>()
15
16 from ..externals import six
---> 17 from .fixes import safe_copy
18
19
/usr/local/lib/python3.4/dist-packages/sklearn/utils/fixes.py in <module>()
103
104 try:
--> 105 with ignore_warnings():
106 # Don't raise the numpy deprecation warnings that appear in
107 # 1.9
/usr/local/lib/python3.4/dist-packages/sklearn/utils/testing.py in __enter__(self)
297
298 def __enter__(self):
--> 299 clean_warning_registry() # be safe and not propagate state + chaos
300 warnings.simplefilter('always')
301 if self._entered:
/usr/local/lib/python3.4/dist-packages/sklearn/utils/testing.py in clean_warning_registry()
582 reg = "__warningregistry__"
583 for mod in sys.modules.copy().values():
--> 584 if hasattr(mod, reg):
585 getattr(mod, reg).clear()
586
/usr/lib/python3/dist-packages/scipy/lib/six.py in __getattr__(self, attr)
114 if attr in ("__file__", "__name__") and self.mod not in sys.modules:
115 raise AttributeError
--> 116 _module = self._resolve()
117 value = getattr(_module, attr)
118 setattr(self, attr, value)
/usr/lib/python3/dist-packages/scipy/lib/six.py in _resolve(self)
103
104 def _resolve(self):
--> 105 return _import_module(self.mod)
106
107 def __getattr__(self, attr):
/usr/lib/python3/dist-packages/scipy/lib/six.py in _import_module(name)
74 def _import_module(name):
75 """Import module, returning the module after the last dot."""
---> 76 __import__(name)
77 return sys.modules[name]
78
ImportError: No module named 'winreg'
In [3]:
I have installed sklearn with the command pip3 as explained in the official documentation
In [3]: sklearn.__version__
Out[3]: '0.15.1'
winreg should be a module available only for windows... how can I solve this?
EDIT:
This is the command that I have used to install sklearn :
sudo pip3 install -U scikit-learn
I have solved removing sklearn and installing the git version as explained here
https://askubuntu.com/questions/449326/installation-error-in-sklearn-for-python3