Forum Discussion

Jeff_Kinny's avatar
Jeff_Kinny
Icon for Contributor II rankContributor II
4 months ago

Having trouble re-packaging SL1 Library

Hi All, hoping someone here can help me out. I recently have been trying to make a small tweak to the python code for the out of the box silo_cisco_meraki_api Library from the Cisco: Meraki Powerpack (literally just changing one variable)

I was able to get the Library downloaded, unpacked, extracted the individual .py file using 'wheel unpack [file]', made the change, and ran 'wheel pack [directory]'. The final step as outlined in this SL document is to re-package the python project using the command 'python3 -m pip download --find-links=. silo_cisco_meraki_api==0.6.10'. However, when I run this I'm getting the error:

Does anyone know what I'm doing wrong here? I'm guessing there's a very obvious step I'm missing.

  • Hi Jeff!

    To answer your main question about the error and the point of that step: you can skip it. That step is for a python package you own, or a 3rd party package from the python community. In other words, it needs to be a package that pip knows about. Since silo_cisco_meraki_api is a privately hosted ScienceLogic library, pip cannot find it in the official PYPI repo.

    If you were using your own library, or one from PYPI, then that step would download any dependencies of the package so that you could include them the in the library tar bundle. Then during the collection process those dependencies would support the main package in the python virtual environment on the Collector Unit.

    In summary, you can skip the pip download step. The best thing would be to include all the dependencies that came with the original silo_cisco_meraki_api library. So during the tar step, include the python packages that came with the original. Also, don't forget to adjust the version of the new package, and include it in the Execution Environment so it gets used in place of the original.

  • Hi Jeff!

    To answer your main question about the error and the point of that step: you can skip it. That step is for a python package you own, or a 3rd party package from the python community. In other words, it needs to be a package that pip knows about. Since silo_cisco_meraki_api is a privately hosted ScienceLogic library, pip cannot find it in the official PYPI repo.

    If you were using your own library, or one from PYPI, then that step would download any dependencies of the package so that you could include them the in the library tar bundle. Then during the collection process those dependencies would support the main package in the python virtual environment on the Collector Unit.

    In summary, you can skip the pip download step. The best thing would be to include all the dependencies that came with the original silo_cisco_meraki_api library. So during the tar step, include the python packages that came with the original. Also, don't forget to adjust the version of the new package, and include it in the Execution Environment so it gets used in place of the original.

  • Hello, Jeff_Kinny did the response help resolve your issue? If so then please mark the response as a solution. If not then please share more context so we can help you solve this. Cheers, Sara 

  • One further thing I'm noticing is that using wheel unpack/pack may have broken something with the original wheel? I packaged my wheel as I said above, and then followed wspearman's instructions on building a package and including all of the dependencies from the original package. However, when I run the Dynamic App on the device I'm seeing an error:
    App: 2806, Snippet: 3203 threw exception: No module named cisco_meraki_api.organization_discovery_app (ImportError: No module named cisco_meraki_api.organization_discovery_app File "", line 3, in )    

    which leads me to believe something got packaged improperly (possibly file permissions??)