waldirio / rvtools_python

Application to be executed on Linux and collect all information from vCenter
10 stars 10 forks source link

Issue while installing with python3.6, not working as expected. #31

Closed suraganijanakiram closed 2 years ago

suraganijanakiram commented 4 years ago

First thanks a lot for working on this. great job.

i have tried with python3.6 as you suggested in other posts but no luck. can you please check this issue

[root@localhost rvtools_python]# python3.6 setup.py install running install running bdist_egg running egg_info writing rvtools_python.egg-info/PKG-INFO writing dependency_links to rvtools_python.egg-info/dependency_links.txt writing top-level names to rvtools_python.egg-info/top_level.txt reading manifest file 'rvtools_python.egg-info/SOURCES.txt' writing manifest file 'rvtools_python.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py creating build/bdist.linux-x86_64 creating build/bdist.linux-x86_64/egg creating build/bdist.linux-x86_64/egg/rvtools copying build/lib/rvtools/init.py -> build/bdist.linux-x86_64/egg/rvtools copying build/lib/rvtools/corerv.py -> build/bdist.linux-x86_64/egg/rvtools copying build/lib/rvtools/rvtools.py -> build/bdist.linux-x86_64/egg/rvtools copying build/lib/rvtools/rvtools_db.py -> build/bdist.linux-x86_64/egg/rvtools copying build/lib/rvtools/test.py -> build/bdist.linux-x86_64/egg/rvtools creating build/bdist.linux-x86_64/egg/rvtools/printrv copying build/lib/rvtools/printrv/init.py -> build/bdist.linux-x86_64/egg/rvtools/printrv copying build/lib/rvtools/printrv/csv_print.py -> build/bdist.linux-x86_64/egg/rvtools/printrv creating build/bdist.linux-x86_64/egg/rvtools/vinfo copying build/lib/rvtools/vinfo/init.py -> build/bdist.linux-x86_64/egg/rvtools/vinfo copying build/lib/rvtools/vinfo/vinfo.py -> build/bdist.linux-x86_64/egg/rvtools/vinfo creating build/bdist.linux-x86_64/egg/test copying build/lib/test/init.py -> build/bdist.linux-x86_64/egg/test byte-compiling build/bdist.linux-x86_64/egg/rvtools/init.py to init.cpython-36.pyc byte-compiling build/bdist.linux-x86_64/egg/rvtools/corerv.py to corerv.cpython-36.pyc byte-compiling build/bdist.linux-x86_64/egg/rvtools/rvtools.py to rvtools.cpython-36.pyc byte-compiling build/bdist.linux-x86_64/egg/rvtools/rvtools_db.py to rvtools_db.cpython-36.pyc File "build/bdist.linux-x86_64/egg/rvtools/rvtools_db.py", line 1 line 1 ^ SyntaxError: invalid syntax

byte-compiling build/bdist.linux-x86_64/egg/rvtools/test.py to test.cpython-36.pyc byte-compiling build/bdist.linux-x86_64/egg/rvtools/printrv/init.py to init.cpython-36.pyc byte-compiling build/bdist.linux-x86_64/egg/rvtools/printrv/csv_print.py to csv_print.cpython-36.pyc byte-compiling build/bdist.linux-x86_64/egg/rvtools/vinfo/init.py to init.cpython-36.pyc byte-compiling build/bdist.linux-x86_64/egg/rvtools/vinfo/vinfo.py to vinfo.cpython-36.pyc byte-compiling build/bdist.linux-x86_64/egg/test/init.py to init.cpython-36.pyc creating build/bdist.linux-x86_64/egg/EGG-INFO installing scripts to build/bdist.linux-x86_64/egg/EGG-INFO/scripts running install_scripts running build_scripts creating build/bdist.linux-x86_64/egg/EGG-INFO/scripts copying build/scripts-3.6/rvtools -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/rvtools to 755 copying rvtools_python.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO copying rvtools_python.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying rvtools_python.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying rvtools_python.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO zip_safe flag not set; analyzing archive contents... creating 'dist/rvtools_python-0.0.1-py3.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it removing 'build/bdist.linux-x86_64/egg' (and everything under it) Processing rvtools_python-0.0.1-py3.6.egg Removing /usr/local/lib/python3.6/site-packages/rvtools_python-0.0.1-py3.6.egg Copying rvtools_python-0.0.1-py3.6.egg to /usr/local/lib/python3.6/site-packages rvtools-python 0.0.1 is already the active version in easy-install.pth Installing rvtools script to /usr/local/bin

Installed /usr/local/lib/python3.6/site-packages/rvtools_python-0.0.1-py3.6.egg Processing dependencies for rvtools-python==0.0.1 Finished processing dependencies for rvtools-python==0.0.1 [root@localhost rvtools_python]#

got this error after executing the command

[root@localhost rvtools_python]# rvtools Traceback (most recent call last): File "/usr/bin/rvtools", line 5, in pkg_resources.run_script('rvtools-python==0.0.1', 'rvtools') File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 540, in run_script self.require(requires)[0].run_script(script_name, ns) File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 1462, in runscript exec(script_code, namespace, namespace) File "/usr/lib/python2.7/site-packages/pkgresources.py", line 41, in exec exec("""exec code in globs, locs""") File "", line 1, in File "/usr/lib/python2.7/site-packages/rvtools_python-0.0.1-py2.7.egg/EGG-INFO/scripts/rvtools", line 7, in

File "build/bdist.linux-x86_64/egg/rvtools/rvtools.py", line 11, in ImportError: No module named corerv [root@localhost rvtools_python]#

waldirio commented 4 years ago

Hello @suraganijanakiram

Thanks for your contact and glad to help, sorry for the long delay, just skip this message/issue.

According to your logs, I can see the system still using python 2.7 instead of 3.6

 File "/usr/lib/python2.7/site-packages/rvtools_python-0.0.1-py2.7.egg/EGG-INFO/scripts/rvtools", line 7, in 

If you are familiar, I recommend you to create a virtual environment and after that install the python module

$ python3.7 -m venv ~/.virtualenvs/rvtools3.7

$ source ~/.virtualenvs/rvtools3.7/bin/activate
(rvtools3.7) [wpinheir@ironman ~]$

(rvtools3.7) [wpinheir@ironman ~]$ pip list
Package    Version
---------- -------
pip        19.1.1 
setuptools 41.2.0 
WARNING: You are using pip version 19.1.1, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(rvtools3.7) [wpinheir@ironman ~]$

(rvtools3.7) [wpinheir@ironman ~]$ pip search rvtools
rvtools-python (0.0.1)  - Simple app to collect information from vSphere
pyrvtools (1.0.1)       - Extract useful information from an RVTools ESX inventory file
(rvtools3.7) [wpinheir@ironman ~]$ pip install rvtools-python
Collecting rvtools-python
  Downloading https://files.pythonhosted.org/packages/35/ea/c9d2367b22489ea15b2e189ae0a06f4a102cc457535d29e430902dedfc31/rvtools_python-0.0.1-py3-none-any.whl
Installing collected packages: rvtools-python
Successfully installed rvtools-python-0.0.1
WARNING: You are using pip version 19.1.1, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

(rvtools3.7) [wpinheir@ironman ~]$ pip list
Package        Version
-------------- -------
pip            19.1.1 
rvtools-python 0.0.1  
setuptools     41.2.0 
WARNING: You are using pip version 19.1.1, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

This should be enough, however, testing on my own env I can see some issues

(rvtools3.7) [wpinheir@ironman ~]$ rvtools 
Traceback (most recent call last):
  File "/home/wpinheir/.virtualenvs/rvtools3.7/bin/rvtools", line 7, in <module>
    from rvtools import rvtools
  File "/home/wpinheir/.virtualenvs/rvtools3.7/lib64/python3.7/site-packages/rvtools/rvtools.py", line 7, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'
(rvtools3.7) [wpinheir@ironman ~]$ 

I'll check the package, however, you can do the steps below as a workaround

(rvtools3.7) [wpinheir@ironman ~]$ wget https://raw.githubusercontent.com/waldirio/rvtools_python/master/requirements.txt

(rvtools3.7) [wpinheir@ironman ~]$ pip install -r requirements.txt

and after that, go ahead and use it

(rvtools3.7) [wpinheir@ironman ~]$ rvtools --help
usage: rvtools [-h] [-s HOST] [-u USERNAME] [-p PASSWORD] [-d DIRECTORY]
               [-v VERBOSE]

RVTools Python parameters

optional arguments:
  -h, --help            show this help message and exit
  -s HOST, --host HOST  vCenter server to connect to
  -u USERNAME, --username USERNAME
                        vCenter username
  -p PASSWORD, --password PASSWORD
                        vCenter username password
  -d DIRECTORY, --directory DIRECTORY
                        Directory where will be saved all csv files. Should be
                        empty
  -v VERBOSE, --verbose VERBOSE
                        Show additional info.
(rvtools3.7) [wpinheir@ironman ~]$

I'll check ASAP the code.

Thanks for the heads up!

waldirio commented 2 years ago

Hello @suraganijanakiram

I hope you are doing well. I'm back to this project and I would like to share some news. From now, you can simply download the binary file and execute it in your environment.

link

In this version 1.0.0 you will be able to see the same features as before. However, it will not be necessary anymore to create a virtual environment, once you have python 3.6.8+, everything should be fine.

Please, let me know if this will work fine for you.

Soon, I'll release a new version with some fixes and new features.

@JAsuncion1969 please, be aware of it.

Thank you Waldirio

waldirio commented 2 years ago

Also,

Soon the package via pypi.org will be updated, in case you prefer to keep using the package via pip.

I'm archiving this issue for now, if you believe to be necessary some change and/or fix, please, feel free to reopen.

Thank you! Waldirio

suraganijanakiram commented 2 years ago

Thanks a lot. This was very helpful.

On Sun, 17 Oct, 2021, 7:59 pm Waldirio M Pinheiro, @.***> wrote:

Closed #31 https://github.com/waldirio/rvtools_python/issues/31.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/waldirio/rvtools_python/issues/31#event-5474315481, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF24JUXQFWEFYEHZF4QQ24TUHLMUZANCNFSM4JATFT7Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.