boxsdk demo/auth.py fails on from boxsdk import OAuth2 - python-3.x

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)`

Related

Not able to import _check_y from sklearn.utils.validation

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)

"OSError: Starting path not found" when importing spotifycharts

I get the following error when importing spotifycharts:
OSError: Starting path not found
When I do pip freeze it's listed.
Full error:
OSError Traceback (most recent call last)
/var/folders/fm/ck9x_7l55y93t7gkxl93g_q40000gn/T/ipykernel_57786/3799758561.py in <module>
1 import environs
----> 2 import spotifycharts as sc
/opt/anaconda3/envs/python39/lib/python3.9/site-packages/spotifycharts/__init__.py in <module>
9 from tqdm import auto
10
---> 11 from spotifycharts import classes
12 from spotifycharts import settings
13 from spotifycharts import exceptions
/opt/anaconda3/envs/python39/lib/python3.9/site-packages/spotifycharts/classes.py in <module>
10
11 import spotifycharts as sc
---> 12 from spotifycharts import settings
13 from spotifycharts import exceptions
14 from spotifycharts.logging import logger
/opt/anaconda3/envs/python39/lib/python3.9/site-packages/spotifycharts/settings.py in <module>
1 import environs
2 configuration = environs.Env()
----> 3 configuration.read_env('spotifycharts/configuration.env')
4
5
/opt/anaconda3/envs/python39/lib/python3.9/site-packages/environs/__init__.py in read_env(path, recurse, verbose, override)
413 if not start_dir: # Only a filename was given
414 start_dir = os.getcwd()
--> 415 for dirname in _walk_to_root(start_dir):
416 check_path = Path(dirname) / env_name
417 if check_path.exists():
/opt/anaconda3/envs/python39/lib/python3.9/site-packages/dotenv/main.py in _walk_to_root(path)
244 """
245 if not os.path.exists(path):
--> 246 raise IOError('Starting path not found')
247
248 if os.path.isfile(path):
OSError: Starting path not found
How do I solve this?
Was able to find a workaround.
Open the settings.py file located in /opt/anaconda3/envs/python39/lib/python3.9/site-packages/spotifycharts/ in above case.
Add the full path to the read_env() method
Change
configuration.read_env('spotifycharts/configuration.env')
to
configuration.read_env('/opt/anaconda3/envs/python39/lib/python3.9/site-packages/spotifycharts/configuration.env')

No module named keras.api Mask R CNN

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

How can I eliminate "UnpicklingError: invalid load key, '\x00'" in win32com?

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'.

ImportError: DLL load failed: The specified procedure could not be found. (import sklearn)

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

Resources