09-18-2024 11:58 PM
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#
Solved! Go to Solution.
09-19-2024 04:06 AM
@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.
09-19-2024 04:13 AM
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
09-19-2024 02:59 AM
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.
09-19-2024 03:51 AM
I have tried to built my own for last hour but without any luck.
Could you share your Dockerfile?
09-19-2024 04:06 AM
@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.
09-19-2024 04:09 AM
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.
09-19-2024 04:13 AM
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
09-19-2024 04:16 AM
@rasmus.elmholt so my suggestion worked?
09-19-2024 04:22 AM - edited 09-19-2024 04:23 AM
@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.
09-19-2024 04:49 AM
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.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide