-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Use bash on windows #27195
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
Use bash on windows #27195
Conversation
sure |
@alimcmaster1 I was trying a few days ago something similar for geopandas (although for appveyor), and needed some PATH manipulations in the end to get this working (with the help of @msarahan) , see geopandas/geopandas#1029. It might be that something similar is needed here, if the |
Awesome thanks for the pointer @jorisvandenbossche |
@jorisvandenbossche is this close to being ready? |
@jbrockmendel - still needs a bit of work. CI is currently only passing on windows. I will take another look |
Doesn't look like build logs are still available but does the below link from Azure not solve the issue? |
Thanks @WillAyd will give that a try |
ci/azure/posix.yml
Outdated
@@ -56,15 +56,20 @@ jobs: | |||
steps: | |||
- script: | | |||
if [ "$(uname)" == "Linux" ]; then sudo apt-get install -y libc6-dev-i386 $EXTRA_APT; fi | |||
echo '##vso[task.prependpath]$(HOME)/miniconda3/bin' | |||
echo '##vso[task.setvariable variable=MINICONDA_DIR]$(HOME)/miniconda3' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to be executed by bash
and not script
(which on windows is just cmd.exe). Not sure if there is an overarching reason for this and similar blocks to be script
but as mentioned changing to bash
might fix the issue remaining
ci/azure/windows.yml
Outdated
conda env create -q --file ci\\deps\\azure-windows-$(CONDA_PY).yaml | ||
displayName: 'Create anaconda environment' | ||
- script: | | ||
call activate pandas-dev | ||
call conda list | ||
call conda.bat activate pandas-dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just change all of the script
commands to bash
and then just use without call
? Right now the usage looks mixed so would make things consistent and easier to read I think for non-Windows people
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed all of windows.yml
file script
steps to use bash
instead
@@ -18,22 +18,26 @@ jobs: | |||
|
|||
steps: | |||
- powershell: | | |||
Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" | |||
Write-Host "##vso[task.prependpath]$HOME/miniconda3/bin" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct this to miniconda dir which is $env:CONDA
ci/azure/windows.yml
Outdated
call activate | ||
conda env create -q --file ci\\deps\\azure-windows-$(CONDA_PY).yaml | ||
- bash: | | ||
source $MINICONDA_DIR/etc/profile.d/conda.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary with the vso task above?
ci/azure/windows.yml
Outdated
conda update -q -y -n base conda | ||
displayName: 'Update conda' | ||
- bash: | | ||
source $MINICONDA_DIR/etc/profile.d/conda.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question here; I think the task already puts conda on the path so no need to run this script (assuming that's what it does)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i found this was necessary too - otherwise conda complains you need to run conda init
. Let me double check this though. sourcing conda.sh here seemed to handle everything nicely
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confirmed I definitely need this otherwise we get:
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
This is almost over the line - I will update the windows CI to use run_tests.sh so its consistent with Linux CI |
@WillAyd i've fixed this up + edited description highlighting what this hopes to achieve mind taking a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit unsure on this... I think changing source deactivate
by conda deactivate
is trivial, and fixes the warning.
Didn't check the windows build in detail, but I don't think in Linux there is any warning on using source activate
, and we are significantly increasing the complexity of the build to make it a conda activate
.
I'd open separate PRs, as there are surely good changes here. But replacing source activate pandas-dev
by source $MINICONDA_DIR/etc/profile.d/conda.sh && conda activate pandas-dev
doesn't seem reasonable to me.
|
||
py37_np141: | ||
ENV_FILE: ci/deps/azure-windows-37.yaml | ||
CONDA_PY: "37" | ||
PATTERN: "not slow and not network" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this related? If not, I think we should have it in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay agree - let me factor this out to a separate PR. This was part of the work to move the windows CI scripts to use bash. (FYI I'm away from my keyboard for a few weeks - but will work on this when I return)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you factor this out
Yea agreed on that. So doesn't using |
Sounds good thanks @alimcmaster1 |
.travis.yml
Outdated
- echo "after_script done" | ||
- conda activate pandas-dev && pushd /tmp && python -c "import pandas; pandas.show_versions();" && popd | ||
- ci/print_skipped.py | ||
- echo "after_script done" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need a newline
ci/azure/posix.yml
Outdated
python ci/print_skipped.py | ||
displayName: 'Print skipped tests' | ||
displayName: 'Print skipped tests' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a newline
|
||
py37_np141: | ||
ENV_FILE: ci/deps/azure-windows-37.yaml | ||
CONDA_PY: "37" | ||
PATTERN: "not slow and not network" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you factor this out
can you merge master |
Will do - waiting for @datapythonista to merge his PR first |
can you rebase here anyway? |
@alimcmaster1 can you pls rebase? |
@alimcmaster1 it looks like you just pushed, but GH still says there are conflicts |
@jbrockmendel sorry for the delay updated. We should wait till #28531 is merged as in my PR here we are currently calling pytest with n = 2 and n=1 on windows where as the current behaviour just calls: This change means the steps in both |
Closing as the scope of this changed slight. Will summarise and open fresh PR - to make this easier to review. Thanks all for the comments |
Also worth considering that we can move things to GitHub Actions |
git diff upstream/master -u -- "*.py" | flake8 --diff
As per travis logs:
https://travis-ci.org/pandas-dev/pandas/jobs/552444580
As of conda 4.6 the preferred way of using an environment is to use
conda activate (env)
.source activate
will eventually be deprecated(only remaining place to do this is in
code_checks.yml
-> I will do this in a follow up for ease of review)This make the steps in the
windows.yml
andposix.yml
file very similar and we can potentially merge these.Use
run_tests.sh
on windows this will mean we now tests withpytest -n 2
andpytest -n 1
on windows - now consistent with the linux buildscc. @TomAugspurger @datapythonista