ciscoisesdk icon indicating copy to clipboard operation
ciscoisesdk copied to clipboard

ModuleNotFoundError: No module named 'imp' runtime within PyCharm (python 3.12)

Open andyo-ua opened this issue 2 years ago • 2 comments

Prerequisites

  • [No] Have you tested the operation in the API directly?
  • [Yes ] Do you have the latest SDK version?
  • [Yes ] Review the compatibility matrix before opening an issue.

Describe the bug After adding package to venv in PyCharm (python 3.12) & running trough code below. Traceback shoot with bottom line of "ModuleNotFoundError: No module named 'imp'"

from ciscoisesdk import IdentityServicesEngineAPI from ciscoisesdk.exceptions import ApiError api = IdentityServicesEngineAPI(username='admin', password='Cisco123', uses_api_gateway=True, base_url='https://10.200.200.50', version='3.2_beta', verify=False, debug=False, uses_csrf_token=False) Expected behavior silent code execution

Screenshots curl -X 'GET'
'https://10.200.200.50:443/api/v1/patch'
-H 'accept: application/json'

{ "iseVersion": "3.2.0.542", "patchVersion": [ { "patchNumber": 2, "installDate": "Thu Jul 06 18:46:47 2023" } ] }

Environment (please complete the following information):

  • ISE version and patch: 3.2.0.542 patch 2
  • Python version: 3.12
  • SDK version: 2.1.2
  • OS version: Win10 ent 10.0.19044

Additional context Add any other context about the problem here.

andyo-ua avatar Nov 30 '23 20:11 andyo-ua

I'm getting similar issue with Python 3.12 when using together with Ansible.

Getting error

"msg": "Cisco ISE Python SDK is not installed. Execute 'pip install ciscoisesdk'",
"exception": "NoneType: None\n",

No issues when running the same code in venv with Python 3.9x

markatdxb avatar Jan 08 '24 01:01 markatdxb

Same thing when loading this op to Digital Oceans

[wur-project-itws] [2024-04-24 19:26:57] from future import standard_library [wur-project-itws] [2024-04-24 19:26:57] File "/workspace/.heroku/python/lib/python3.12/site-packages/future/standard_library/init.py", line 65, in [wur-project-itws] [2024-04-24 19:26:57] import imp [wur-project-itws] [2024-04-24 19:26:57] ModuleNotFoundError: No module named 'imp' [wur-project-itws] [2024-04-24 19:26:57] [2024-04-24 19:26:57 +0000] [14] [INFO] Worker exiting (pid: 14) [wur-project-itws] [2024-04-24 19:26:57] [2024-04-24 19:26:57 +0000] [1] [ERROR] Worker (pid:14) exited with code 3 [wur-project-itws] [2024-04-24 19:26:57] [2024-04-24 19:26:57 +0000] [1] [ERROR] Shutting down: Master [wur-project-itws] [2024-04-24 19:26:57] [2024-04-24 19:26:57 +0000] [1] [ERROR] Reason: Worker failed

**The imp module, which is deprecated in Python 3, is being referenced in your code. We should change it to importlib for Python 3

I already try to to replace imp with importlib in the future module directly which is rely on imp). But still I get this message. Later I realised in the future > standard_librarry Init.py the docker in oceans will never see this change, locally I have no issue's I use future version: 0.18.3. When I use version 1.0.0 where there is a fix in place to look at he python version is not compatible with Ciscoisesdk... "ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. ciscoisesdk 2.1.2 requires future<0.19.0,>=0.18.3, but you have future 1.0.0 which is incompatible"

andystevenscodes avatar Apr 24 '24 19:04 andystevenscodes

Hi @andyo-ua

In the new version of ciscoisesdk v2.2.2 the problem had to be solved I'm going to close the issue, if you have a problem feel free to reopen the issue or create a new one Regards

bvargasre avatar Jul 16 '24 20:07 bvargasre