Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run program "scancode": error=2, No such file or directory #9752

Open
yegor256 opened this issue Jan 15, 2025 · 5 comments
Open

Cannot run program "scancode": error=2, No such file or directory #9752

yegor256 opened this issue Jan 15, 2025 · 5 comments
Labels
question An issue that is actually a question scanner About the scanner tool

Comments

@yegor256
Copy link

I created analyzer-result.yml file with the help of this command (no issues):

$ ~/ort-45.0.0/bin/ort analyze --input-dir=. --output-dir=ort

Then, I run this command and fail:

$ ~/ort-45.0.0/bin/ort scan --ort-file=ort/analyzer-result.yml --output-dir=ort
Scanning projects with:
Exception in thread "main" java.io.IOException: Cannot run program "scancode": error=2, No such file or directory
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1170)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1089)
	at org.ossreviewtoolkit.utils.common.ProcessCapture.<init>(ProcessCapture.kt:95)
	at org.ossreviewtoolkit.utils.common.CommandLineTool$DefaultImpls.run(CommandLineTool.kt:71)
	at org.ossreviewtoolkit.scanner.CommandLinePathScannerWrapper.run(CommandLinePathScannerWrapper.kt:32)
	at org.ossreviewtoolkit.utils.common.CommandLineTool$DefaultImpls.run(CommandLineTool.kt:82)
	at org.ossreviewtoolkit.scanner.CommandLinePathScannerWrapper.run(CommandLinePathScannerWrapper.kt:32)
	at org.ossreviewtoolkit.utils.common.CommandLineTool$DefaultImpls.getVersion(CommandLineTool.kt:88)
	at org.ossreviewtoolkit.scanner.CommandLinePathScannerWrapper.getVersion(CommandLinePathScannerWrapper.kt:32)
	at org.ossreviewtoolkit.utils.common.CommandLineTool$DefaultImpls.getVersion$default(CommandLineTool.kt:87)
	at org.ossreviewtoolkit.scanner.CommandLinePathScannerWrapper.version_delegate$lambda$0(CommandLinePathScannerWrapper.kt:33)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:83)
	at org.ossreviewtoolkit.scanner.CommandLinePathScannerWrapper.getVersion(CommandLinePathScannerWrapper.kt:33)
	at org.ossreviewtoolkit.plugins.commands.scanner.ScannerCommand.runScanners$lambda$14(ScannerCommand.kt:190)
	at kotlin.text.StringsKt__AppendableKt.appendElement(Appendable.kt:84)
	at kotlin.collections.CollectionsKt___CollectionsKt.joinTo(_Collections.kt:3493)
	at kotlin.collections.CollectionsKt___CollectionsKt.joinToString(_Collections.kt:3510)
	at kotlin.collections.CollectionsKt___CollectionsKt.joinToString$default(_Collections.kt:3509)
	at org.ossreviewtoolkit.plugins.commands.scanner.ScannerCommand.runScanners(ScannerCommand.kt:190)
	at org.ossreviewtoolkit.plugins.commands.scanner.ScannerCommand.run(ScannerCommand.kt:148)
	at com.github.ajalt.clikt.core.CoreCliktCommandKt.parse(CoreCliktCommand.kt:107)
	at com.github.ajalt.clikt.core.CoreCliktCommandKt.main(CoreCliktCommand.kt:78)
	at com.github.ajalt.clikt.core.CoreCliktCommandKt.main(CoreCliktCommand.kt:90)
	at org.ossreviewtoolkit.cli.OrtMainKt.main(OrtMain.kt:88)
Caused by: java.io.IOException: error=2, No such file or directory
	at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
	at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:295)
	at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:225)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1126)
	... 23 more

Maybe there is some issue on my side, but it would be convenient if this stacktrace contains more details about the file it can't open.

@yegor256 yegor256 added bug to triage Issues that need triaging labels Jan 15, 2025
@sschuberth sschuberth added question An issue that is actually a question scanner About the scanner tool and removed bug to triage Issues that need triaging labels Jan 15, 2025
@sschuberth
Copy link
Member

Maybe there is some issue on my side

Please see the ort requirements command mentioned under system requirements. Depending on the ORT command being used, ORT depends on some third-party tools that either need to be installed manually, or you can user the Docker image.

Also see this discussion and various closed issues about the same topic.

@yegor256
Copy link
Author

@sschuberth got it! Maybe we can make this stracktrace more informative, in order to avoid similar bug reports in the future? For example, it may say: "run 'requirements' first and make sure there are no missing tools"

@sschuberth
Copy link
Member

Maybe we can make this stracktrace more informative

When you say "we", does that mean you're willing to contribute? 😉

@yegor256
Copy link
Author

@sschuberth I'm just being polite :) but let me try, maybe I can help with a PR

@sschuberth
Copy link
Member

I'm just being polite :)

Actually, I believe it's not very polite if you say "we" but then let others do the work 😉

but let me try, maybe I can help with a PR

Great 👍🏻 This could probably be solved generically for any command-line-based scanner inside CommandLinePathScannerWrapper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question An issue that is actually a question scanner About the scanner tool
Projects
None yet
Development

No branches or pull requests

2 participants