3

Splunklib for Python 3.7 fails to install on my Windows machine. Since pycrypto was not ported to Python 3, I've uninstalled it and installed pycrypodome as replacement. Unfortunately, when trying to install splunklib, pip still tries to install pycrypto.

*Installing collected packages: pycrypto, splunklib
Running setup.py install for pycrypto ... *

Is there a way to force Python or pip to use pycryptodome instead of pycrypto?

peki
  • 669
  • 7
  • 24
Chris Chris
  • 352
  • 3
  • 10

1 Answers1

12

I finally found the way to install it:

  1. Uninstall pycrypto
    pip uninstall pycrypto
  2. Install pycryptodome as replacement of pycypto
    pip install pycryptodome
  3. Install splunklib without dependencies
    pip install splunklib --no-deps
  4. Edit "pythonlib"\splunklib-1.0.0.dist-info\METADATA and replace "Requires-Dist: pycrypto" with "Requires-Dist: pycryptodome"

  5. install splunk-sdk
    pip install splunk-sdk

  6. check that everything is ok
    pip install splunklib
normanius
  • 8,629
  • 7
  • 53
  • 83
Chris Chris
  • 352
  • 3
  • 10
  • You aught to select this as the correct answer - use the tick underneath the voting buttons. – Legorooj Dec 11 '19 at 09:22
  • 2
    Also, splunklib is deprecated. – Legorooj Dec 12 '19 at 00:19
  • 1
    Done, thanks for the reminder. Yes, splunklib is deprecated. I then realized that the code I wanted to port to python 3 was importing splunklib and splunklib.client but was only using the second one, which comes from splunk-sdk lib. Removing "import splunklib" also worked in my case ... The above can however be useful for folks who need to use the deprecated splunklib. Thanks for the feedback – Chris Chris Dec 12 '19 at 13:33
  • For more info regarding point no 4 - review this in your env variable like in my case myproject\my_env\Lib\site-packages\splunklib-1.0.0.dist-info\METADATA update this file .... #Requires-Dist: pycrypto "Requires-Dist: pycryptodome" – Vijay May 12 '22 at 10:13
  • 1
    step 4 still unclear to me. How do you find where pip would place this? I used the command `pip cache dir`, and it is not in the directory listed by that. – avatarofhope2 Mar 24 '23 at 19:23