ImportError Traceback (most recent call last)
in
55
56 filename = '/local/home/amajum/XXX/YYY/ZZZ/' + filename
---> 57 loaded_model = pickle.load(open(filename, 'rb'))
58
59 pred = loaded_model.predict(new_sellers)
~/anaconda3/lib/python3.8/site-packages/feature_engine/encoding/init.py in
3 """
4
----> 5 from .count_frequency import CountFrequencyEncoder
6 from .decision_tree import DecisionTreeEncoder
7 from .mean_encoding import MeanEncoder
~/anaconda3/lib/python3.8/site-packages/feature_engine/encoding/count_frequency.py in
16 )
17 from feature_engine._docstrings.substitute import Substitution
---> 18 from feature_engine.dataframe_checks import check_X
19 from feature_engine.encoding._docstrings import (
20 _errors_docstring,
~/anaconda3/lib/python3.8/site-packages/feature_engine/dataframe_checks.py in
8 import pandas as pd
9 from scipy.sparse import issparse
---> 10 from sklearn.utils.validation import _check_y, check_consistent_length
11
12
ImportError: cannot import name '_check_y' from 'sklearn.utils.validation' (/home/amajum/anaconda3/lib/python3.8/site-packages/sklearn/utils/validation.py)
Related
I am in the demo file of the Mask R CNN repo from matterport. Trying to run the first cell but encountering the following error. I have keras 2.3.0 installed. Running Python 3.8. The below is a trace of the error from the model.py file inside the Mask R CNN repo, which came with the clone. Thanks!
The repo referred to is here: https://github.com/matterport/Mask_RCNN.git
Thank you all for your kind support.
ModuleNotFoundError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_3220/983756133.py in <module>
7 import matplotlib
8 import matplotlib.pyplot as plt
----> 9 import keras
10
11 # Root directory of the project
~\OneDrive\New Project\myenv1\lib\site-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
~\OneDrive\New Project\myenv1\lib\site-packages\keras\utils\__init__.py in <module>
24 from .layer_utils import get_source_inputs
25 from .layer_utils import print_summary
---> 26 from .vis_utils import model_to_dot
27 from .vis_utils import plot_model
28 from .np_utils import to_categorical
~\OneDrive\New Project\myenv1\lib\site-packages\keras\utils\vis_utils.py in <module>
5
6 import os
----> 7 from ..models import Model
8 from ..layers.wrappers import Wrapper
9
~\OneDrive\New Project\myenv1\lib\site-packages\keras\models.py in <module>
10 from .engine.input_layer import Input
11 from .engine.input_layer import InputLayer
---> 12 from .engine.training import Model
13 from .engine.sequential import Sequential
14 from .engine.saving import save_model
~\OneDrive\New Project\myenv1\lib\site-packages\keras\engine\__init__.py in <module>
6 from .base_layer import Layer
7 from .network import get_source_inputs
----> 8 from .training import Model
~\OneDrive\New Project\myenv1\lib\site-packages\keras\engine\training.py in <module>
12 from .network import Network
13 from .base_layer import Layer
---> 14 from . import training_utils
15 from . import training_arrays
16 from . import training_generator
~\OneDrive\New Project\myenv1\lib\site-packages\keras\engine\training_utils.py in <module>
15 from .. import backend as K
16 from .. import losses
---> 17 from .. import metrics as metrics_module
18 from ..utils import Sequence
19 from ..utils import generic_utils
~\OneDrive\New Project\myenv1\lib\site-packages\keras\metrics.py in <module>
1848 import tensorflow as tf
1849 if tf.__version__ >= '2.0.0':
-> 1850 BaseMeanIoU = tf.keras.metrics.MeanIoU
1851
1852
~\OneDrive\New Project\myenv1\lib\site-packages\tensorflow\python\util\lazy_loader.py in __getattr__(self, item)
60
61 def __getattr__(self, item):
---> 62 module = self._load()
63 return getattr(module, item)
64
~\OneDrive\New Project\myenv1\lib\site-packages\tensorflow\python\util\lazy_loader.py in _load(self)
43 """Load the module and insert it into the parent's globals."""
44 # Import the target module and insert it into the parent's namespace
---> 45 module = importlib.import_module(self.__name__)
46 self._parent_module_globals[self._local_name] = module
47
~\AppData\Local\Programs\Python\Python38\lib\importlib\__init__.py in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
128
129
ModuleNotFoundError: No module named 'keras.api'
I read the repo that you have referred. You maybe try run your code with environment below:
Python 3.4, TensorFlow 1.3, Keras 2.0.8
I installed the recent version of Anaconda but "Import sklearn" gives an error
ImportError Traceback (most recent call last)
<ipython-input-5-b7c74cbf5af0> in <module>
----> 1 import sklearn
~\anaconda3\lib\site-packages\sklearn\__init__.py in <module>
62 else:
63 from . import __check_build
---> 64 from .base import clone
65 from .utils._show_versions import show_versions
66
~\anaconda3\lib\site-packages\sklearn\base.py in <module>
11 from scipy import sparse
12 from .externals import six
---> 13 from .utils.fixes import signature
14 from . import __version__
15
~\anaconda3\lib\site-packages\sklearn\utils\__init__.py in <module>
14 from . import _joblib
15 from ..exceptions import DataConversionWarning
---> 16 from .fixes import _Sequence as Sequence
17 from .deprecation import deprecated
18 from .validation import (as_float_array,
~\anaconda3\lib\site-packages\sklearn\utils\fixes.py in <module>
90 from ._scipy_sparse_lsqr_backport import lsqr as sparse_lsqr
91 else:
---> 92 from scipy.sparse.linalg import lsqr as sparse_lsqr # noqa
93
94
~\anaconda3\lib\site-packages\scipy\sparse\linalg\__init__.py in <module>
115 from .dsolve import *
116 from .interface import *
--> 117 from .eigen import *
118 from .matfuncs import *
119 from ._onenormest import *
~\anaconda3\lib\site-packages\scipy\sparse\linalg\eigen\__init__.py in <module>
9 from __future__ import division, print_function, absolute_import
10
---> 11 from .arpack import *
12 from .lobpcg import *
13
~\anaconda3\lib\site-packages\scipy\sparse\linalg\eigen\arpack\__init__.py in <module>
20 from __future__ import division, print_function, absolute_import
21
---> 22 from .arpack import *
~\anaconda3\lib\site-packages\scipy\sparse\linalg\eigen\arpack\arpack.py in <module>
43 __all__ = ['eigs', 'eigsh', 'svds', 'ArpackError', 'ArpackNoConvergence']
44
---> 45 from . import _arpack
46 import numpy as np
47 import warnings
ImportError: DLL load failed: The specified procedure could not be found.
I found out what the problem was. I had created an env file for Jupyter and edited it to open jupyter in Chrome. After updating python, import sklearn did not work. So I had to go back and delete that env file and everything worked fine after that. Hope this helps future readers of this post.
I installed tensorflow 1.8. When import kerasor import tensorflow.Iam getting
ImportError Traceback (most recent call last)
<ipython-input-2-dc6fd3b71e3e> in <module>
----> 1 from keras.preprocessing.text import Tokenizer
2 from keras.preprocessing.sequence import pad_sequences
3 from keras.models import Sequential
4 from keras.layers import Dense, Flatten, LSTM, Conv1D, MaxPooling1D, Dropout, Activation
5 from keras.layers.embeddings import Embedding
~\Anaconda3\lib\site-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
~\Anaconda3\lib\site-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.
~\Anaconda3\lib\site-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
~\Anaconda3\lib\site-packages\keras\backend\__init__.py in <module>
87 elif _BACKEND == 'tensorflow':
88 sys.stderr.write('Using TensorFlow backend.\n')
---> 89 from .tensorflow_backend import *
90 else:
91 # Try and load external backend.
~\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py in <module>
3 from __future__ import print_function
4
----> 5 import tensorflow as tf
6 from tensorflow.python.framework import ops as tf_ops
7 from tensorflow.python.training import moving_averages
~\Anaconda3\lib\site-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
26 try:
~\Anaconda3\lib\site-packages\tensorflow\python\__init__.py in <module>
57
58 # Protocol buffers
---> 59 from tensorflow.core.framework.graph_pb2 import *
60 from tensorflow.core.framework.node_def_pb2 import *
61 from tensorflow.core.framework.summary_pb2 import *
~\Anaconda3\lib\site-packages\tensorflow\core\framework\graph_pb2.py in <module>
4 import sys
5 _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
----> 6 from google.protobuf import descriptor as _descriptor
7 from google.protobuf import message as _message
8 from google.protobuf import reflection as _reflection
~\Anaconda3\lib\site-packages\google\protobuf\descriptor.py in <module>
45 import binascii
46 import os
---> 47 from google.protobuf.pyext import _message
48 _USE_C_DESCRIPTORS = getattr(_message, '_USE_C_DESCRIPTORS', False)
49
ImportError: DLL load failed: The specified procedure could not be found.
Please someone help me with this.
When I import sklearn, it throws this ImportError(DLL load failed: The specified procedure could not be found.)
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-b7c74cbf5af0> in <module>()
----> 1 import sklearn
~\Anaconda3\lib\site-packages\sklearn\__init__.py in <module>()
62 else:
63 from . import __check_build
---> 64 from .base import clone
65 from .utils._show_versions import show_versions
66
~\Anaconda3\lib\site-packages\sklearn\base.py in <module>()
11 from scipy import sparse
12 from .externals import six
---> 13 from .utils.fixes import signature
14 from . import __version__
15
~\Anaconda3\lib\site-packages\sklearn\utils\__init__.py in <module>()
11
12 from .murmurhash import murmurhash3_32
---> 13 from .validation import (as_float_array,
14 assert_all_finite,
15 check_random_state, column_or_1d, check_array,
~\Anaconda3\lib\site-packages\sklearn\utils\validation.py in <module>()
20
21 from ..externals import six
---> 22 from ..utils.fixes import signature
23 from .. import get_config as _get_config
24 from ..exceptions import NonBLASDotWarning
~\Anaconda3\lib\site-packages\sklearn\utils\fixes.py in <module>()
81 return stats.boxcox(x, lmbda)
82 else:
---> 83 from scipy.special import boxcox # noqa
84
85
~\Anaconda3\lib\site-packages\scipy\special\__init__.py in <module>()
638 from .sf_error import SpecialFunctionWarning, SpecialFunctionError
639
--> 640 from ._ufuncs import *
641
642 from .basic import *
ImportError: DLL load failed: The specified procedure could not be found.
If you already have a working installation of numpy and scipy, then do this:
pip install -U scikit-learn
otherwise:
conda install scikit-learn
finally check for updates:
conda update pip
Running on python 3.6 (anaconda)
Tried to run authenticate() within boxsdk: demo/auth.py and get error on import.
Looks like error is happening in /anaconda/lib/python3.6/site-packages/boxsdk/object/events.py....
class EventsStreamType(with_metaclass(ExtendableEnumMeta, TextEnum)):
I did look thru other posts but don't see solution
python - Fix 'new enumerations must be created as' - Stack Overflow
boxsdk 1.x does not import in python 3.6.0 · Issue #195 · box/box ...
ERROR
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-33-e86018378e6f> in <module>()
9 from wsgiref.simple_server import WSGIServer, WSGIRequestHandler, make_server
10
---> 11 from boxsdk import OAuth2
12
13
/anaconda/lib/python3.6/site-packages/boxsdk/__init__.py in <module>()
4
5 from .auth import JWTAuth, OAuth2
----> 6 from .client import * # pylint:disable=wildcard-import,redefined-builtin
7 from .object import * # pylint:disable=wildcard-import,redefined-builtin
8 from .version import __version__
/anaconda/lib/python3.6/site-packages/boxsdk/client/__init__.py in <module>()
3 from __future__ import unicode_literals, absolute_import
4
----> 5 from .client import Client
6 from .developer_token_client import DeveloperTokenClient
7 from .development_client import DevelopmentClient
/anaconda/lib/python3.6/site-packages/boxsdk/client/client.py in <module>()
10 from ..object.folder import Folder
11 from ..object.search import Search
---> 12 from ..object.events import Events
13 from ..object.file import File
14 from ..object.group import Group
/anaconda/lib/python3.6/site-packages/boxsdk/object/events.py in <module>()
13
14 # pylint:disable=too-many-ancestors
---> 15 class EventsStreamType(with_metaclass(ExtendableEnumMeta, TextEnum)):
16 """An enum of all possible values of the `stream_type` parameter for user events.
17
/anaconda/lib/python3.6/enum.py in __prepare__(metacls, cls, bases)
117 enum_dict = _EnumDict()
118 # inherit previous flags and _generate_next_value_ function
--> 119 member_type, first_enum = metacls._get_mixins_(bases)
120 if first_enum is not None:
121 enum_dict['_generate_next_value_'] = getattr(first_enum, '_generate_next_value_', None)
/anaconda/lib/python3.6/enum.py in _get_mixins_(bases)
437 # base is now the last base in bases
438 if not issubclass(base, Enum):
--> 439 raise TypeError("new enumerations must be created as "
440 "`ClassName([mixin_type,] enum_type)`")
441
TypeError: new enumerations must be created as `ClassName([mixin_type,] enum_type)`