pipx icon indicating copy to clipboard operation
pipx copied to clipboard

install can erroneously attempt to install local *.egg-info package

Open itsayellow opened this issue 5 years ago • 6 comments
trafficstars

Describe the bug When using pipx install from a directory that contains a an *.egg-info directory, sometimes a pip error message will be printed that shows that pip tried to install the local *.egg-info package, despite it not being part of the requested install.

This seems only to happen if there is a local *.egg-info directory.

It doesn't seem to happen with every pipx install, which I don't understand.

I don't know if this is possibly a pip bug.

How to reproduce

Go to a directory containing an *.egg-info directory.

carvel:rgbsensor pipx install --verbose kaggle               
pipx > (_package_name_from_spec:93): Determined package name: kaggle
pipx > (_package_name_from_spec:94): Package name determined in 0.0s
pipx > (run_subprocess:112): running /usr/local/opt/[email protected]/bin/python3.8 -m venv --without-pip /Users/mclapp/.local/pipx/venvs/kaggle
pipx > (run_subprocess:112): running /Users/mclapp/.local/pipx/venvs/kaggle/bin/python -c import sysconfig; print(sysconfig.get_path('purelib'))
pipx > (run_subprocess:112): running /Users/mclapp/.local/pipx/shared/bin/python -c import sysconfig; print(sysconfig.get_path('purelib'))
pipx > (run_subprocess:112): running /Users/mclapp/.local/pipx/venvs/kaggle/bin/python --version
pipx > (run_subprocess:112): running /Users/mclapp/.local/pipx/venvs/kaggle/bin/python -m pip install kaggle
Processing /Users/mclapp/Library/Caches/pip/wheels/79/40/57/49eee0c279b56aa3e06d10708dcfb53142240861b122303f2b/kaggle-1.5.6-py3-none-any.whl
Collecting urllib3<1.25,>=1.21.1
  Using cached urllib3-1.24.3-py2.py3-none-any.whl (118 kB)
Collecting tqdm
  Using cached tqdm-4.45.0-py2.py3-none-any.whl (60 kB)
Collecting requests
  Using cached requests-2.23.0-py2.py3-none-any.whl (58 kB)
Collecting six>=1.10
  Using cached six-1.14.0-py2.py3-none-any.whl (10 kB)
Collecting python-dateutil
  Using cached python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
Processing /Users/mclapp/Library/Caches/pip/wheels/11/94/81/312969455540cb0e6a773e5d68a73c14128bfdfd4a7969bb4f/python_slugify-4.0.0-py2.py3-none-any.whl
Collecting certifi
  Using cached certifi-2020.4.5.1-py2.py3-none-any.whl (157 kB)
Collecting chardet<4,>=3.0.2
  Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting idna<3,>=2.5
  Using cached idna-2.9-py2.py3-none-any.whl (58 kB)
Collecting text-unidecode>=1.3
  Using cached text_unidecode-1.3-py2.py3-none-any.whl (78 kB)
ERROR: rgbsensor 0.1.0 requires discoverhue<2.0.0,>=1.0.2, which is not installed.
ERROR: rgbsensor 0.1.0 requires numpy<2.0.0,>=1.18.2, which is not installed.
ERROR: rgbsensor 0.1.0 requires pyserial<4.0,>=3.4, which is not installed.
ERROR: rgbsensor 0.1.0 requires qhue<2.0.0,>=1.0.12, which is not installed.
ERROR: rgbsensor 0.1.0 requires scikit-learn<0.23.0,>=0.22.2, which is not installed.
Installing collected packages: urllib3, tqdm, chardet, idna, certifi, requests, six, python-dateutil, text-unidecode, python-slugify, kaggle
Successfully installed certifi-2020.4.5.1 chardet-3.0.4 idna-2.9 kaggle-1.5.6 python-dateutil-2.8.1 python-slugify-4.0.0 requests-2.23.0 six-1.14.0 text-unidecode-1.3 tqdm-4.45.0 urllib3-1.24.3
pipx > (run_subprocess:112): running /Users/mclapp/.local/pipx/venvs/kaggle/bin/python -c <contents of pipx_metadata_inspector.py> kaggle /Users/mclapp/.local/pipx/venvs/kaggle/bin
pipx > (needs_upgrade:51): Time since last upgrade of shared libs, in seconds: 612189.3714971542. Upgrade will be run by pipx if greater than 2592000.0.
  installed package kaggle 1.5.6, Python 3.8.2
  These apps are now globally available
    - kaggle
done! ✨ 🌟 ✨
carvel:rgbsensor 

Expected behavior

pipx (and pip) should not try to install the local package rgbsensor associated with rgbsensor.egg-info

instead, see the lines above:

ERROR: rgbsensor 0.1.0 requires discoverhue<2.0.0,>=1.0.2, which is not installed.
ERROR: rgbsensor 0.1.0 requires numpy<2.0.0,>=1.18.2, which is not installed.
ERROR: rgbsensor 0.1.0 requires pyserial<4.0,>=3.4, which is not installed.
ERROR: rgbsensor 0.1.0 requires qhue<2.0.0,>=1.0.12, which is not installed.
ERROR: rgbsensor 0.1.0 requires scikit-learn<0.23.0,>=0.22.2, which is not installed.

itsayellow avatar May 01 '20 19:05 itsayellow

I've seen it happen with kaggle and ptpython.

itsayellow avatar May 01 '20 19:05 itsayellow

Can you try running this with python -m pip directly? I suspect this is a pip bug. The cause would be similar to #365, pip is detecting the package in the current directory as installed.

Note: The error message is not emitted during installation, but the post-installation checks that ensures the environment is internally consistent after the operation.

uranusjr avatar May 01 '20 20:05 uranusjr

Yes! It does happen with python3 -m pip from the same directory, but only with certain packages. I see it happen with plain pip with kaggle, but NOT with ptpython. I'm not sure of which factors actually make it happen, but this seems to be a pip bug.

itsayellow avatar May 05 '20 01:05 itsayellow

Do we close this bug here, or leave it open as a way of tracking the behavior?

itsayellow avatar May 05 '20 01:05 itsayellow

Is this still a problem with 20.1? I think it has a fix that’s relevant to this issue.

uranusjr avatar May 12 '20 14:05 uranusjr

I would leave it open and add a tag saying “upstream issue”. If it’s fixed in 20.1 we can close it out.

cs01 avatar May 12 '20 14:05 cs01