question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error while executing "python setup.py" in CLI : FileNotFoundError: [WinError 2] The system cannot find the file specified

See original GitHub issue

When did the bug happened :

  • When I run the command “python setup.py” in the command prompt, I got this traceback :
Installing Pytorch (this may take a few minutes):
Traceback (most recent call last):
  File "C:\Users\undisclosed\anaconda3\envs\dream-factory\dream-factory\setup.py", line 152, in <module>
    install_pytorch(verbose)
  File "C:\Users\undisclosed\anaconda3\envs\dream-factory\dream-factory\setup.py", line 55, in install_pytorch
    exec(cmd, verbose)
  File "C:\Users\undisclosed\anaconda3\envs\dream-factory\dream-factory\setup.py", line 27, in exec
    subprocess.run(command.split(' '), stdout=subprocess.DEVNULL)
  File "C:\Users\undisclosed\anaconda3\envs\dream-factory\lib\subprocess.py", line 505, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Users\undisclosed\anaconda3\envs\dream-factory\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\undisclosed\anaconda3\envs\dream-factory\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

What OS was affected :

  • Windows 10 Pro (64-bit) version 21H2

The solution :

  • I changed those lines in “setup.py” :
- Line 25        subprocess.run(command.split(' '))
+ Line 25        subprocess.run(command.split(' '), shell=True)

- Line 27        subprocess.run(command.split(' '), stdout=subprocess.DEVNULL)
+ Line 27        subprocess.run(command.split(' '), stdout=subprocess.DEVNULL, shell=True)

Where did I find the solution :

Final Note :

  • When the solution was applied, the rest of the setup went well and the program work very well !
  • I already made 30 new AI-art images. Thank you very much ! 😁😎🤩

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
rbbrdckybkcommented, Oct 5, 2022

Wow, that’s for the very detailed write-up!

I can’t reproduce this on my end, but I can add a command-line switch to enable shell=True. I’ll check for FileNotFoundError and display some text explaining that it can be enabled if the user wants. Will re-open this until I have a minute to make the change.

2reactions
rbbrdckybkcommented, Oct 3, 2022

Thanks for the feedback; didn’t run into that issue on any of my test installs but just applied a fix that should prevent it in the future!

Read more comments on GitHub >

github_iconTop Results From Across the Web

FileNotFoundError: [WinError 2] The system cannot find the file ...
Hello guys, I am trying to run the script below in python and I keep getting this error [FileNotFoundError: [WinError 2] The system...
Read more >
Python : FileNotFoundError [WinError 2] The system cannot ...
First of all, you have to locate this file and then edit it. In my PC it location is - C:\Users\User\AppData\Local\Programs\Python\Python39\Lib.
Read more >
FileNotFoundError: [WinError 2] The system cannot ... - GitHub
It seems that windows cannot find pyinstaller or one of the files you have referenced in the UI. Make sure that all the...
Read more >
FIX FileNotFoundError: [WinError 2] The system cannot find ...
When you're working with the #subproces module, you may encounter this error : ... [ WinError 2 ] The system cannot find the...
Read more >
[WinError 2] The system cannot find the file specified' mean in ...
I think it is saying that in your function check_output you referenced a file. Does that file exist at the file path location...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found