I have different python version on my Linux server running with Centos7.

[xyz@innolx20122]$ python
python             python2.7          python3.6          python3.7          python3.7m-config
python2            python3            python3.6m         python3.7m

I want to use python3.7 version only so have made an alias in my .bashrc file.

alias python=python3.7

I have installed python invoke module which I am going to use further.

pip install invoke

It got installed at default python 2.7 location

[xyz@innolx20122 ~]$ pip install invoke
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 pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: invoke in ./.local/lib/python2.7/site-packages (1.4.1)

I am facing issue when running invoke tasks as 2.7 version does not support **kwargs arguments. How can I fix this issue?


I created one more alias as


[xyz@innolx20122 ~]$ pip --version
pip 10.0.1 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)

Now when I run pip install invoke, getting this issue.

[xyz@innolx20122 ~]$ pip install invoke
Collecting invoke
  Using cached https://files.pythonhosted.org/packages/2c/16/f00efa99ae9f255142a230ce6819c37ae9dd29a7144477c1161cc72d01ed/invoke-1.4.1-py3-none-any.whl
Installing collected packages: invoke
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.7/site-packages/invoke'
Consider using the `--user` option or check the permissions.

You are using pip version 10.0.1, however version 20.2.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

I tried using

pip install invoke --user

after this I could see package was installed at location

[xyz@innolx20122 ~]$ pip install invoke --user

Requirement already satisfied: invoke in ./.local/lib/python3.7/site-packages (1.4.1)
You are using pip version 10.0.1, however version 20.2.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[xyz@innolx20122 ~]$ cd ./.local/lib/python3.7/site-packages
[xyz@innolx20122 site-packages]$ ls
invoke  invoke-1.4.1.dist-info

[xyz@innolx20122 ~]$ cd /usr/local/lib/python3.7/site-packages/
[xyz@innolx20122 site-packages]$ ls
easy_install.py  pip  pip-10.0.1.dist-info  pkg_resources  __pycache__  README.txt  setuptools  setuptools-39.0.1.dist-info

[xyz@innolx20122 sd-test]$ inv --list

    back (most recent call last):
      File "/usr/bin/inv", line 8, in <module>
      File "/home/xyz/.local/lib/python2.7/site-packages/invoke/program.py", line 373, in run
      File "/home/xyz/.local/lib/python2.7/site-packages/invoke/program.py", line 465, in parse_collection
      File "/home/xyz/.local/lib/python2.7/site-packages/invoke/program.py", line 696, in load_collection
        module, parent = loader.load(coll_name)
      File "/home/xyz/.local/lib/python2.7/site-packages/invoke/loader.py", line 76, in load
        module = imp.load_module(name, fd, path, desc)
      File "/home/xyz/developer-workspace/vikrant-xyz/sd-test/tasks/__init__.py", line 5, in <module>
        from .airflow import *
      File "/home/xyz/developer-workspace/vikrant-xyz/sd--test/tasks/airflow.py", line 57

1 Answer 1


You have a couple choices:

  1. Create another alias for pip3 that points to a pip installed for python 3.7
  2. Use pip3 to install your own pip in your homedir and use that instead
  3. Create a symlink to the pip you want to use, put it in ~/.local/bin (and make sure it is in the $PATH)

Just make sure you are running entirely as a user and not overwriting something owned by a package.

  • Thanks for the answer. I am getting this error now. I have updated the question. I did something wrong. I guess Commented Sep 19, 2020 at 0:35
  • 1
    @vikrantrana you are running as a regular user, so you can’t install into the OS directories. As the error tells you, you have to add —user to install into your homedir. If you want to update the python3 modules installed in/usr/local, you have to run pip3 as root.
    – jsbillings
    Commented Sep 19, 2020 at 1:45
  • I have accepted the answer but my error could not resolved. I would be greatful to you if you can help me in this regard. I have updated the question with issue I am facing. Thanks Commented Sep 19, 2020 at 1:57
  • You’ve somehow installed python modules in /usr/local but not included them in the standard python search paths. How was python installed in /usr/local? It’s not a standard CentOS path
    – jsbillings
    Commented Sep 19, 2020 at 13:11
  • 1
    @vikrantrana also, /usr/bin/inv appears to be python 2 based, and using an invoke built and installed in /home/xyz/.local/lib, so not the one you installed in /usr/local anyway.
    – jsbillings
    Commented Sep 19, 2020 at 13:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .