Search code examples
pythonpython-2.7piprhelpython-wheel

pip install + pip cant instelled the weel file from a local flat directory


we are trying to install the following wheel file

  ls /tmp/test
    argparse-1.4.0-py2.py3-none-any.whl

one option is:

pip install --no-index --find-links=file:///tmp/test argparse-1.4.0-py2.py3-none-any.whl
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
WARNING: Requirement 'argparse-1.4.0-py2.py3-none-any.whl' looks like a filename, but the file does not exist
Looking in links: file:///tmp/test
Processing ./argparse-1.4.0-py2.py3-none-any.whl
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/tmp/argparse-1.4.0-py2.py3-none-any.whl'

the second option is:

pip install --no-index --find-links=/tmp/test argparse-1.4.0-py2.py3-none-any.whl
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
WARNING: Requirement 'argparse-1.4.0-py2.py3-none-any.whl' looks like a filename, but the file does not exist
Looking in links: /tmp/test
Processing ./argparse-1.4.0-py2.py3-none-any.whl
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/tmp/argparse-1.4.0-py2.py3-none-any.whl'

on both option pip failed to find the .whl file

what is interesting is that pip ignore the folder /tmp/test

what is going here ? , why pip cant installed the wheel file and find it under /tmp/test folder?

reference:

enter image description here


Solution

  • It is likely that you need to use the package name rather than the wheel's file name. Try

    pip install --no-index --find-links=file:///tmp/test/ argparse
    

    However, installing the wheel directly should work:

    pip install /tmp/test/argparse-1.4.0-py2.py3-none-any.whl