PyCharm venv failed: 'no such option: –build-dir'

Question:

I’m doing a fresh install on a new Windows 10 laptop. I installed Python 3.9 and PyCharm Community 2020.2, then started a new project. In the project settings, I created a new project interpreter in a venv, inside the /venv folder. Everything looks to get set up correctly, but I can’t install anything to the project interpreter. When I try to do so, e.g. when I try to install pandas or anything else, I get None-zero exit code (2) with the following message:

Usage: D:MyProjectprojectvenvScriptspython.exe -m pip install
[options] [package-index-options] …
D:MyProjectprojectvenvScriptspython.exe -m pip install [options] -r
[package-index-options] …
D:MyProjectprojectvenvScriptspython.exe -m pip install [options]
[-e] …
D:MyProjectprojectvenvScriptspython.exe -m pip install [options]
[-e] …
D:MyProjectprojectvenvScriptspython.exe -m pip install [options]
<archive url/path> …

no such option: –build-dir

When I go to the Terminal and just ‘pip install pandas’ per PyCharm’s ‘proposed solution’, it installs fine, and pandas and its dependencies appear as usual in the list of installed modules in the interpreter. I’ve not encountered this before, and don’t see anywhere in the settings where I can specify how exactly PyCharm will invoke pip in this situation.

Asked By: Helenus the Seer

||

Answers:

PyCharm relies on --build-dir to install packages and the flag was removed in the latest pip 20.3.

The fix for PyCharm is ready and will be released this week in 2020.3 release (and backported to 2020.2.5 and 2020.1.5).

The workaround is to downgrade pip to the previous version – close PyCharm and run python -m pip install pip==20.2.4 in the terminal using the corresponding virtual environment.

Update 1

2020.1.5 and 2020.2.5 with the fix were released – please update.

Answered By: Pavel Karateev

Pycharm 2020.3 released and it seems like the issue solved by upgrading to this version.

Answered By: Adimz

I use the code as fellow at the terminal in PyCharm:
venvScriptspython -m pip install pip==20.2.4

attention:you must key in this code in the terminal at PyCharm otherwise you can’t change the version for your project.

tip:When it done,you can find the version of pip is right at settings-project interpreter.

Answered By: YZQ
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.