pip version check raises an exception internally when using `--no-cache-dir`

Created on 30 Jul 2018  路  10Comments  路  Source: pypa/pip

Environment

  • pip version: 18.0 (& master)
  • Python version: 3.7.0 x64
  • OS: Windows 10.0.17134.165 x64

Description
If you use --no-cache-dir, the pip version check will raise an exception that will be swallowed internally.

Expected behavior
The version check should work normally, or be disabled. There shouldn't be an exception.

How to Reproduce

  1. Run pip install --no-cache-dir --verbose wheel
  2. Check the output.

Output

>pip install --no-cache-dir --verbose wheel
Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
Created temporary directory: C:\Users\User\AppData\Local\Temp\pip-ephem-wheel-cache-2e5wmnq3
Created temporary directory: C:\Users\User\AppData\Local\Temp\pip-req-tracker-gnigbooj
Created requirements tracker 'C:\\Users\\User\\AppData\\Local\\Temp\\pip-req-tracker-gnigbooj'
Created temporary directory: C:\Users\User\AppData\Local\Temp\pip-install-u77xlkpb
Requirement already satisfied: wheel in c:\users\user\prj\pip\venv\lib\site-packages (0.31.1)
Cleaning up...
Removed build tracker 'C:\\Users\\User\\AppData\\Local\\Temp\\pip-req-tracker-gnigbooj'
There was an error checking the latest version of pip
Traceback (most recent call last):
  File "c:\users\user\prj\pip\src\pip\_internal\utils\outdated.py", line 90, in pip_version_check
    state = SelfCheckState(cache_dir=options.cache_dir)
  File "c:\users\user\prj\pip\src\pip\_internal\utils\outdated.py", line 25, in __init__
    self.statefile_path = os.path.join(cache_dir, "selfcheck.json")
  File "C:\Users\user\prj\pip\venv\lib\ntpath.py", line 76, in join
    path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not bool
auto-locked bug

All 10 comments

I saw the same TypeError with a different command, here.

I saw the same TypeError with a different command, here.

5680 fixes that exception.... but then there is another one! 馃槤

There was an error checking the latest version of pip
Traceback (most recent call last):
  File "c:\users\user\prj\pip\src\pip\_internal\utils\outdated.py", line 115, in pip_version_check
    find_links=options.find_links,
AttributeError: 'Values' object has no attribute 'find_links'

It tries to query for options that don't exist in the show command. This likely applies to all command that don't have these options and trigger a version check.

Another traceback (this one is not swallowed):

$ pip install https://github.com/statsmodels/statsmodels/archive/v0.8.0.tar.gz -v --no-cache-dir
Successfully installed statsmodels-0.8.0
Cleaning up...
Removed build tracker '/tmp/pip-req-tracker-LDc5ut'
There was an error checking the latest version of pip
Traceback (most recent call last):
  File "/tmp/wani.1534057096/dev/lib/python2.7/site-packages/pip/_internal/utils/outdated.py", line 90, in pip_version_check
    state = SelfCheckState(cache_dir=options.cache_dir)
  File "/tmp/wani.1534057096/dev/lib/python2.7/site-packages/pip/_internal/utils/outdated.py", line 25, in __init__
    self.statefile_path = os.path.join(cache_dir, "selfcheck.json")
  File "/tmp/wani.1534057096/dev/lib/python2.7/posixpath.py", line 70, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'bool' object has no attribute 'endswith'

@nehaljwani What version of pip?

@pradyunsg Latest release, 18.0 (and probably master too)

I confirm the regression with the current master. To repeat:

rm .cache/pip/selfcheck.json
pip help help --verbose

The cause is code https://github.com/pypa/pip/blob/404838abcca467648180b358598c597b74d568c9/src/pip/_internal/utils/outdated.py#L106 that expects options.find_links which is not available for help command.

As a quick hack it makes sense to isolate version checks only to commands that have this option.

Actually https://github.com/pypa/pip/issues/5433 is the bug for find_links exception.

Reproduced as per OP's instructions. Working on this.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings