cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
210
Views
1
Helpful
8
Replies

Unable to get started with ciscotestautomation/pyats

rasmus.elmholt
Level 7
Level 7

Hi Everyone,

I am not sure this is the right sub for this question but I will try anyway.

I am trying to get started with PyATS using docker. But I am having some difficulties using the official image as shown below.

I followed one of the examples on https://hub.docker.com/r/ciscotestautomation/pyats but was unable to get it working.

 

 

$ docker run -it ciscotestautomation/pyats:latest /bin/bash
[Entrypoint] Starting pyATS Docker Image ...
[Entrypoint] Workspace Directory: /pyats
[Entrypoint] Activating workspace
root@0c832ac21322:/pyats# easypy examples/basic/job/basic_example_job.py

 

 

Is the image faulty or am I doing something wrong?

This is what happens when I run the example in my environment:

 

 

ubuntu $ docker run -it ciscotestautomation/pyats:latest /bin/bash
Unable to find image 'ciscotestautomation/pyats:latest' locally
latest: Pulling from ciscotestautomation/pyats
8740c948ffd4: Pull complete 
69038a8b17e6: Pull complete 
9eda7279ef48: Pull complete 
03ebd05a13a5: Pull complete 
c623e99b4bd9: Pull complete 
16fbc8f82ef8: Pull complete 
caab93ae7438: Pull complete 
24a015172daf: Pull complete 
4e8aeb20b7c7: Pull complete 
597e1a8fbd05: Pull complete 
4f4fb700ef54: Pull complete 
Digest: sha256:4fa864a62548fa6c32da0db88a48e629d29a86adb148ad3b34e4a09b1145a5c3
Status: Downloaded newer image for ciscotestautomation/pyats:latest
[Entrypoint] Starting pyATS Docker Image ...
[Entrypoint] Workspace Directory: /pyats
[Entrypoint] Activating workspace
root@c7007499b8be:/pyats# easypy examples/basic/job/basic_example_job.py
usage: easypy
Traceback (most recent call last):
  File "src/pyats/easypy/config/schema.py", line 46, in pyats.easypy.config.schema.validate_plugins
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1181, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "src/pyats/easypy/plugins/kleenex.py", line 14, in init pyats.easypy.plugins.kleenex
  File "/pyats/lib/python3.9/site-packages/pyats/bringup/__init__.py", line 24, in <module>
    from pyats.clean.loader import KleenexFileLoader
  File "/pyats/lib/python3.9/site-packages/pyats/clean/loader/__init__.py", line 1, in <module>
    from ._impl import KleenexFileLoader, BaseKleenexFileLoader
  File "src/pyats/clean/loader/_impl.py", line 12, in init pyats.clean.loader._impl
ModuleNotFoundError: No module named 'genie'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "src/pyats/utils/yaml/loader.py", line 176, in pyats.utils.yaml.loader.Loader.load
  File "src/pyats/utils/schemaengine.py", line 393, in pyats.utils.schemaengine.Schema.validate
  File "src/pyats/utils/schemaengine.py", line 366, in pyats.utils.schemaengine.Schema.validate
  File "src/pyats/utils/schemaengine.py", line 251, in pyats.utils.schemaengine.Schema.validate
  File "src/pyats/utils/schemaengine.py", line 625, in pyats.utils.schemaengine.Use.validate
  File "src/pyats/utils/schemaengine.py", line 623, in pyats.utils.schemaengine.Use.validate
  File "src/pyats/easypy/config/schema.py", line 55, in pyats.easypy.config.schema.validate_plugins
pyats.utils.exceptions.SchemaError: Invalid easy_config.yaml input for plugins
root@c7007499b8be:/pyats# 

 

 

 

 

2 Accepted Solutions

Accepted Solutions

@rasmus.elmholt the error looks like the genie module is missing, and this is dependency required by PyATS, i am wondering if this module is not included in the official PyATS Docker image, which is why you're seeing this error? Just a guess here... try and add genie module inside the Docker container. Worth a punt.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

View solution in original post

rasmus.elmholt
Level 7
Level 7

I installed genie in the docker container and now I am able to run pyats without this error

 

root@0085a889fb5a:/pyats# pip3 show genie
WARNING: Package(s) not found: genie
root@0085a889fb5a:/pyats# pip3 install genie

View solution in original post

8 Replies 8

Jesus Illescas
Cisco Employee
Cisco Employee

I always had issues with the docker image even though I'm familiar with docker. In my case, I built my own. Best thing if you want to use the docker image is to check with the pyats team, you can contact them at pyats-support-ext@cisco.com

There is also a webex space, you can join here https://eurl.io/#r18UzrQVr there are many people there.

 

 

Hi @Jesus Illescas 

I have tried to built my own for last hour but without any luck.

Could you share your Dockerfile?

@rasmus.elmholt the error looks like the genie module is missing, and this is dependency required by PyATS, i am wondering if this module is not included in the official PyATS Docker image, which is why you're seeing this error? Just a guess here... try and add genie module inside the Docker container. Worth a punt.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Jesus Illescas
Cisco Employee
Cisco Employee

My dockerfile might not be that useful to you since pyats was only one dependency for my project, so there are many more moving pieces there. In short you need to install pyats using pip.

FROM python:3.12.2 as base

COPY llm_agent.requirements.txt /tmp/requirements.txt

RUN pip install --upgrade pip && \
    pip install -r /tmp/requirements.txt

 

Inside the requirements file, I added pyats[full]

Still, you can find the complete dockerfile here https://github.com/jillesca/AI-Network-Troubleshooting-PoC/blob/main/llm_agent.Dockerfile see the requirements file in the root directory to find pyats.

 

 

 

 

 

rasmus.elmholt
Level 7
Level 7

I installed genie in the docker container and now I am able to run pyats without this error

 

root@0085a889fb5a:/pyats# pip3 show genie
WARNING: Package(s) not found: genie
root@0085a889fb5a:/pyats# pip3 install genie

@rasmus.elmholt so my suggestion worked?

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

@rasmus.elmholt If the suggestion in an answer is working (in this case @bigevilbeard ),  you should mark the original suggestion as the accepted solution, not your own post.

Hi @Marcel Zehnder 

Yes, it worked. I had not seen the replies as I was in a meeting and figured it out at the same time. I have now marked both as the solution.