Invalid kube-config file. No configuration found - python

I am new to kubectl and kserve.
Tried to implement and create inference service using the below tutorial.
https://www.kubeflow.org/docs/external-add-ons/kserve/first_isvc_kserve/
But while creating the InferenceService I am getting the below error. Can some one help me in this.
KServe = KServeClient()
KServe.create(isvc)
Error:
---------------------------------------------------------------------------
ConfigException Traceback (most recent call last)
<ipython-input-7-0b03661604ad> in <module>()
----> 1 KServe = KServeClient()
2 KServe.create(isvc)
2 frames
/usr/local/lib/python3.7/dist-packages/kubernetes/config/kube_config.py in _get_kube_config_loader(filename, config_dict, persist_config, **kwargs)
766 if kcfg.config is None:
767 raise ConfigException(
--> 768 'Invalid kube-config file. '
769 'No configuration found.')
770 return KubeConfigLoader(
**ConfigException: Invalid kube-config file. No configuration found.**

Related

How to create a Great Expectations Suite from a Pandas Profiling Report

As already stated in the title I want to generate so called 'assertions' via Great Expectation. I've done it the normal way by creating a connection to datasource. Now I want to combine it with Pandas Profiling, i.e. creating an Expectation Suite based on a Profiling Report. According to the documentation it should look something like this. However, it does not work as you can see in the error below.
import great_expectations as ge
import pandas as pd
from pandas_profiling import ProfileReport
import os
p = os.getcwd()
p += "\data\cars.csv"
df = pd.read_csv(p)
profile = ProfileReport(df, title="Pandas Profiling Report", explorative=True)
# Example 1
# Obtain expectation suite, this includes profiling the dataset, saving the expectation suite, validating the
# dataframe, and building data docs
suite = profile.to_expectation_suite(suite_name="cars_expectations")
That throws following error:
Summarize dataset: 100%
81/81 [00:37<00:00, 3.01it/s, Completed]
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
C:\ProgramData\Anaconda3\lib\site-packages\great_expectations\data_context\data_context\base_data_context.py in run_validation_operator(self, validation_operator_name, assets_to_validate, run_id, evaluation_parameters, run_name, run_time, result_format, **kwargs)
510 try:
--> 511 validation_operator = self.validation_operators[validation_operator_name]
512 except KeyError:
KeyError: 'action_list_operator'
During handling of the above exception, another exception occurred:
DataContextError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_4484/2792258824.py in <module>
16 # Obtain expectation suite, this includes profiling the dataset, saving the expectation suite, validating the
17 # dataframe, and building data docs
---> 18 suite = profile.to_expectation_suite(suite_name="cars_expectations")
C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\expectations_report.py in to_expectation_suite(self, suite_name, data_context, save_suite, run_validation, build_data_docs, handler)
101 batch = ge.dataset.PandasDataset(self.df, expectation_suite=suite)
102
--> 103 results = data_context.run_validation_operator(
104 "action_list_operator", assets_to_validate=[batch]
105 )
C:\ProgramData\Anaconda3\lib\site-packages\great_expectations\core\usage_statistics\usage_statistics.py in usage_statistics_wrapped_method(*args, **kwargs)
302 nested_update(event_payload, args_payload_fn(*args, **kwargs))
303
--> 304 result = func(*args, **kwargs)
305 message["success"] = True
306 except Exception:
C:\ProgramData\Anaconda3\lib\site-packages\great_expectations\data_context\data_context\base_data_context.py in run_validation_operator(self, validation_operator_name, assets_to_validate, run_id, evaluation_parameters, run_name, run_time, result_format, **kwargs)
511 validation_operator = self.validation_operators[validation_operator_name]
512 except KeyError:
--> 513 raise ge_exceptions.DataContextError(
514 f"No validation operator `{validation_operator_name}` was found in your project. Please verify this in your great_expectations.yml"
515 )
DataContextError: No validation operator `action_list_operator` was found in your project. Please verify this in your great_expectations.yml
I am using:
Pandas-Profiling 3.4.0,
Great Expectations 0.15.32
Thanks for your help in advance.

I keep getting Json decodeerror every time I use woocommerce python API

I am trying to get the json data of my woocommerce product list with python but I keep getting errors despite supplying the necessary details. If I try to get the text format, it returns the html correctly.
from woocommerce import API
wcapi = API(url='http://localhost/mysite/index.php/product/pizza/',
consumer_key="ck_xxxxxxxxxxx",
consumer_secret="cs_xxxxxxxxx",
version="wc/v3")
get_product=wcapi.get("products").json()
print(get_product)
The Error:
JSONDecodeError Traceback (most recent call last)
<ipython-input-27-d30acb9b03bb> in <module>
4 consumer_secret="cs_ee6fbd92294f88051d8e1a5a2c0201ab1a0f6aff",
5 version="wc/v3")
----> 6 get_product=wcapi.get("products").json()
7 print(get_product)
~\anaconda3\lib\site-packages\requests\models.py in json(self, **kwargs)
973 # Catch JSON-related errors and raise as requests.JSONDecodeError
974 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
--> 975 raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
976
977 #property
JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Issues with loading .s2p file in python notebook using scikit-rf

Hi i am having issues with loading the .s2p file
when i ran the following code
import skrf as rf
from skrf import Network, Frequency
data1 = rf.Network('/Users/pradeeps/Desktop/Project/meas2018_07_06/300MHzNLOSX1DPS.s2p')
It showed the following error as shown below
---------------------------------------------------------------------------
UnpicklingError Traceback (most recent call last)
File ~/Desktop/Project/project/lib/python3.10/site-packages/skrf/network.py:450, in Network.__init__(self, file, name, params, comments, f_unit, s_def, **kwargs)
449 try:
--> 450 self.read(fid)
451 except UnicodeDecodeError: # Support for pickles created in Python2 and loaded in Python3
File ~/Desktop/Project/project/lib/python3.10/site-packages/skrf/network.py:2357, in Network.read(self, *args, **kwargs)
2356 from .io.general import read
-> 2357 self.copy_from(read(*args, **kwargs))
File ~/Desktop/Project/project/lib/python3.10/site-packages/skrf/io/general.py:140, in read(file, *args, **kwargs)
139 try:
--> 140 obj = pickle.load(fid, *args, **kwargs)
141 except (UnpicklingError, UnicodeDecodeError) as e:
142 # if fid is seekable then reset to beginning of file
UnpicklingError: invalid load key, '3'.
During handling of the above exception, another exception occurred:
NotImplementedError Traceback (most recent call last)
Untitled-1.ipynb Cell 2' in <cell line: 1>()
----> 1 data1 = rf.Network('/Users/pradeeps/Desktop/Project/meas2018_07_06/300MHzNLOSX1DPS.s2p')
File ~/Desktop/Project/project/lib/python3.10/site-packages/skrf/network.py:458, in Network.__init__(self, file, name, params, comments, f_unit, s_def, **kwargs)
456 filename = fid.name
457 fid.close()
--> 458 self.read_touchstone(filename, self.encoding)
460 if name is None and isinstance(file, str):
461 name = os.path.splitext(os.path.basename(file))[0]
File ~/Desktop/Project/project/lib/python3.10/site-packages/skrf/network.py:1956, in Network.read_touchstone(self, filename, encoding)
1953 touchstoneFile = touchstone.Touchstone(filename, encoding=encoding)
1955 if touchstoneFile.get_format().split()[1] != 's':
-> 1956 raise NotImplementedError('only s-parameters supported for now.')
1958 self.comments = touchstoneFile.get_comments()
1960 try:
NotImplementedError: only s-parameters supported for now.
As shown in this particular code i used scikit-rf is there any other package that i should use in this particular instance or am i doing anything wrong.
Thank you

Google AdManager getCurrentNetwork() error

I have set up ad manager credentials. I'm trying to access the Admanager API, im getting the following error.
from googleads import ad_manager
client = ad_manager.AdManagerClient.LoadFromStorage()
network_service = client.GetService('NetworkService', version='v201902')
current_network = network_service.getCurrentNetwork()
the error im facing is:
Fault Traceback (most recent call last)
~\Anaconda3\lib\site-packages\googleads\common.py in MakeSoapRequest(*args)
1381 return soap_service_method(
-> 1382 *packed_args, _soapheaders=soap_headers)['body']['rval']
1383 except zeep.exceptions.Fault as e:
~\Anaconda3\lib\site-packages\zeep\proxy.py in __call__(self, *args, **kwargs)
41 self._proxy._client, self._proxy._binding_options,
---> 42 self._op_name, args, kwargs)
43
~\Anaconda3\lib\site-packages\zeep\wsdl\bindings\soap.py in send(self, client, options, operation, args, kwargs)
131
--> 132 return self.process_reply(client, operation_obj, response)
133
~\Anaconda3\lib\site-packages\zeep\wsdl\bindings\soap.py in process_reply(self, client, operation, response)
193 if response.status_code != 200 or fault_node is not None:
--> 194 return self.process_error(doc, operation)
195
~\Anaconda3\lib\site-packages\zeep\wsdl\bindings\soap.py in process_error(self, doc, operation)
287 actor=None,
--> 288 detail=etree_to_string(doc))
289
Fault: Unknown fault occured
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
<ipython-input-16-991c0839fc99> in <module>()
----> 1 current_network = network_service.getCurrentNetwork()
~\Anaconda3\lib\site-packages\googleads\common.py in MakeSoapRequest(*args)
1385 if e.detail is not None:
1386 underlying_exception = e.detail.find(
-> 1387 '{%s}ApiExceptionFault' % self._GetBindingNamespace())
1388 fault_type = self.zeep_client.get_element(
1389 '{%s}ApiExceptionFault' % self._GetBindingNamespace())
TypeError: a bytes-like object is required, not 'str'
You are probably missing permissions with your configured service account. Make sure the account has access to ad-manager and scopes are configured properly.
I suggest to do it this way:
class Adx:
def __init__(self):
self.GOOGLEADS_YAML = 'googleads.yaml'
self.GOOGLEADS_VERSION = 'v202111'
self.google_keys = self.GOOGLEADS_YAML
def activate(self):
ad_manager_client = ad_manager.AdManagerClient.LoadFromStorage(self.google_keys)

Cannot load graphlab.sframe

I have joined Machine Learning course on coursera. I am facing an issue while executing following command:
sales = graphlab.SFrame('home_data.gl/')
THe error is as follows:
IOError Traceback (most recent call last)
<ipython-input-9-e5b5a1ead746> in <module>()
----> 1 sales = graphlab.SFrame('home_data.gl')
C:\Users\admin\Anaconda2\envs\gl-env\lib\site-packages\graphlab
\data_structures\sframe.pyc in __init__(self, data, format, _proxy)
951 pass
952 else:
--> 953 raise ValueError('Unknown input type: ' + format)
954
955 sframe_size = -1
C:\Users\admin\Anaconda2\envs\gl-env\lib\site-packages\graphlab\cython\context.pyc in __exit__(self, exc_type, exc_value, traceback)
47 if not self.show_cython_trace:
48 # To hide cython trace, we re-raise from here
---> 49 raise exc_type(exc_value)
50 else:
51 # To show the full trace, we do nothing and let exception propagate
IOError: Cannot open C:/Users/admin/home_data.gl/dir_archive.ini for read. Cannot open C:/Users/admin/home_data.gl/dir_archive.ini for reading
Can you please help me to resolve this issue?
Go to terminal and run:
unzip home_data.gl.zip
You will see following files in directory home_data.gl:
Now in ipython, run:
sales = graphlab.SFrame('home_data.gl/')
sales
which will display the data in tabular format:

Categories

Resources