Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing gensim prints stuff and configures logging #475

Closed
3 tasks done
piskvorky opened this issue Apr 14, 2020 · 4 comments · Fixed by #476
Closed
3 tasks done

Importing gensim prints stuff and configures logging #475

piskvorky opened this issue Apr 14, 2020 · 4 comments · Fixed by #476
Labels

Comments

@piskvorky
Copy link
Owner

piskvorky commented Apr 14, 2020

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 piskvorky/gensim#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:

  • Described the problem clearly
  • Provided a minimal reproducible example, including any required data
  • Provided the version numbers of the relevant software
@piskvorky piskvorky added the bug label Apr 14, 2020
@kounelisagis
Copy link

Same issue with 3.8.2. Works perfect after downgrading to 3.8.1 😕

@ebadi
Copy link

ebadi commented Apr 15, 2020

Same issue with 3.8.2. Works perfect after downgrading to 3.8.1

Downgrading to 3.8.1 did not work for me.

@piskvorky
Copy link
Owner Author

piskvorky commented Apr 15, 2020

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

@Justine-Marianne
Copy link

pip install smart-open==1.10.0 worked for me

mpenkov added a commit that referenced this issue Jun 17, 2020
* Prevent regression of #474 and #475

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* flake8 init.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants