question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why is the package listed as python-louvain but you have to use it with import community ?

  • It is misleading as people try to do pip install community
  • It shadows the name of the other community python package .

You run into troubles if you use both at the same time. Which is likely to occur if users ran pip install community in the first place

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
mazzma12commented, Jun 7, 2018

Do you have better idea than publishing another pypi package with the same code in another package name ?

Yes, you can stick to your name python-louvain on the PyPi repo. You shall just add a first folder ‘python_louvain’ at the root that would contain the ‘community’ folder. This way you just have to refactor your imports into : from python_louvain import community, which is easy for every IDE.

Also to avoid adding an extra module level, you could just rename the community into python_louvain

If you do not use both ‘community’ package in the same software, virtual environments may be a solution ?

I totally agree about virtualenv and would use it if I had to use both packages in different projects. The problem is that people may find your package in another snippet of code and see import community and then run pip install community which will shadow the name unless they uninstall it.

1reaction
mythrandirecommented, Oct 14, 2021

Broadly, I agree with the concerns raised by @mazzma12 . Relaying my experience in this thread in case others find it after encountering the same issue.

When using pip to install python-louvain inside a Google Colab notebook, I encountered the following error:

AttributeError: module 'community' has no attribute 'best_partition'

This (also linked by @thisisreallife) suggests uninstalling community to avoid the package naming conflict discussed in this thread. It works within a virtual environment, but not on Colab.

The way I was able to use the library was directly uploading the contents of python-louvain/community/ to my Colab notebook. Then, inside of community_louvain.py, I had to change the implicit reference to community_status so that community_louvain’s contents would be callable:

# from .community_status import Status
from community_status import Status
Read more comments on GitHub >

github_iconTop Results From Across the Web

Package name - Google AdMob Help
The package name of an Android app uniquely identifies your app on the device, in Google Play Store, and in supported third-party Android...
Read more >
Package Name Viewer 2.0 - Apps on Google Play
This app show you package name and launcher class of all apps in your device. Features: 1. Application searching;
Read more >
Configure the app module - Android Developers
Every Android app has a unique application ID that looks like a Java or Kotlin package name, such as com.example.myapp.
Read more >
Naming a Package (The Java™ Tutorials > Learning the Java ...
Package names are written in all lower case to avoid conflict with the names of classes or interfaces. Companies use their reversed Internet...
Read more >
How to determine the package name of an Android App
The package name is a unique name to identify a specific app. Generally, the package name of an app is in the format...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found