cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1213
Views
4
Helpful
9
Replies
Beginner

How to use YDK-Py on Windows ?

I want to be able to use the ydk-py API on windows platform, but have a couple of problems.

First of all, how to install it and what Python langauge version is required ? I am using 2.7.5 but when openeing the sample bgp.py I see imports like "enum" or "lxml" that are not found.

Everyone's tags (2)
9 REPLIES 9
Highlighted
Cisco Employee

Re: How to use YDK-Py on Windows ?

Hi Laszlo,

  These are other third party packages (not included in the built in library) which we can download and install .

First install pip for windows python version then  using the command pip install <package name>.you will be able to install enum along with the dependencies from command prompt but do remember to do this on cmd prompt first you need to setup the python path.   you can google or ref-python - How to add to the pythonpath in windows 7? - Stack Overflow.

  For the enum module try downloading from the following url-enum34 1.1.6 : Python Package Index .

Please try out after installing these packages and let us know the result.

Thanks and Regards,

Geevarghese

Highlighted
Beginner

Re: How to use YDK-Py on Windows ?

Hello Geevarghese,

thank you for the helpful answer.

Could you please clarify what Python language version is required by YDK-Py ? Will it work with 2.7.x or 3.x.y only ?

Thanks in advance,

Laszlo

Highlighted
Cisco Employee

Re: How to use YDK-Py on Windows ?

Hi Laszlo,

   Please let me know from were you are using the scripts. If its from the github -ydk-py/samples at master · CiscoDevNet/ydk-py · GitHub you may need python 2.7. You can easily identify from the script by going through the print line command . If the print command is written as a function like print() then its python 3 .

Thanks and Regards,

Geevarghese

Highlighted
Beginner

Re: How to use YDK-Py on Windows ?

I am using the GitHub version, exactly as you wrote. So I assume 2.7 would fit.

The full story is that I wrote a .NET based, scripting application used to script cisco devices on large scale. The app can host Python scripts using IronPython 2.7, and I want to integrate YDK-Py into it. Currently I experience issues loading ydk module and samples on this platform (presumably due to IronPython).

One issue is that ydk requires lxml module that can't be found and I don't know what it is or where it should come from. Can you please help me with this ?

Highlighted
Cisco Employee

Re: How to use YDK-Py on Windows ?

Hi Laszlo,

  Iam not familiar with IronPython.  This is something which i could suggest  after a google search. You can go to this site Download Anaconda now! | Continuum and download and install anaconda. Then go to anaconda command prompt and try  command - conda install lxml

This will help to install  with which ever dependencies needed .

Thanks and Regards,

Geevarghese

Highlighted
Beginner

Re: How to use YDK-Py on Windows ?

Thanks for your help so far, I managed to solve the issue with enum, and on the right track with lxml.

I find nevertheless the whole Python environment and package inter-dependencies difficult to manage (for my Windows/.NET trained brain), though it is a distinct topic from YDK :-)

Highlighted
Cisco Employee

Re: How to use YDK-Py on Windows ?

YDK-Py doesn't currently support Python 3.  We have an open issue to track it:https://github.com/CiscoDevNet/ydk-gen/issues/60

We made good progress on adding Python 3 support, but had to prioritize other issues in the recent releases.  You can expect Python 3 to be officially supported in YDK-Py in a not so distant release. 

Note that the YDK-Py sample apps should use parenthesis for print statements since a single argument is used.  The idea was to facilitate porting once Python 3 support is released in YDK-Py. 

Highlighted
Cisco Employee

Re: How to use YDK-Py on Windows ?

Like Geevarghese mentioned, installing a Windows-supported Python distribution like Anaconda or PythonXY will be sufficient.

For instance, I was able to use PythonXY (Python-xy.GitHub.io by python-xy) to install ydk-py without any problems on Windows.

Thanks,

Abhi

Highlighted
Cisco Employee

Re: How to use YDK-Py on Windows ?

Simplest way to get started on Windows is to use the Vagrant sandbox in the YDK-Py samples repo:

GitHub - CiscoDevNet/ydk-py-samples: Sample apps for YDK-Py

It requires to install VirtualBox and Vagrant on Windows.  We know of people using that approach successfully and they experience the convenience of Vagrant.  If you get YDK-Py running nativately on a recent Windows release, you can share your instructions.  We'd gladly add it to the README.  Thanks.

This widget could not be displayed.