Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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:\MyProject\project\venv\Scripts\python.exe -m pip install [options] [package-index-options] ...
D:\MyProject\project\venv\Scripts\python.exe -m pip install [options] -r [package-index-options] ...
D:\MyProject\project\venv\Scripts\python.exe -m pip install [options] [-e] ...
D:\MyProject\project\venv\Scripts\python.exe -m pip install [options] [-e] ...
D:\MyProject\project\venv\Scripts\python.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.

like image 896
Helenus the Seer Avatar asked Dec 01 '20 06:12

Helenus the Seer


2 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.

like image 168
Pavel Karateev Avatar answered Sep 22 '22 03:09

Pavel Karateev


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

like image 30
Adimz Avatar answered Sep 24 '22 03:09

Adimz