oss-review-toolkit / ort

A suite of tools to automate software compliance checks.
https://oss-review-toolkit.org
Apache License 2.0
1.6k stars 309 forks source link

After the new "component-based" Dockerfile we have python3/virtualenv/pip not found errors #5871

Closed mawl closed 2 years ago

mawl commented 2 years ago

After your changes from https://github.com/oss-review-toolkit/ort/commit/10b38cb65955e18bac471f06ec2c25a1d19e544a we get errors like:

Exception in thread "main" java.io.IOException: Running '/builds/foo/compliance/license-scanning/.ort/tools/ScanCode/30.1.0/scancode-toolkit-30.1.0/scancode --version' in '/builds/foo/compliance/license-scanning/.ort/tools/ScanCode/30.1.0/scancode-toolkit-30.1.0' failed with exit code 127:
/builds/foo/compliance/license-scanning/.ort/tools/ScanCode/30.1.0/scancode-toolkit-30.1.0/configure: line 157: python3: command not found

or

Exception in thread "main" java.io.IOException: Cannot run program "virtualenv": error=2, No such file or directory
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
    at org.ossreviewtoolkit.utils.common.ProcessCapture.<init>(ProcessCapture.kt:89)
    at org.ossreviewtoolkit.utils.common.ProcessCapture.<init>(ProcessCapture.kt:33)
    at org.ossreviewtoolkit.utils.common.ProcessCapture.<init>(ProcessCapture.kt:37)
    at org.ossreviewtoolkit.utils.common.CommandLineTool$DefaultImpls.run(CommandLineTool.kt:80)
    at org.ossreviewtoolkit.analyzer.managers.VirtualEnv.run(Pip.kt:74)
    at org.ossreviewtoolkit.utils.common.CommandLineTool$DefaultImpls.getVersion(CommandLineTool.kt:86)
    at org.ossreviewtoolkit.analyzer.managers.VirtualEnv.getVersion(Pip.kt:74)
    at org.ossreviewtoolkit.utils.common.CommandLineTool$DefaultImpls.checkVersion(CommandLineTool.kt:102)
    at org.ossreviewtoolkit.analyzer.managers.VirtualEnv.checkVersion(Pip.kt:74)
    at org.ossreviewtoolkit.utils.common.CommandLineTool$DefaultImpls.checkVersion$default(CommandLineTool.kt:101)
    at org.ossreviewtoolkit.analyzer.managers.Pip.beforeResolution(Pip.kt:234)
    at org.ossreviewtoolkit.analyzer.PackageManager.resolveDependencies(PackageManager.kt:255)
    at org.ossreviewtoolkit.analyzer.PackageManagerRunner$run$3.invokeSuspend(Analyzer.kt:322)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
    at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:[95](https://git.foo.de/foo/compliance/license-scanning/-/jobs/11344717#L95))
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
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:340)
    at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1[107](https://git.foo.de/foo/compliance/license-scanning/-/jobs/11344717#L107))
    ... 22 more

Or

#6 7.069 /bin/sh: 1: pip: not found

We have build your Dockerfile from scratch - docker inline caching or anything else is deactivated.

Thanks for your help.

Regards, Marco

mnonnenmacher commented 2 years ago

Could it be that you set a custom entrypoint? ORT now needs to be executed in a login shell to find the installed tools, that's why the default entrypoint is set to: https://github.com/oss-review-toolkit/ort/blob/main/docker/ort-wrapper.sh

mawl commented 2 years ago

@mnonnenmacher: We were using /opt/ort/bin/ort before, which is now at /usr/bin/ort (this is where the ort-wrapper.sh gets copied to). entrypoint is an empty string in our .gitlab-ci.yml file. Thank you for your fast reply. Now it works again.