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

Python install error - MAC - __VERSION__

jschmitz
Level 1
Level 1

Getting an error when trying to install 0.8 version.  Already have 0.5 and dont know how to uninstall the older python packages. 

getting following error:

Traceback (most recent call last):

  File "setup.py", line 12, in <module>

    from UcsSdk import __version__

ImportError: cannot import name __version__

9 Replies 9

reswaran
Cisco Employee
Cisco Employee

Please delete the 'UcsSdk' directory and its contents under the 'dist-packages' folder of the python installation directory and then install v0.8.

This is a MAC.  Is this not supported.  I found my older UcsSdk files under /Libraries/Python/2.7/site-packages/.

Is that the right location.  Seems like the setup.py is looking for __version__ module and there is nothing in the src or other directories that allows for that.  Any help much appreciated.

jds

Figured it out....Need to kill the files in the first location as well as this location as well...Or at least that is what I did.

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/

jds

jschmitz
Level 1
Level 1

I think the install worked but I now cannot access the UCS system via the python tool.  I have the Python package installed on my Ubuntu system and that works....

Here is the issue I'm having now.

>>> from UcsSdk import *

>>> handle = UCSHandle()

Traceback (most recent call last):

  File "<pyshell#11>", line 1, in <module>

    handle = UCSHandle()

NameError: name 'UCSHandle' is not defined

>>> handle = UcsHandle()

>>> handle.Login('10.87.126.233','admin','password')

Traceback (most recent call last):

  File "<pyshell#13>", line 1, in <module>

    handle.Login('10.87.126.233','admin','password')

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/UcsSdk/UcsHandle.py", line 340, in Login

    raise Exception('[Error]: Login : Connection to <%s> Failed' %(name))

Exception: [Error]: Login : Connection to <10.87.126.233> Failed

>>>

any help much appreciated

jds

As per the message, the python script is not able to establish a connection with UCSM. Are you able to launch the UCSM GUI from this machine where you are running the python script?

jschmitz
Level 1
Level 1

I can get to that GUI from the machine running Python....

Are you using https to launch the GUI? If no, then can you try using https? The Login API in the script uses HTTPS by default.

jschmitz
Level 1
Level 1

I am using HTTPS.  It has to be something on my machine seeing a Ubuntu machine I have works just fine.  The problem is that this did work(or at least the Login task did) with version 0.5 but I upgraded to 0.8 and maually removed files.  Wondering if I deleted something I should not have.  Just trying to understand what I could have done.

It appears that python 2.7.6 breaks the SDK. I've got two virtualenvs - one running 2.7.3 and the other running 2.7.6. My connections work fine with 2.7.3:

(VENV-ucsm)rohorner-mac:ucs rohorner$ python -V

Python 2.7.3

(VENV-ucsm)rohorner-mac:ucs rohorner$ python get_inv.py -u admin -p password -i 192.168.200.101

{'classId': 'LsbootDef', 'XtraProperty': {}, 'Dn': 'sys/rack-unit-1/boot-policy', 'handle': <ImcSdk.ImcHandle.ImcHandle instance at 0x101c64e18>, 'Name': 'boot-policy', 'RebootOnUpdate': 'no', 'propMoMeta': <ImcSdk.ImcHandle.ImcMoMeta instance at 0x1018bf3f8>, 'Status': None, 'dirtyMask': 7L, 'Purpose': 'operational', 'child': [], 'Rn': 'boot-policy', 'ChildAction': None}

But it breaks if I use 2.7.6:

(VENV-ucs)rohorner-mac:ucs rohorner$ python get_inv.py -u admin -p password -i 192.168.200.101

Exception: [Error]: Login : Connection to <192.168.200.101> Failed

------------------------------------------------------------

Traceback (most recent call last):

  File "get_inv.py", line 11, in <module>

    handle.Login(host_ip, user, password)

  File "/Users/rohorner/python/ucs/VENV-ucs/lib/python2.7/site-packages/ImcSdk/ImcHandle.py", line 280, in Login

    raise Exception('[Error]: Login : Connection to <%s> Failed' %(name))

Exception: [Error]: Login : Connection to <192.168.200.101> Failed

------------------------------------------------------------

Review Cisco Networking for a $25 gift card

Cisco UCS X-Series Energy Efficiency Offer