Kotak-Neo / kotak-neo-api

120 stars 112 forks source link

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

Open neelnith opened 6 months ago

neelnith commented 6 months ago

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.

OSSDeveloper commented 6 months ago

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.

neelnith commented 6 months ago

Thank you for your response.

On Tue, May 21, 2024 at 12:14 PM Vijay @.***> wrote:

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

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 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 from now 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.

— Reply to this email directly, view it on GitHub https://github.com/Kotak-Neo/kotak-neo-api/issues/161#issuecomment-2121866045, or unsubscribe https://github.com/notifications/unsubscribe-auth/BIGMX3PUH3KNXAX3BI2EIWTZDLUMPAVCNFSM6AAAAABHBO24GGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRRHA3DMMBUGU . You are receiving this because you authored the thread.Message ID: @.***>

-- Neelmani Singh

kbizme commented 5 months ago

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.

v42un commented 1 month ago

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.

thanks, this works!