36

Many programs display progress bars by printing to stdout and then returning to beginning of line and printing again. This way they can achieve realtime progress bar appearence.

Unfortunately, in many cases this functionality does not work in PyCharm's console.

This is an example on how it shows keras train progress bar:

enter image description here

i.e. each progress bar change goes to separate line.

Is it possible to fix this?

Dims
  • 47,675
  • 117
  • 331
  • 600

3 Answers3

53

CrazyCoder's comment is the right way to go.

I just formalize his comment as an answer here.


Step1: Go to Run ---> Edit Configurations

enter image description here

Step2: Check the option: Emulate terminal in output console

enter image description here

Voilà

enter image description here

Tay2510
  • 5,748
  • 7
  • 39
  • 58
  • 2
    But I can't run with Python console when I select this option, if I want check variables after run code, this way is not going to work... – 0811张庆昊 Dec 12 '18 at 10:05
  • 2
    **for people using PyCharm Edu**, which doesn't have the "Run" menu, you can access your Run configurations via Help --> Find Action --> Type "Edit Configurations" (source: [jetbrains.com](https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000561524-Pycharm-Edu-version-has-no-Run-menu-)) – Blupon Aug 20 '19 at 08:24
  • This option is no longer present in 2020.1. – technomage Jun 01 '20 at 18:07
  • Option is present in 2020.2 – Davy Dec 27 '20 at 17:24
3

Emulate terminal in output console is gone from PyCharm 2022.2.1 (Professional Edition). Other suggestions?

enter image description here

rtphokie
  • 609
  • 1
  • 6
  • 14
1

The only way I managed to get progress bars (I'm using tqdm 4.19.5 for a progress bar, PyCharm Community 2017.3.2 and Anaconda/Python 3.6.3) to work correctly was to uncheck the "Show command line afterwards" option:

enter image description here

enter image description here

enter image description here

The solution posted by Tay2510 (checking the "Emulate terminal in output console" option) didn't work for me.

One downside of my solution is that you lose console access after your script is done running.

LmnICE
  • 163
  • 1
  • 11