Skip to content

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

Closed
wants to merge 4 commits into from
Closed

Use bash on windows #27195

wants to merge 4 commits into from

Conversation

alimcmaster1
Copy link
Member

@alimcmaster1 alimcmaster1 commented Jul 2, 2019

As per travis logs:
https://travis-ci.org/pandas-dev/pandas/jobs/552444580

ccache: /usr/bin/ccache
source deactivate
DeprecationWarning: 'source deactivate' is deprecated. Use 'conda deactivate'.

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 and posix.yml file very similar and we can potentially merge these.

  • Use run_tests.sh on windows this will mean we now tests with pytest -n 2 and pytest -n 1 on windows - now consistent with the linux builds

cc. @TomAugspurger @datapythonista

@jreback jreback added the Build Library building on various platforms label Jul 2, 2019
@jreback jreback added this to the 0.25.0 milestone Jul 2, 2019
@jreback
Copy link
Contributor

jreback commented Jul 2, 2019

sure

@jreback jreback removed this from the 0.25.0 milestone Jul 3, 2019
@jorisvandenbossche
Copy link
Member

@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 conda init bash does not work on CI.

@alimcmaster1
Copy link
Member Author

Awesome thanks for the pointer @jorisvandenbossche

@jbrockmendel
Copy link
Member

@jorisvandenbossche is this close to being ready?

@alimcmaster1
Copy link
Member Author

@jbrockmendel - still needs a bit of work. CI is currently only passing on windows. I will take another look

@WillAyd
Copy link
Member

WillAyd commented Aug 28, 2019

Doesn't look like build logs are still available but does the below link from Azure not solve the issue?

https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/anaconda?view=azure-devops&tabs=ubuntu-16-04#add-conda-to-your-system-path

@alimcmaster1
Copy link
Member Author

Thanks @WillAyd will give that a try

@@ -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'
Copy link
Member

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

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
Copy link
Member

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

Copy link
Member Author

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"
Copy link
Member Author

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

call activate
conda env create -q --file ci\\deps\\azure-windows-$(CONDA_PY).yaml
- bash: |
source $MINICONDA_DIR/etc/profile.d/conda.sh
Copy link
Member

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?

conda update -q -y -n base conda
displayName: 'Update conda'
- bash: |
source $MINICONDA_DIR/etc/profile.d/conda.sh
Copy link
Member

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)

Copy link
Member Author

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

Copy link
Member Author

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.

@alimcmaster1
Copy link
Member Author

This is almost over the line - I will update the windows CI to use run_tests.sh so its consistent with Linux CI

@alimcmaster1 alimcmaster1 changed the title WIP: Remove conda warning Remove conda warning + Use bash on windows Sep 14, 2019
@alimcmaster1
Copy link
Member Author

@WillAyd i've fixed this up + edited description highlighting what this hopes to achieve mind taking a look?

Copy link
Member

@datapythonista datapythonista left a 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"
Copy link
Member

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.

Copy link
Member Author

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)

Copy link
Contributor

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

@WillAyd
Copy link
Member

WillAyd commented Sep 16, 2019

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.

Yea agreed on that. So doesn't using bash instead of script get rid of the need for the former? I thought the point of the VSO task was to enable simple conda usage without source so long as bash is used. I'm also not sure there's a point to using script / cmd.exe on Windows

@alimcmaster1
Copy link
Member Author

Going to wait till #28531 is merged then I will open a separate PR to update windows.yml to use bash in the steps opposed to script. As per #26344. Unless any dev's disagree?

@datapythonista
Copy link
Member

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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need a newline

python ci/print_skipped.py
displayName: 'Print skipped tests'
displayName: 'Print skipped tests'
Copy link
Contributor

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"
Copy link
Contributor

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

@jreback
Copy link
Contributor

jreback commented Oct 18, 2019

can you merge master

@alimcmaster1
Copy link
Member Author

Will do - waiting for @datapythonista to merge his PR first

@jbrockmendel
Copy link
Member

waiting for datapythonista to merge his PR first

can you rebase here anyway?

@jbrockmendel
Copy link
Member

@alimcmaster1 can you pls rebase?

@jbrockmendel
Copy link
Member

@alimcmaster1 it looks like you just pushed, but GH still says there are conflicts

@alimcmaster1 alimcmaster1 changed the title Remove conda warning + Use bash on windows Use bash on windows Nov 2, 2019
@alimcmaster1
Copy link
Member Author

@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:
pytest -m "not slow and not network" --junitxml=test-data.xml pandas -n 2 -r sxX --strict --durations=10 %*

This change means the steps in both posix.yml and windows.yml should be similar. (and we can potentially merge)

@alimcmaster1
Copy link
Member Author

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

@datapythonista
Copy link
Member

Also worth considering that we can move things to GitHub Actions

@alimcmaster1 alimcmaster1 deleted the mcmali-conda-warning branch December 25, 2019 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Library building on various platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants