Why can't I install python logging library on Linux2 instance

0

Just started a new instance to run my python3 script. I need several libraries which I can install with pip3 (pip3 install requests runs well) but I can't get logging library installed. I have this output:

$ pip3 install logging

Defaulting to user installation because normal site-packages is not writeable
Collecting logging
  Using cached logging-0.4.9.6.tar.gz (96 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_n141mbi/logging/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_n141mbi/logging/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-pxlnpi1y
         cwd: /tmp/pip-install-_n141mbi/logging/
    Complete output (48 lines):
    running egg_info
    creating /tmp/pip-pip-egg-info-pxlnpi1y/logging.egg-info
    writing /tmp/pip-pip-egg-info-pxlnpi1y/logging.egg-info/PKG-INFO
    writing dependency_links to /tmp/pip-pip-egg-info-pxlnpi1y/logging.egg-info/dependency_links.txt
    writing top-level names to /tmp/pip-pip-egg-info-pxlnpi1y/logging.egg-info/top_level.txt
    writing manifest file '/tmp/pip-pip-egg-info-pxlnpi1y/logging.egg-info/SOURCES.txt'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-_n141mbi/logging/setup.py", line 13, in <module>
        packages = ["logging"],
      File "/usr/lib64/python3.7/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib64/python3.7/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/usr/lib64/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/usr/lib/python3.7/site-packages/setuptools/command/egg_info.py", line 297, in run
        self.find_sources()
      File "/usr/lib/python3.7/site-packages/setuptools/command/egg_info.py", line 304, in find_sources
        mm.run()
      File "/usr/lib/python3.7/site-packages/setuptools/command/egg_info.py", line 535, in run
        self.add_defaults()
      File "/usr/lib/python3.7/site-packages/setuptools/command/egg_info.py", line 571, in add_defaults
        sdist.add_defaults(self)
      File "/usr/lib64/python3.7/distutils/command/sdist.py", line 226, in add_defaults
        self._add_defaults_python()
      File "/usr/lib/python3.7/site-packages/setuptools/command/sdist.py", line 135, in _add_defaults_python
        build_py = self.get_finalized_command('build_py')
      File "/usr/lib64/python3.7/distutils/cmd.py", line 298, in get_finalized_command
        cmd_obj = self.distribution.get_command_obj(command, create)
      File "/usr/lib64/python3.7/distutils/dist.py", line 857, in get_command_obj
        klass = self.get_command_class(command)
      File "/usr/lib/python3.7/site-packages/setuptools/dist.py", line 768, in get_command_class
        self.cmdclass[command] = cmdclass = ep.load()
      File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2461, in load
        return self.resolve()
      File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2467, in resolve
        module = __import__(self.module_name, fromlist=['__name__'], level=0)
      File "/usr/lib/python3.7/site-packages/setuptools/command/build_py.py", line 16, in <module>
        from setuptools.lib2to3_ex import Mixin2to3
      File "/usr/lib/python3.7/site-packages/setuptools/lib2to3_ex.py", line 13, in <module>
        from lib2to3.refactor import RefactoringTool, get_fixers_from_package
      File "/usr/lib64/python3.7/lib2to3/refactor.py", line 19, in <module>
        import logging
      File "/tmp/pip-install-_n141mbi/logging/logging/__init__.py", line 618
        raise NotImplementedError, 'emit must be implemented '\
                                 ^
    SyntaxError: invalid syntax
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I can't understand why this happens. Anybody has an idea how to install logging ? Thanks

1 Answer
1
Accepted Answer

According to the python docs (https://docs.python.org/3.9/library/logging.html#module-logging) logging is part of the standard Python3 library. You shouldn't need to install it with pip.

profile pictureAWS
Chris_P
answered 2 years ago
profile pictureAWS
EXPERT
reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions