Search code examples
pythonintellij-ideavirtualenvproject-setup

Package requirements in a new, clean venv project (Python 3 /IntelliJ IDEA) - Why are there any?


After creating a new Python project in IntelliJ:

Choosing venv and basic python3.6 interepreter, no inheriting of packages

There shouldn't be any requirements/additional packages.

I check this:

Enter image description here

So, to recap: I create a new project, select VENV, choose a new environment, and do not want inherit any requirements.

When I create an empty Python file, I get this:

Enter image description here

Where is this coming from? I don't see any requirements file, etc. But it must be somewhere.


Solution

  • VirtualEnv copies PIP and SetupTools, in case you want to install new packages in the virtual environment (which is the main reason for VirtualEnv's existence).

    So, the only way that I see (if you don't want them), is to create the new virtual environment from command line, and then "import" it in PyCharm.

    Regarding the 2nd dilemma, it (might not be your case, but) sounds like an PyCharm caching problem. In [JetBrains.IntelliJ-Support]: Package requirements not satisfied (though they are), Sergey Karpov states:

    Please try to remove this interpreter from IDE, then do File | Invalidate Caches/Restart.. | Invalidate and Restart and add the interpreter again.



    Edit #0

    I made a confusion: I talked about VirtualEnv, when in fact it's [Python 3.Docs]: venv - Creation of virtual environment that' being used. Nevertheless, this doesn't change much, the problem still persists, but only the --without-pip options is present.

    Regarding the other problem, as I specified in a comment, I tried reproducing the behavior on my laptop, but I couldn't.