-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Bazel chocolatey installation error #2671
Comments
@petemounce Do you have any idea about this? |
@junyongyou please would you more details?
|
@petemounce Thank you very much. I am using the default PowerShell Windows7 has, and the the version information is: The version of Chocolatey is v0.10.3, and I am using "choco install bazel", which should install the latest version of bazel. Actually I can see the Bazel version is v0.4.4.20170306. Below is the result in the log: Information.Is64Bit='True'|Information.IsInteractive='True'| $toolsDir = Split-Path -parent $MyInvocation.MyCommand.Definition $packageDir = Split-Path -parent $toolsDir write-host "Read params from text file" Install-ChocolateyZipPackage -PackageName "$packageName" write-host "Ensure that msys2 dll is present in PATH to allow bazel to be run from non-msys2 shells" from docs: https://github.com/chocolatey/choco/wiki/How-To-Parse-PackageParameters-Argument$msys2Path = "c:\tools\msys64" if ($packageParameters -match $match_pattern) if ($arguments.ContainsKey("msys2Path")) { $addToMsysPath = ($packageDir -replace '^([a-zA-Z]):\(.*)','/$1/$2') -replace '\','/' To use it in powershell or cmd, you should ensure your PATH environment variable contains To use it in msys2, you should add that to your msys2 PATH: You also need, in your msys2 environment (adjust paths for your system): See also https://bazel.build/docs/windows.html 2017-03-14 13:46:43,991 [INFO ] - The package bazel wants to run 'chocolateyinstall.ps1'. |
bazel.0.4.4.20170306 is the package fix that I pushed to remove the dependency on powershell v3 a week or so ago, so that's legit. Based on $toolsDir = Split-Path -parent $MyInvocation.MyCommand.Definition
$paramsText = get-content "$($toolsDir)\params.txt"
$p = $paramsText.Split("`n") (the error doesn't give the line number within the chocolateyinstall.ps1 :( ). Please would you try (in powershell):
Then the following statements one by one # you should now be in the unzipped directory, from above
cat .\tools\params.txt
$toolsDir = ".\tools"
$paramsText = get-content "$($toolsDir)\params.txt"
write-host "paramsText: $paramsText"
write-host $paramsText.GetType()
$p = $paramsText.Split("`n")
write-host "split: $p" ... and paste me back what happens? |
@petemounce Thank you. I just downloaded the bazel nupkg from "https://chocolatey.org/api/v2/package/bazel/0.4.4.20170306", not using "Invoke-webrequest https://chocolatey.org/api/v2/package/bazel/0.4.4.20170306 -outfile bazel.0.4.4.20170306.zip", because I am not familiar with PowerShell (and also didn't figure out how to copy the output in PwerShell console yet). Then I unzipped it and entered the bazel0.4.4.20170306 folder. Then: $toolsDir = ".\tools"
write-host "paramsText: $paramsText" write-host $paramsText.GetType() $p = $paramsText.Split("`n")
|
@petemounce So actually I couldn't run write-host "split: $p" at all. |
Ok, great - please now try (in the same powershell if it's still open) $paramsText[0]
# should show the url to the release
$paramsText[1]
# should show the hash starting with "fb633" |
@petemounce Yes, they showed up. |
Perfect. I think |
@petemounce Thanks a lot. I have downloaded this version and unzipped it. Could you please tell me how I install it? Using Chocolatey? |
Can I use the command: choco install https://chocolatey.org/packages/bazel/0.4.4.20170314? Sorry again, this is actually my first time to use PowerShell, Chocolatey... |
Oh, sorry - run, in an administrator prompt, |
@petemounce Great, thanks a lot. Now Bazel has been installed. Thank you very much. |
@junyongyou my pleasure :) @meteorcloudy turns out I did. Please would you process #2671? I've already pushed fixes for 0.4.4 stable and 0.4.5-rc7. |
@petemounce The issue is already closed by our user. Thanks for helping us!! |
@petemounce Sorry, maybe I closed this issue too early. Even though it seems I have installed Bazel 0.4.4, it seems it doesn't run. After the first time I installed it, and then I typed "bazel" in cmd, and got some information. After that, when I tried to use it to build something, nothing happened. Now if I type "bazel" in cmd, nothing happens. I tried to reinstall it again, but still, bazel doesn't run. In my path environment, there are D:\msys64\usr\bin;C:\ProgramData\chocolatey\lib\msys2;C:\tools\msys64. I put them at first before any others. I believe the first was installed by me, and the last two should be installed by chocolatey. But anyway, why does bazel not run? Thank you very much. |
@petemounce There was one thing. As I said, bazel could run for the first time. After that, I entered a path which has a space in the name, and then I tried to build TensorFlow. The bazel said it couldn't run in the path name with space, and then quit. After that, bazel didn't run any more. |
It's important that the msys64 installation's \usr\bin (on my machine that's The bazel package will install msys2 from chocolatey if it thinks msys2 is not already installed. It is not intelligent enough to realise that you have installed it outside of chocolatey, sadly (that would be magical :) ). So, from what you posted, it's likely you now have 2 msys2 installs on your machine. Suggestions:
(It helps us to diagnose your problem if you copy/paste the commands that you ran and their output, and the directory path that you ran from into issues like these.) |
@meteorcloudy I meant the linked PR that adjusts the package so that @junyongyou can install it successfully. |
@petemounce Thank you. Actually my PATH environment variable like this: D:\msys64\usr\bin;C:\ProgramData\chocolatey\lib\msys2;C:\tools\msys64;d:\Anaconda3;... D:\msys64\usr\bin is the first one. I actually tried to move TensorFlow to a path without space, and then I found bazel doesn't work. Now when I type bazel in cmd, wherever the path is, nothing shows up. |
@petemounce I also tried to put C:\tools\msys64 at the first, and then ran bazel, but still, nothing showed. |
@petemounce Oh, you mean #2678, I'll take care of it. And @junyongyou , you should make sure |
@meteorcloudy Yes, I did that, put C:\tools\msys64\usr\bin at the first place. But again, nothing shows after typing bazel in cmd. |
If you run first
what happens? Please also paste us the result of Also, what is contained by |
@petemounce Sorry for the late response. I tried to run echo %LASTEXITCODE% after running bazel in cmd, and got "%LASTEXITCODE%"; also tried echo $LASTEXITCODE in powershell, and got 541541187. |
But a strange thing is that: I tried to run echo %LASTEXITCODE% several times, during which I ran bazel once, and got the information output (I mean guidance about using bazel). However, when I tried to repeat it, running bazel didn't give me anything. |
@petemounce It seems you pushed a commit that can fix my issue. Could you please tell me how I can install bazel now? Should I uninstall the previous v0.4.4.20170314 and then install a new one? If so, what version would it be? Thank you very much. |
That notification was because the PR for the original fix was closed. I think you now have a second issue. |
@petemounce Here is the result of echo %PATH%: And I put a snapshot of my c:\tools\msys64\usr\bin here: https://www.dropbox.com/s/7pl9ag61tmclz9a/msys64.png?dl=0 |
C:\tools\msys64\usr\bin appears twice in PATH because I set it as the first one in "User variables", but maybe I should put it in System variables, so I put it as the first one in System variables. But again, running bazel doesn't give me anything... |
Hm, I'm mystified. @laszlocsomor @dslomov ? |
In "cmd", you need to run @junyongyou : Some questions:
|
Note also that in my point (4) in the example command, there's a single "--" before "examples/cpp:hello-world". Notice that there's a space between them. The role of "--" is to tell Bazel that the rest of the command line is the targets to build, not flags. It's optional, I could've left it out. I wrote it in my example command to clarify exactly what flags I'm passing (though it may have had the opposite effect...) |
@laszlocsomor Thanks a lot. Now I manage to make bazel run. What I have to do is to first run C:\tools\msys64\usr\bin\bash.exe, and then bazel can run. I don't know why, or maybe this is the way that bazel runs? But thank you very much for your help. |
@laszlocsomor I also found that bazel can run in cmd, just if I am running the bash.exe. But if I close bash.exe, bazel doesn't run in cmd. |
@junyongyou : That's great news! Thanks for bearing with us. I think it's safest to always run Bazel from the MSYS shell, though I think it should also work from cmd.exe... apparently it doesn't. FYI, we're working hard to detach Bazel from MSYS, and are very close now. Follow #2107 if you're interested. And @petemounce , you're awesome, thanks for your efforts in helping @junyongyou ! |
@laszlocsomor @petemounce Thank you soooo much for your helps. I really appreciate. I will follow #2107 and thank you again for making bazel. |
I want to install Bazel on Windows 7 64bit. I am using Chogolatey v0.10.3, and then I ran "choco install bazel", and got an error: Method invocation failed because [System.Object[]] doesn't contain a method named 'Split'.
How can I install Bazel. I have tried to use the binary distribution with no success already. Thanks a lot.
The text was updated successfully, but these errors were encountered: