'Upgrade pip in virtual environment

I tried to upgrade pip in virtual environment. I have error as follows.

Exception:
Traceback (most recent call last):
  File "/home/itc/intel/training_extensions/venv/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/home/itc/intel/training_extensions/venv/lib/python3.6/site-packages/pip/commands/install.py", line 290, in run
    with self._build_session(options) as session:
  File "/home/itc/intel/training_extensions/venv/lib/python3.6/site-packages/pip/basecommand.py", line 69, in _build_session
    if options.cache_dir else None
  File "/usr/lib/python3.6/posixpath.py", line 80, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not int

What could be wrong?



Solution 1:[1]

sometimes python does not recognise your statement therefore it gives these errors.

Try this:- Python -m pip install --upgrade pip

Solution 2:[2]

The problem is with options.cache_dir. It's just a speed optimization, so not essential.

Upgrade pip with python -m pip install --upgrade --no-cache-dir pip to bypass the broken code.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Atharv kumar
Solution 2 MSalters