PyCharm package requirements not satisfied (requirement already satisfied)

I'm using PyCharm 2018.2 on a daily basis and I really like it for python, AI and data science projects. My projects usually use virtual environments like venv or pipenv, which are created for the given project. The PyCharm project interpreter is correctly set and the terminal shows that virtual environment is correctly used:

(venv36) user@user-machine:~/PycharmProjects/python$ 

In the case above the venv is: venv36.

The installation for new packages is easy as:

pip install six

Video about this problem: package requirements not satisfied

This works as expected and the package is installed and ready to be used. The problem that I want to mention in this article is:

  • package exists on your virtual environment
  • you have PyCharm warning:

Package requirement 'six==1.10.0' is not satisfied

You have two options:

  • Install requirement ( may require administrator privileges)
  • Ignore requirement

What you can do:

  • Install the requirement
    • Check if you install the correct package
  • Check the requirements file
    • check for duplicates in requirment file
    • Old versions
  • Solution invalidate the cache or change interpreter

Install the requirement

You can install it from the warning option: Install requirement or by using the terminal by:

pip install six --upgrade

result:

Installing collected packages: six
  Found existing installation: six 1.10.0
    Uninstalling six-1.10.0:
      Successfully uninstalled six-1.10.0
Successfully installed six-1.12.0

Using upgrade will for upgrade in case of newer version while

pip install six

will result in:

Requirement already satisfied: six in /home/user/environments/venv36/lib/python3.6/site-packages

Installing specific version by:

pip install six==1.10.0

Check the requirements file

If you still have this error while you can see the package by:

pip list

then you can check what version do you have in your requirements.txt file (or the one that you use).

If there is a difference like:

pip list

result:

six (1.12.0)

but in the requirements you have:

six==1.10.0

then you will see the error.

Solution invalidate the cache or change interpreter

If all these packages are listed by the command or in project interpreter settings. Then you can try to change the interpreter from IDE and/or invalidate the cache:

  • File
  • Invalidate Caches/Restart..
  • Invalidate and Restart
  • Add the interpreter (or a new one)
  • Wait for indexing and check again.