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

Due to a Travis limitation, python doesn't work on travis windows #1568

Closed
jkrems opened this issue Oct 12, 2018 · 11 comments
Closed

Due to a Travis limitation, python doesn't work on travis windows #1568

jkrems opened this issue Oct 12, 2018 · 11 comments
Assignees

Comments

@jkrems
Copy link

jkrems commented Oct 12, 2018

edit(refack): Currently python is not supported on Travis Windows

Refs: https://travis-ci.community/t/python-support-on-windows/241/2





OP:

Verbose output (from npm or node-gyp):
C:\Users\travis\build\jkrems\loader>if not defined npm_config_node_gyp (node "C:\ProgramData\nvs\node\10.12.0\x64\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\ProgramData\nvs\node\10.12.0\x64\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) 
gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\ProgramData\nvs\node\10.12.0\x64\node_modules\npm\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\ProgramData\nvs\node\10.12.0\x64\node_modules\npm\node_modules\node-gyp\lib\configure.js:509:16)
gyp ERR! stack     at C:\ProgramData\nvs\node\10.12.0\x64\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:154:21)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\ProgramData\\nvs\\node\\10.12.0\\x64\\node.exe" "C:\\ProgramData\\nvs\\node\\10.12.0\\x64\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\travis\build\jkrems\loader
gyp ERR! node -v v10.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! loader@0.0.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the loader@0.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\travis\AppData\Roaming\npm-cache\_logs\2018-10-12T16_48_43_061Z-debug.log
@jkrems
Copy link
Author

jkrems commented Oct 12, 2018

This might also be a travis issue but at least officially the docs claim that Python 2 and 3 are installed: https://github.com/travis-ci/packer-templates/blob/master/packer-assets/windows-server-2016-ci-onion-packages.txt

@bzoz
Copy link
Contributor

bzoz commented Oct 17, 2018

Can you try setting the PYTHON env variable?

@jkrems
Copy link
Author

jkrems commented Oct 17, 2018

I can try but it would likely mean wrapping the command somehow because this is a multi-os build and the path would change..? Or would it fall back to the normal searching on other systems if I set it to the Windows path?

@bzoz
Copy link
Contributor

bzoz commented Oct 18, 2018

Can you see what is in the PATH env variable on that machine?

@SimenB
Copy link
Member

SimenB commented Oct 18, 2018

Having the same issue. I added echo $PATH: https://travis-ci.org/SimenB/weak-travis-windows/jobs/443354201#L83

Feel free to send PRs to test other stuff if you want

$PATH pasted for convenience:

/c/Users/travis/.yarn/bin:/c/ProgramData/nvs/node/10.12.0/x64:node_modules/.bin:/c/program files/git/usr/bin:/c/program files/git/usr/bin:/c/tools/ruby25/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/ProgramData/GooGet:/c/Program Files/Google/Compute Engine/metadata_scripts:/c/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/bin:/c/Program Files/Google/Compute Engine/sysprep:/c/Program Files/Docker:/c/ProgramData/chocolatey/bin:/c/Program Files/Git/cmd:/c/Program Files/LLVM/bin:/c/Program Files/dotnet:/c/Users/travis/AppData/Local/Microsoft/WindowsApps:/c/tools/mingw64/bin

EDIT: I added which python and it explodes with which: no python in and prints $PATH.

@BanzaiMan is that expected?

EDIT2: Adding choco install python made no difference

@refack refack self-assigned this Oct 18, 2018
@refack
Copy link
Contributor

refack commented Oct 18, 2018

Did anyone try to add python: 2.7 to their .travis.yaml?

Also if anyone can run this file https://github.com/nodejs/node/blob/master/tools/msvs/find_python.cmd
with

set DEBUG_HELPER=1
find_python.cmd
echo VCBUILD_PYTHON_LOCATION

And paste the output, that will be great help

@refack refack added the Windows label Oct 18, 2018
@SimenB
Copy link
Member

SimenB commented Oct 18, 2018

@refack feel free to PR my repo, it should trigger CI builds. I pushed find_python now, but I don't think stuff runs in cmd.

EDIT: I guess we could launch powershell?

>The Windows build environment launches with support for Node.js, Rust, and Bash languages. We run a git bash shell, to maintain consistency with our other bash-based environments. This also allows you to shell out to PowerShell as needed. In addition, Docker is also available for Windows builds.

EDIT2: https://travis-ci.org/SimenB/weak-travis-windows/jobs/443367344#L84 Could not find Python.

@refack
Copy link
Contributor

refack commented Oct 18, 2018

EDIT2: travis-ci.org/SimenB/weak-travis-windows/jobs/443367344#L84 Could not find Python.

Thank you very much @SimenB, This result seems to indicate that python is not registered with the PEP 514 mechanism either.

So this is most likely a Travis issue. It's a known Travis limitation - https://travis-ci.community/t/python-support-on-windows/241/2

I would close this issue, but I'm keeping it open for tracking.

@refack refack changed the title Find python logic doesn't work on travis windows Doe to a Travis limitation, python doesn't work on travis windows Oct 18, 2018
@jkrems jkrems changed the title Doe to a Travis limitation, python doesn't work on travis windows Due to a Travis limitation, python doesn't work on travis windows Oct 19, 2018
@joaocgreis
Copy link
Member

Travis does not have Python installed. Python 2 is on the list of installed packages, but apparently it is not actually installed on the machines. Possibly a bug, Windows is in early access after all. I don't see a problem with node-gyp here.

This fixes it:

before_install:
  - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then cinst -y python2; fi

Next issue is that the job runs successfully but Travis does not seem to notice that is has completed, and terminated the build after 10 minutes.

https://travis-ci.community/t/python-support-on-windows/241 is not very clear out of context, but as I understand it is about using Travis to test projects written in Python, not about using Python as a script runner like we do here.

@joaocgreis
Copy link
Member

joaocgreis commented Nov 13, 2018

Adding this to .travis.yml makes node-gyp work on Travis:

env:
  global:
    - YARN_GPG=no

before_install:
  - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then cinst -y python2; fi

There are two issues:

@joaocgreis
Copy link
Member

Travis now has python2.exe in the path. It's version 2.7.9 and it's not installed from the python2 Chocolatey package, so it may be a dependency of something else. node-gyp now works without the workaround above.

The Yarn issue still exists. I'll close this issue since it is about node-gyp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants