Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I force PyCharm to inspect the requirements.txt file and suggest updates?

Tags:

pycharm

How can I force PyCharm to inspect the requirements.txt file and suggest updates? I can't seem to control when this happens. Thanks!

like image 471
yurmix Avatar asked Jun 29 '16 20:06

yurmix


People also ask

How do I get dependencies in PyCharm?

Project dependencies pane For each project in the Projects pane, this pane shows the list of the other projects, opened in the same window. Select the checkboxes to the left of the names of the desired projects to add them as dependencies.

How do I remove unused packages from requirements txt?

txt, you can use the "Sync Python Requirements" tool (under the Tools menu) to find and remove unused packages (check the "Remove unused requirements" box).


1 Answers

I tried opening any .py file, checking Package requirements file field (Settings - Tools - Python Integrated Tools). Nothing triggered my PyCharm on Windows to detect a new dependency added to requirements.txt. Since the virtual environment was created with PyCharm's Add Local, trying to get pip to work for the virtual environment with a Windows command line also seemed quite a bit of work.

Finally, the easiest solution that worked for me was as follows.

  1. Click on the icon in the lower left corner. It brings up menus to Project, Python Console, Structure, TODO, etc. Find Terminal in it.

    enter image description here

  2. Click on Terminal. It seems to be automatically virtual environment aware.

  3. Run pip install -r requirements.txt
like image 194
Big Pumpkin Avatar answered Oct 10 '22 02:10

Big Pumpkin