Smart_open: Importing gensim prints stuff and configures logging

Created on 14 Apr 2020  Â·  4Comments  Â·  Source: RaRe-Technologies/smart_open

Problem description

Not sure if this is a ticket for smart_open or gensim, but importing gensim prints out some (unwanted) stuff: unable to import 'smart_open.gcs', disabling that module.

I checked the smart_open source code and this is actually printed from a logger:

logger.warning('unable to import %r, disabling that module', submodule)

This is a big no-no – libraries have no business configuring the logging subsystem. That's up to the application. If an app tried to import gensim and then call logging.basicConfig then the latter will be ignored, because logging will already have been set up. Not good: https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library

Originally found via https://github.com/RaRe-Technologies/gensim/issues/2794 .

Steps/code to reproduce the problem

Screen Shot 2020-04-14 at 19 14 53

Versions

Please provide the output of:

import platform, sys, smart_open
print(platform.platform())
print("Python", sys.version)
print("smart_open", smart_open.__version__)
Darwin-15.6.0-x86_64-i386-64bit
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 16:52:21)
[Clang 6.0 (clang-600.0.57)]
smart_open 1.11.1

Checklist

Before you create the issue, please make sure you have:

  • [x] Described the problem clearly
  • [x] Provided a minimal reproducible example, including any required data
  • [x] Provided the version numbers of the relevant software
bug

Most helpful comment

@kounelisagis @ebadi You need to downgrade smart_open to version 1.10.0 to get rid of the excess logging.

All 4 comments

Same issue with 3.8.2. Works perfect after downgrading to 3.8.1 :confused:

Same issue with 3.8.2. Works perfect after downgrading to 3.8.1

Downgrading to 3.8.1 did not work for me.

@kounelisagis @ebadi You need to downgrade smart_open to version 1.10.0 to get rid of the excess logging.

pip install smart-open==1.10.0 worked for me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

menshikh-iv picture menshikh-iv  Â·  5Comments

ivan-yankovyi picture ivan-yankovyi  Â·  4Comments

gelioz picture gelioz  Â·  5Comments

bolkedebruin picture bolkedebruin  Â·  4Comments

qiuwei picture qiuwei  Â·  5Comments