PyCharm "Can't Open Local Terminal" "Failed to start cmd.exe"?
Asked Answered
F

14

14

I'm no noobie to PyCharm. But I can't get the Windows 10 cmd.exe to launch from the "Terminal:" tab. I've located & tried both cmd.exe on my Win10 x64 machine:

enter image description here

...but keep getting the same message (see title of this post).

I also have tried running as Administrator w/ the same problem result.

I've also reviewed these posts but still the same problem:

Can't start a python console in pycharm

Can't open local terminal

I'm running Win10 64bit. PyCharm 2018.3 Community Edition, PyCharm 2018.3 (Community Edition) Build #PC-183.4284.139, built on November 20, 2018 JRE: 1.8.0_152-release-1343-b15 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 10 10.0

Fagen answered 26/11, 2018 at 18:44 Comment(9)
What version of PyCharm are you using ? Is it Educational ?Pizzicato
I'm running Win10 64bit. PyCharm 2018.3 Community Edition, PyCharm 2018.3 (Community Edition) Build #PC-183.4284.139, built on November 20, 2018 JRE: 1.8.0_152-release-1343-b15 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 10 10.0Fagen
I setup exactly like you did you project, on different drive, it worked properly. I thought maybe you use Educational pycharm, which doesn't have Embedded terminal jetbrains.com/help/pycharm/working-with-system-console.html but sorry, can't help you :cPizzicato
I have the same issue with IntelliJ and WebStorm, no idea what's going on. I had setup the terminal to be git-bash, but even restoring cmd.exe shows the same issue. I can run both perfectly fine outside IntelliJ though. I don't see anything related in the logs.Stammer
I rolled back to IntelliJ 2018.2.5 and it's working again (both git-bash and cmd.exe). Looks like a regression – we should report it on YouTrack.Stammer
This issue has been reported on YouTrack by one of my colleagues under IDEA-202881. A possible workaround by setting pty4j.tmpdir to a folder where you can execute files.Stammer
Thank you. I am currently running: PyCharm 2018.3.1 (Community Edition) Build #PC-183.4588.64, built on December 4, 2018 JRE: 1.8.0_152-release-1343-b16 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 10 10.0 and STILL have the same problem.Fagen
"setting pty4j.tmpdir to a folder" how do I do this? I searched for it and couldn't find it.Fagen
I am using PyCharm 2019.1 Professional Windows 10 (with no admin) and the issue is not resolved.Cense
F
2

As of today I am running:

PyCharm 2019.1.2 (Community Edition)
Build #PC-191.7141.48, built on May 7, 2019
JRE: 11.0.2+9-b159.56 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

and I can launch cmd.exe from the "terminal" button.

Fagen answered 11/5, 2019 at 19:0 Comment(0)
M
24

Go to File > Settings > Terminal and change shell path from powershell.exe to C:\Windows\System32\cmd.exe.

This fixed the issue.

Moro answered 6/10, 2021 at 20:43 Comment(0)
I
16

I faced the same error after a reinstallation of Pycharm. I tried to open an existing project on which file's tree changed. I fixed it by choosing a correct project source directory. ctr + Alt + S -> Project:your_project_name -> Project structure, and choose your source directory location. enter image description here

In settings click on Tools -> terminal and choose your project root. The shell path is by default provided by the IDE after installation.

enter image description here

Indochina answered 24/9, 2020 at 13:2 Comment(0)
W
8

Terminal (cmd prompt) not working after 2024.1 update

https://i.sstatic.net/BSs27.png

Please try to select Help | Find Action from the main menu, type Registry, select it and in the opened list, find and disable the terminal.use.conpty.on.windows options there, restart the IDE to see if it helps.

Warton answered 11/4, 2024 at 9:8 Comment(1)
Nothing else worked for me, but this solution worked. Thanks!Royall
C
4

I faced similar scenario with powershell.exe:

Cannot open Local Terminal
Failed to start [powershell.exe] in xxxxxxxxxx
Error running process: CreateProcess failed. Code 2

It was because system PATH variable was empty (really). It should include at least following entries:

C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\

To check it out launch SystemPropertiesAdvanced.exe, then Environment Variables > Path within System variables panel. Make sure that entries listed above are present. If not, click New button to add missing ones.

enter image description here

Curl answered 29/10, 2021 at 21:17 Comment(0)
S
2

This is a known regression (IDEA-202881) introduced in IntelliJ/WebStorm/PyCharm etc. version 2018.3. It appears to be related to software restriction policies, preventing to run an internal executable that is used to launch the terminal (instead of launching it directly).

It will be fixed in version 2018.3.3 - the RC already has the fix, check the Early Access Program (links for PyCharm and IDEA)

Stammer answered 3/1, 2019 at 13:39 Comment(0)
F
2

As of today I am running:

PyCharm 2019.1.2 (Community Edition)
Build #PC-191.7141.48, built on May 7, 2019
JRE: 11.0.2+9-b159.56 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

and I can launch cmd.exe from the "terminal" button.

Fagen answered 11/5, 2019 at 19:0 Comment(0)
I
2

Go to File > Settings > Terminal and change shell path from powershell.exe to C:\Windows\System32\cmd.exe.

Close the terminal and Open Again It will fix the issue.

Interplay answered 23/5, 2023 at 10:25 Comment(0)
B
1

go to help -> find action -> registry and check the checkbox terminal.use.conpty.on.windows

Bosquet answered 1/3, 2023 at 9:43 Comment(0)
A
0

This is a known regression (IDEA-202881) introduced in IntelliJ/WebStorm/PyCharm etc. version 2018.3. It appears to be related to software restriction policies, preventing to run an internal executable that is used to launch the terminal (instead of launching it directly).

It will be fixed in version 2018.3.3 - the RC already has the fix, check the Early Access Program (links for PyCharm and IDEA)

i'm facing the same problem how can change software restriction policies so that terminal start working

Ascendant answered 27/3, 2020 at 11:17 Comment(0)
T
0

I had the same error in pycharm professional 2021.2 but I changed to 2021.1.3 and I was able to use my local terminal. Am not telling you install the one I used but I would suggest to try out other versions too not the one you are using and you see.

Telescopium answered 2/8, 2021 at 11:3 Comment(0)
C
0

Go to File > Settings > Terminal and change shell path from powershell.exe to C:\Windows\System32\cmd.exe.

This fixed the issue.

I had to close and open again.

Colum answered 6/3, 2023 at 17:33 Comment(0)
S
0

I faced the same problem. Setting to the Path environment variable "C:\Windows\system32\WindowsPowerShell\v1.0 " it helped me. Don't forget to restart the application (if you use PyCharm)

my method is not a trick with replacing powershell with cmd, but enabling powershell

Supermarket answered 14/1, 2024 at 14:24 Comment(2)
Thank you for your interest in contributing to the Stack Overflow community. This question already has quite a few answers—including one that has been extensively validated by the community. Are you certain your approach hasn’t been given previously? If so, it would be useful to explain how your approach is different, under what circumstances your approach might be preferred, and/or why you think the previous answers aren’t sufficient. Can you kindly edit your answer to offer an explanation?Bulbil
corrected the informationMattos
B
0

Solved it by following steps:

  1. In PyCharm, "Help | Find Action " -> search registry
  2. Disable terminal.use.conpty.on.windows
  3. Restart PyCharm, invalidate cache.
Benares answered 29/6, 2024 at 12:42 Comment(0)
S
-1

Go to Settings -> Terminal -> Application Setting -> Shell Path

Browse the shell path as: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe or C:\WINDOWS\System32\cmd.exe Pycharm settings screenshot

Sutlej answered 26/3, 2022 at 15:3 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.