Closed powellquiring closed 2 years ago
@powellquiring I am not sure if I fully grasp the issue. ibmcloudsql does express its prerequisite to pandas and it is also installed as you can see in the output of pip install ibmcloudsql. It the issue seems to be rather with ibm-watson-machine-learning, which is already installed and apparently doesn't like the pandas version that is installed (which ibmcloudsql doesn't actually control entirely. It only has a pandas minimum version that it prereqs: https://github.com/IBM-Cloud/sql-query-clients/blob/master/Python/setup.py#L50) and which is perfectly within the range of by ibm-watson-machine-learning required versions. Not sure why you installed pandas==1.3.4 version explicitly, which is incompatible with ibm-watson-machine-learning requirements.
The other problem seems to be that ibm-watson-machine-learning seems to have a hard requirement on ibm-cos-sdk==2.7.* and ibmcloudsql requires 2.10.0. I think the first approach should be to check with ibm-watson-machine-learning why they have hard prerequisite on older ibm-cos-sdk version and ask them to lift this.
I installed 1.3.4 because of the exception mentioned:
...
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/tmp/wsuser/ipykernel_122/2163707681.py in <module>
42 print(query)
43
---> 44 traffic_location = sqlClient.run_sql(query)
45 print(traffic_location)
/opt/conda/envs/Python-3.8-main/lib/python3.8/site-packages/ibmcloudsql/SQLQuery.py in run_sql(self, sql_text, pagesize)
1665 pprint.pprint(details)
1666 raise e
-> 1667 return self.get_result(job_id)
1668
1669 def run(self, pagesize=None, get_result=False):
/opt/conda/envs/Python-3.8-main/lib/python3.8/site-packages/ibmcloudsql/SQLQuery.py in get_result(self, jobId, pagenumber)
942 body.__iter__ = types.MethodType(self.__iter__, body)
943
--> 944 partition_df = pd.read_csv(body, on_bad_lines='skip')
945
946 elif result_format == "parquet":
TypeError: read_csv() got an unexpected keyword argument 'on_bad_lines'
OK @powellquiring . I added toleration of pandas versions that don't support 'on_bad_lines' (https://github.com/IBM-Cloud/sql-query-clients/blob/master/Python/ibmcloudsql/SQLQuery.py#L944). Published as ibmcloudsql v 0.5.1. Hope this will help you to avoid the conflict with the ibm-watson-machine-learning prerequisite limitations.
Is there a test that verifies ibmcloudsql with the set of prerequisite module versions that are allowed?
I tried this today in PROD. There is no pandas conflict anymore, but ibmcloudsql
requires a new numpy version which leads to conflicts. From the install stack:
Collecting ibmcloudsql
Downloading ibmcloudsql-0.5.9.tar.gz (57 kB)
...
Collecting numpy>=1.22.2
Downloading numpy-1.23.1-cp39....
ERROR:...
scipy 1.7.3 requires numpy<1.23.0,>=1.16.5, but you have numpy 1.23.1 which is incompatible.
numba 0.54.1 requires numpy<1.21,>=1.17, but you have numpy 1.23.1 which is incompatible.
autoai-ts-libs 1.1.9 requires numpy<1.23,>=1.19.2; python_version >= "3.9", but you have numpy 1.23.1 which is incompatible.
autoai-libs 1.13.2 requires numpy<1.22,>=1.19.2; python_version >= "3.9", but you have numpy 1.23.1 which is incompatible.
@torsstei is there a way you can relax the numpy requirement for ibmcloudsql ? In Q4 this year, we will provide new Notebook images that contain numpy 1.23, but for the existing ones, we stay at 1.20...
@alexlang74 OK, I just ran some tests with numpy 1.20.3 and ibmcloudsql seems to work fine. So I have relaxed the prerequisite to 1.20.3 and published ibmcloudsql 0.5.10.
@torsstei Fast as a shark! Just tried, and no more pip errors whatsoever!
@powellquiring Can you try for yourself and close the issue?
I trust you
I need to write two defects:
I think this repo is the right place for the second one: ibmcloudsql is not expressing the dependency requirement correctly for pandas. Please help me find the right place to file the first issue.
First problem: watson studio has conflicting dependencies. Expected: ibmcloudsql would install without errors. Actual: error message produced.
If you tell me where to open this issue I will do so:
New notebook
!pip freeze
!pip install ibmcloudsql
Second problem, dependency on pandas not expressed. Restart Kernel
Cell:
Results:
Upgrade pandas: Cell contents:
Results
Now replay the cell using ibmcloudsql played earlier:
cell contents
Results: