pyang icon indicating copy to clipboard operation
pyang copied to clipboard

pyang isn't executable when using the Windows Command Prompt as your shell

Open cmlccie opened this issue 7 years ago • 4 comments

When using the Windows Command Prompt: After installing pyang via pip install pyang the pyang command is not accessible.

The user will receive the following error: 'pyang' is not recognized as an internal or external command, operable program or batch file.

The Scripts folder (into which pyang was installed) is in the system path, but pyang is not found as an executable script.

It doesn't look like the pyang.bat file functionality coded in setup.py is working. I couldn't find pyang.bat installed on my virtualenv or system folders.

Captured Output

C:\Users\chrlunsf\dev\envs>virtualenv pyang-test
Using base prefix 'c:\\users\\chrlunsf\\appdata\\local\\programs\\python\\python
36-32'
New python executable in C:\Users\chrlunsf\dev\envs\pyang-test\Scripts\python.ex
e
Installing setuptools, pip, wheel...done.

C:\Users\chrlunsf\dev\envs>pyang-test\Scripts\activate

(pyang-test) C:\Users\chrlunsf\dev\envs>pip list
DEPRECATION: The default format will switch to columns in the future. You can us
e --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.con
f under the [list] section) to disable this warning.
appdirs (1.4.3)
packaging (16.8)
pip (9.0.1)
pyparsing (2.2.0)
setuptools (35.0.0)
six (1.10.0)
wheel (0.29.0)

(pyang-test) C:\Users\chrlunsf\dev\envs>pip install pyang
Collecting pyang
  Using cached pyang-1.7.1-py2.py3-none-any.whl
Installing collected packages: pyang
Successfully installed pyang-1.7.1

(pyang-test) C:\Users\chrlunsf\dev\envs>pyang --version
'pyang' is not recognized as an internal or external command,
operable program or batch file.

(pyang-test) C:\Users\chrlunsf\dev\envs>set
<--output omitted for brevity -->
Path=C:\Users\chrlunsf\dev\envs\pyang-test\Scripts;C:\WINDOWS\system32;C:\WINDOW
S;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOW
S\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Cisco\OSD\Shell Applic
ations;C:\Program Files (x86)\Sennheiser\SoftphoneSDK\;C:\Users\chrlunsf\AppData
\Local\Programs\Python\Python36-32\;C:\Users\chrlunsf\AppData\Local\Programs\Pyt
hon\Python36-32\Scripts
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
<--output omitted for brevity -->
VIRTUAL_ENV=C:\Users\chrlunsf\dev\envs\pyang-test
<--output omitted for brevity -->

(pyang-test) C:\Users\chrlunsf\dev\envs>cd C:\Users\chrlunsf\dev\envs\pyang-test
\Scripts

(pyang-test) C:\Users\chrlunsf\dev\envs\pyang-test\Scripts>dir
 Volume in drive C is Windows
 Volume Serial Number is A281-A50D

 Directory of C:\Users\chrlunsf\dev\envs\pyang-test\Scripts

04/18/2017  09:16 AM    <DIR>          .
04/18/2017  09:16 AM    <DIR>          ..
04/18/2017  09:15 AM             2,209 activate
04/18/2017  09:15 AM               779 activate.bat
04/18/2017  09:15 AM             8,325 activate.ps1
04/18/2017  09:15 AM             1,137 activate_this.py
04/18/2017  09:15 AM               508 deactivate.bat
04/18/2017  09:15 AM            89,483 easy_install-3.6.exe
04/18/2017  09:15 AM            89,483 easy_install.exe
04/18/2017  09:16 AM            16,602 json2xml
04/18/2017  09:15 AM            89,455 pip.exe
04/18/2017  09:15 AM            89,455 pip3.6.exe
04/18/2017  09:15 AM            89,455 pip3.exe
04/18/2017  09:16 AM            16,087 pyang
04/18/2017  09:15 AM            97,944 python.exe
04/18/2017  09:15 AM         3,258,008 python36.dll
04/18/2017  09:15 AM            96,408 pythonw.exe
04/18/2017  09:15 AM            89,462 wheel.exe
04/18/2017  09:16 AM             8,148 yang2dsdl
04/18/2017  09:16 AM             5,172 yang2html
              18 File(s)      4,048,120 bytes
               2 Dir(s)  43,147,620,352 bytes free

(pyang-test) C:\Users\chrlunsf\dev\envs\pyang-test\Scripts>

cmlccie avatar Apr 18 '17 14:04 cmlccie

Yes you are correct, the current logic won't work for virtual environment.

Even after new changes also you have to add your vitual environment scripts dir to environment variables. Still if you are interested to use I'll make PR.

vkosuri avatar Apr 20 '17 02:04 vkosuri

I was actually getting the same response even when outside of a virtual environment. We deffintely want to use the package (excellent tool! -Thank You!); however, we will have to put a workaround in our documentation saying something like, "You will have to use a bash shell to use pyang..."

cmlccie avatar Apr 21 '17 17:04 cmlccie

I have the same problem...Frustratingly, I couldn't find any YANG tools that would work on Windows

nightan42643 avatar Feb 28 '19 01:02 nightan42643

Hello Guys , I am trying to run some yang files in windows but I am getting the same above error, how to make pyang run successfully on windows through command line

Saicharan2001 avatar Apr 09 '22 17:04 Saicharan2001