Skip to content

Different pip install behavior depending on usage underscore/dot/dash in package name #5021

@jt1

Description

@jt1
  • Pip version: 9.0.1
  • Python version: 3.5.2
  • Operating system: Ubuntu 16.04.3 LTS

Description:

Package name defined in setup.py is foo.bar. When running pip install --no-index --force-reinstall --use-wheel --upgrade foo.bar it works ok and package is uninstalled first. When running same command using package name foo_bar or foo-bar it seems to works but packages is not uninstalled first.

Why is it like that?
In my opinion upgrade behavior should be the same regardless of the used name of the package.

What I've run:

~/foo$ mkvirtualenv foo
Using base prefix '/usr'
New python executable in /home/qba/.virtualenvs/foo/bin/python3
Not overwriting existing python script /home/qba/.virtualenvs/foo/bin/python (you must use /home/qba/.virtualenvs/foo/bin/python3)
Installing setuptools, pip, wheel...done.
(foo) ~/foo$ tree
.
├── foo
│   ├── a.py
│   └── __init__.py
└── setup.py

1 directory, 3 files
(foo) ~/foo$ cat setup.py 
from distutils.core import setup

setup(
    name='foo.bar',
    version='0.1',
    packages=['foo',],
)
(foo) ~/foo$ pip wheel .
Processing /home/qba/foo
Building wheels for collected packages: foo.bar
  Running setup.py bdist_wheel for foo.bar ... done
  Stored in directory: /home/qba/foo
Successfully built foo.bar
(foo) ~/foo$ pip install --no-index --force-reinstall --use-wheel --upgrade --find-links=file:///home/qba/foo foo_bar
Collecting foo_bar
Installing collected packages: foo-bar
Successfully installed foo-bar
(foo) ~/foo$ pip install --no-index --force-reinstall --use-wheel --upgrade --find-links=file:///home/qba/foo foo_bar
Collecting foo_bar
Installing collected packages: foo-bar
Successfully installed foo-bar
(foo) ~/foo$ pip install --no-index --force-reinstall --use-wheel --upgrade --find-links=file:///home/qba/foo foo.bar
Collecting foo.bar
Installing collected packages: foo.bar
  Found existing installation: foo.bar 0.1
    Uninstalling foo.bar-0.1:
      Successfully uninstalled foo.bar-0.1
Successfully installed foo.bar-0.1
(foo) ~/foo$ pip install --no-index --force-reinstall --use-wheel --upgrade --find-links=file:///home/qba/foo foo_bar
Collecting foo_bar
Installing collected packages: foo-bar
Successfully installed foo-bar
(foo) ~/foo$ pip install --no-index --force-reinstall --use-wheel --upgrade --find-links=file:///home/qba/foo foo-bar
Collecting foo-bar
Installing collected packages: foo-bar
Successfully installed foo-bar

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedFor requesting inputs from other members of the communitytype: bugA confirmed bug or unintended behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions