Kotak-Neo / kotak-neo-api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to install on Py 3.12 >> tried on two different computers.. "AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'"?

neelnith opened this issue · comments

Running command git clone --filter=blob:none --quiet https://github.com/Kotak-Neo/kotak-neo-api.git 'C:\Users\HP\AppData\Local\Temp\pip-install-vkr67pqm\neo-api-client_a4078a578f0045eda49aa3aa32bf5d32'
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [33 lines of output]
Traceback (most recent call last):
File "c:\Users\HP\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in
main()
File "c:\Users\HP\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\HP\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 112, in get_requires_for_build_wheel
backend = _build_backend()
^^^^^^^^^^^^^^^^
File "c:\Users\HP\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 77, in build_backend
obj = import_module(mod_path)
^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\HP\AppData\Local\Programs\Python\Python312\Lib\importlib_init
.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1310, in _find_and_load_unlocked
File "", line 488, in _call_with_frames_removed
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in load_unlocked
File "", line 995, in exec_module
File "", line 488, in call_with_frames_removed
File "C:\Users\HP\AppData\Local\Temp\pip-build-env-794offe2\overlay\Lib\site-packages\setuptools_init
.py", line 16, in
import setuptools.version
File "C:\Users\HP\AppData\Local\Temp\pip-build-env-794offe2\overlay\Lib\site-packages\setuptools\version.py", line 1, in
import pkg_resources
File "C:\Users\HP\AppData\Local\Temp\pip-build-env-794offe2\overlay\Lib\site-packages\pkg_resources_init
.py", line 2172, in
register_finder(pkgutil.ImpImporter, find_on_path)
^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

The issue is because the kotak neo api client requires websockets 8.1 and other modules might require more advanced versions of websockets.

Especially when you are using python 3.12 or higher. Better you use python 3.11.9 or lower.

After that, you should encounter other version conflicts with websockets. Pls follow below process to resolve and use the api client.

In requirements.txt file

  1. In requirements.txt file comment neo-api-client in your requirements.txt

  2. In requirements.txt file If websockets==8.1 is present in your requirements, change that to websockets

  3. Install the requirements (pip install -r requirements.txt)

  4. install neo api client with the command given in the readme file

    currently it is : pip install "git+https://github.com/Kotak-Neo/kotak-neo-api.git#egg=neo_api_client"

  5. install the latest websockets library on top of the existing websockets library(installed with neo 8.1)

    currently it is : pip install websockets==12

Your program should work. But you better not use requirements.txt and manually install each required library from now on.

Once you get a grip of python package management and requirements installation, you can use requirements.

Once Kotak upgrades its libraries, the issues must be resolved.

I was also facing this error, then i formed this repo, and made some changes in the setup.py file, and then installed it from the forked repo, and it installed like a charm. If you're still facing this issue, you can install from this forked repo. Here's the link --
https://github.com/kbizme/kotak-neo-api-qp

or type this in terminal -
pip install "git+https://github.com/kbizme/kotak-neo-api-qp.git"

Hope it'll work.
Edit: I'm looking forward for the kotak neo developers to make changes in the master version, then I'll use the master repo.