Search code examples
pythonpippypipython-packaging

Can a Python package and its corresponding PyPi project have different names?


For example, I'm wondering how is it possible that scikit-learn is the name of a PyPi package while the actual Python module is named sklearn. The reason I'm asking is that I have a local Python package packageA that I can't upload to PyPi since that name happens to already be taken. I therefore wonder if I can upload it as packageB (which actually is available on PyPi)? If so, how can I do that?


Solution

  • The names on PyPi or the names you are useing when doing pip install NAME are Distribution Packages.

    The names you use when doing import NAME are Import Packages.

    One Distribution Package can have multiple Import Packages in it.

    Example

    As an example see this demo project bit-demo:

    Scikit-learn

    The project setup of Scikit-learn is bit more complex but you also can see it there.