errors using on RHEL 6
shawndwells opened this issue · 5 comments
Hello,
Trying to use on RHEL 6, getting many python errors shown below. What am I doing wrong?
when building, no errors:
[root@rhel6stig swidGenerator]# python setup.py install
running install
running bdist_egg
running egg_info
writing swid_generator.egg-info/PKG-INFO
writing top-level names to swid_generator.egg-info/top_level.txt
writing dependency_links to swid_generator.egg-info/dependency_links.txt
writing entry points to swid_generator.egg-info/entry_points.txt
reading manifest file 'swid_generator.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'tests'
writing manifest file 'swid_generator.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/egg
creating build/bdist.linux-x86_64/egg/swid_generator
copying build/lib/swid_generator/settings.py -> build/bdist.linux-x86_64/egg/swid_generator
copying build/lib/swid_generator/package_info.py -> build/bdist.linux-x86_64/egg/swid_generator
creating build/bdist.linux-x86_64/egg/swid_generator/environments
copying build/lib/swid_generator/environments/pacman_environment.py -> build/bdist.linux-x86_64/egg/swid_generator/environments
copying build/lib/swid_generator/environments/dpkg_environment.py -> build/bdist.linux-x86_64/egg/swid_generator/environments
copying build/lib/swid_generator/environments/rpm_environment.py -> build/bdist.linux-x86_64/egg/swid_generator/environments
copying build/lib/swid_generator/environments/common.py -> build/bdist.linux-x86_64/egg/swid_generator/environments
copying build/lib/swid_generator/environments/environment_registry.py -> build/bdist.linux-x86_64/egg/swid_generator/environments
copying build/lib/swid_generator/environments/__init__.py -> build/bdist.linux-x86_64/egg/swid_generator/environments
copying build/lib/swid_generator/main.py -> build/bdist.linux-x86_64/egg/swid_generator
creating build/bdist.linux-x86_64/egg/swid_generator/generators
copying build/lib/swid_generator/generators/utils.py -> build/bdist.linux-x86_64/egg/swid_generator/generators
copying build/lib/swid_generator/generators/swid_generator.py -> build/bdist.linux-x86_64/egg/swid_generator/generators
copying build/lib/swid_generator/generators/softwareid_generator.py -> build/bdist.linux-x86_64/egg/swid_generator/generators
copying build/lib/swid_generator/generators/__init__.py -> build/bdist.linux-x86_64/egg/swid_generator/generators
copying build/lib/swid_generator/meta.py -> build/bdist.linux-x86_64/egg/swid_generator
copying build/lib/swid_generator/argparser.py -> build/bdist.linux-x86_64/egg/swid_generator
copying build/lib/swid_generator/print_functions.py -> build/bdist.linux-x86_64/egg/swid_generator
copying build/lib/swid_generator/exceptions.py -> build/bdist.linux-x86_64/egg/swid_generator
copying build/lib/swid_generator/__init__.py -> build/bdist.linux-x86_64/egg/swid_generator
byte-compiling build/bdist.linux-x86_64/egg/swid_generator/settings.py to settings.pyc
byte-compiling build/bdist.linux-x86_64/egg/swid_generator/package_info.py to package_info.pyc
byte-compiling build/bdist.linux-x86_64/egg/swid_generator/environments/pacman_environment.py to pacman_environment.pyc
byte-compiling build/bdist.linux-x86_64/egg/swid_generator/environments/dpkg_environment.py to dpkg_environment.pyc
byte-compiling build/bdist.linux-x86_64/egg/swid_generator/environments/rpm_environment.py to rpm_environment.pyc
byte-compiling build/bdist.linux-x86_64/egg/swid_generator/environments/common.py to common.pyc
byte-compiling build/bdist.linux-x86_64/egg/swid_generator/environments/environment_registry.py to environment_registry.pyc
byte-compiling build/bdist.linux-x86_64/egg/swid_generator/environments/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/swid_generator/main.py to main.pyc
byte-compiling build/bdist.linux-x86_64/egg/swid_generator/generators/utils.py to utils.pyc
byte-compiling build/bdist.linux-x86_64/egg/swid_generator/generators/swid_generator.py to swid_generator.pyc
byte-compiling build/bdist.linux-x86_64/egg/swid_generator/generators/softwareid_generator.py to softwareid_generator.pyc
byte-compiling build/bdist.linux-x86_64/egg/swid_generator/generators/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/swid_generator/meta.py to meta.pyc
byte-compiling build/bdist.linux-x86_64/egg/swid_generator/argparser.py to argparser.pyc
byte-compiling build/bdist.linux-x86_64/egg/swid_generator/print_functions.py to print_functions.pyc
byte-compiling build/bdist.linux-x86_64/egg/swid_generator/exceptions.py to exceptions.pyc
byte-compiling build/bdist.linux-x86_64/egg/swid_generator/__init__.py to __init__.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying swid_generator.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying swid_generator.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying swid_generator.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying swid_generator.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying swid_generator.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying swid_generator.egg-info/zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO
creating 'dist/swid_generator-0.2.0-py2.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing swid_generator-0.2.0-py2.6.egg
removing '/usr/lib/python2.6/site-packages/swid_generator-0.2.0-py2.6.egg' (and everything under it)
creating /usr/lib/python2.6/site-packages/swid_generator-0.2.0-py2.6.egg
Extracting swid_generator-0.2.0-py2.6.egg to /usr/lib/python2.6/site-packages
swid-generator 0.2.0 is already the active version in easy-install.pth
Installing swid_generator script to /usr/bin
Installed /usr/lib/python2.6/site-packages/swid_generator-0.2.0-py2.6.egg
Processing dependencies for swid-generator==0.2.0
Finished processing dependencies for swid-generator==0.2.0
But when trying to use:
[root@rhel6stig swidGenerator]# swid_generator python-setuptools
Traceback (most recent call last):
File "/usr/bin/swid_generator", line 9, in <module>
load_entry_point('swid-generator==0.2.0', 'console_scripts', 'swid_generator')()
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 299, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 2229, in load_entry_point
return ep.load()
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 1948, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/lib/python2.6/site-packages/swid_generator-0.2.0-py2.6.egg/swid_generator/main.py", line 28, in <module>
from .argparser import MainArgumentParser
File "/usr/lib/python2.6/site-packages/swid_generator-0.2.0-py2.6.egg/swid_generator/argparser.py", line 6, in <module>
from argparse import ArgumentParser, ArgumentTypeError, Action
ImportError: No module named argparse
or software-id:
[root@rhel6stig swidGenerator]# swid_generator software-id
Traceback (most recent call last):
File "/usr/bin/swid_generator", line 9, in <module>
load_entry_point('swid-generator==0.2.0', 'console_scripts', 'swid_generator')()
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 299, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 2229, in load_entry_point
return ep.load()
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 1948, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/lib/python2.6/site-packages/swid_generator-0.2.0-py2.6.egg/swid_generator/main.py", line 28, in <module>
from .argparser import MainArgumentParser
File "/usr/lib/python2.6/site-packages/swid_generator-0.2.0-py2.6.egg/swid_generator/argparser.py", line 6, in <module>
from argparse import ArgumentParser, ArgumentTypeError, Action
ImportError: No module named argparse
You're missing the argparse library. The reason for this is that you're still on Python 2.6. Argparse is available in Python 2.7 and newer.
We don't currently support Python 2.6. The SWID Generator might work if you install argparse separately (via pip install argparse
or easy_install argparse
), but probably there are other problems too.
I don't have any experience with RHEL, but here are some resources to get Python 2.7 up and running: https://stackoverflow.com/questions/4149361/on-linux-suse-or-redhat-how-do-i-load-python-2-7
Another option would be to port this project to Python 2.6, which probably wouldn't be very hard (except that argparse needs to be installed separately). But I don't currently have much time left for that.
If we can merge #34, this should work on your system (provided that you install argparse separately).
@shawndwells if you want, you can already clone the py26 branch to verify whether it works for you.
checkout out the py26 branch....
$ sudo pip install -U swid_generator
Downloading/unpacking swid-generator
Downloading swid_generator-0.2.0.tar.gz
Running setup.py egg_info for package swid-generator
no previously-included directories found matching 'tests'
Installing collected packages: swid-generator
Running setup.py install for swid-generator
no previously-included directories found matching 'tests'
Installing swid_generator script to /usr/bin
Successfully installed swid-generator
Cleaning up...
$ pip install tox
Downloading/unpacking tox
Downloading tox-1.7.2.tar.gz (84kB): 84kB downloaded
Running setup.py egg_info for package tox
Downloading/unpacking virtualenv>=1.11.2 (from tox)
Downloading virtualenv-1.11.6.tar.gz (1.6MB): 1.6MB downloaded
Running setup.py egg_info for package virtualenv
warning: no previously-included files matching '*' found under directory 'docs/_templates'
warning: no previously-included files matching '*' found under directory 'docs/_build'
Downloading/unpacking py>=1.4.17 (from tox)
Downloading py-1.4.23.tar.gz (189kB): 189kB downloaded
Running setup.py egg_info for package py
Requirement already satisfied (use --upgrade to upgrade): argparse in /usr/lib/python2.6/site-packages (from tox)
Installing collected packages: tox, virtualenv, py
Running setup.py install for tox
error: could not create '/usr/lib/python2.6/site-packages/tox': Permission denied
Complete output from command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-shawnw/tox/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-x2l4dq-record/install-record.txt --single-version-externally-managed:
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/tox
copying tox/_verlib.py -> build/lib/tox
copying tox/_pytestplugin.py -> build/lib/tox
copying tox/_cmdline.py -> build/lib/tox
copying tox/__init__.py -> build/lib/tox
copying tox/_quickstart.py -> build/lib/tox
copying tox/_venv.py -> build/lib/tox
copying tox/result.py -> build/lib/tox
copying tox/__main__.py -> build/lib/tox
copying tox/_config.py -> build/lib/tox
copying tox/interpreters.py -> build/lib/tox
copying tox/_exception.py -> build/lib/tox
creating build/lib/tox/vendor
copying tox/vendor/__init__.py -> build/lib/tox/vendor
running install_lib
creating /usr/lib/python2.6/site-packages/tox
error: could not create '/usr/lib/python2.6/site-packages/tox': Permission denied
----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-shawnw/tox/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-x2l4dq-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build-shawnw/tox
Storing complete log in /home/shawnw/.pip/pip.log
$ swid_generator swid --env rpm --package python
Traceback (most recent call last):
File "/usr/bin/swid_generator", line 9, in <module>
load_entry_point('swid-generator==0.2.0', 'console_scripts', 'swid_generator')()
File "/usr/lib/python2.6/site-packages/swid_generator/main.py", line 69, in main
print_swid_tags(swid_tags, separator=options.document_separator, pretty=options.pretty)
File "/usr/lib/python2.6/site-packages/swid_generator/print_functions.py", line 92, in print_swid_tags
iterate(swid_tags, action, separator, end='\n')
File "/usr/lib/python2.6/site-packages/swid_generator/print_functions.py", line 60, in iterate
item = next(generator)
File "/usr/lib/python2.6/site-packages/swid_generator/generators/swid_generator.py", line 66, in create_swid_tags
pkg_info = environment.get_package_list()
File "/usr/lib/python2.6/site-packages/swid_generator/environments/rpm_environment.py", line 31, in get_package_list
data = subprocess.check_output(command_args)
AttributeError: 'module' object has no attribute 'check_output'
@shawndwells you don't need to install tox, it's only used for testing.
Also, if you install swid_generator via pip, then it will be downloaded from the internet, and not use your local version. That's why it still didn't work.
What you can do is the following:
sudo pip uninstall swid_generator
cd /path/to/swidgenerator/git/checkout
git checkout py26
sudo python setup.py install