Skip to content

CI: Use conda compiler in environment.yml #27062

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 20 commits into from
Closed

CI: Use conda compiler in environment.yml #27062

wants to merge 20 commits into from

Conversation

marcelotrevisani
Copy link

Improvement to the conda environment to use the compiler from the virtual env instead of the system

Using the cxx-compile would be better because it will use the compiler from the virtual environment and it will not rely on the system anymore. That would be great to also avoid any kind of abi problems if someone uses some old compiler

  • closes #xxxx
  • tests added / passed
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

Makefile Outdated
@@ -10,7 +10,7 @@ clean_pyc:
-find . -name '*.py[co]' -exec rm {} \;

build: clean_pyc
python setup.py build_ext --inplace
python setup.py build_ext --inplace --compiler=$CC
Copy link
Contributor

Choose a reason for hiding this comment

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

this is not used in our CI at all, though I do use it locally, so nice to improve this generally.

We should add some documentation (in contributing.rst) that things exist & work (not 100% sure this actually works on windows; the Makefile)

Copy link
Author

Choose a reason for hiding this comment

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

That is true, unless pandas is using mingw it will not going to use it, indeed
but this part I am just enforcing it, because cython usually already uses the $CC

@marcelotrevisani
Copy link
Author

#27061 should be merged first, after that I can rebase from main

@marcelotrevisani
Copy link
Author

marcelotrevisani commented Jun 26, 2019

For example, it will use the compiler from the conda virtual environment

/home/trevisani/miniconda3/envs/pandas-dev/bin/x86_64-conda_cos6-linux-gnu-cc -DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -fPIC -DNPY_NO_DEPRECATED_API=0 -I/home/trevisani/miniconda3/envs/pandas-dev/lib/python3.7/site-packages/numpy/core/include -I/home/trevisani/miniconda3/envs/pandas-dev/include/python3.7m -c pandas/util/move.c -o build/temp.linux-x86_64-3.7/pandas/util/move.o -Wno-unused-function
x86_64-conda_cos6-linux-gnu-gcc -pthread -shared -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-rpath,/home/trevisani/miniconda3/envs/pandas-dev/lib -L/home/trevisani/miniconda3/envs/pandas-dev/lib -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-rpath,/home/trevisani/miniconda3/envs/pandas-dev/lib -L/home/trevisani/miniconda3/envs/pandas-dev/lib -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 build/temp.linux-x86_64-3.7/pandas/util/move.o -o /home/trevisani/pandas/pandas/pandas/util/_move.cpython-37m-x86_64-linux-gnu.so

That would be multiplatform as well, in that way it will isolate the compilation process from the system

As you can see it is using this compiler /home/trevisani/miniconda3/envs/pandas-dev/bin/x86_64-conda_cos6-linux-gnu-cc

@marcelotrevisani
Copy link
Author

Still need some work, the CI is getting the compiler from the system, at least for osx

@codecov
Copy link

codecov bot commented Jun 26, 2019

Codecov Report

Merging #27062 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #27062      +/-   ##
==========================================
- Coverage   92.04%   92.03%   -0.01%     
==========================================
  Files         180      180              
  Lines       50713    50713              
==========================================
- Hits        46680    46676       -4     
- Misses       4033     4037       +4
Flag Coverage Δ
#multiple 90.68% <ø> (ø) ⬆️
#single 41.86% <ø> (-0.09%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 88.88% <0%> (-11.12%) ⬇️
pandas/core/frame.py 96.89% <0%> (-0.12%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ff50b46...d810dda. Read the comment docs.

@codecov
Copy link

codecov bot commented Jun 26, 2019

Codecov Report

Merging #27062 into master will decrease coverage by 1.19%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #27062     +/-   ##
=========================================
- Coverage   92.98%   91.78%   -1.2%     
=========================================
  Files         184      180      -4     
  Lines       50362    50934    +572     
=========================================
- Hits        46827    46752     -75     
- Misses       3535     4182    +647
Flag Coverage Δ
#multiple 90.48% <ø> (-1.17%) ⬇️
#single 42.01% <ø> (-0.48%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 88.88% <0%> (-11.12%) ⬇️
pandas/util/_decorators.py 92.13% <0%> (-3.22%) ⬇️
pandas/core/dtypes/cast.py 91.05% <0%> (-2.01%) ⬇️
pandas/core/indexing.py 93% <0%> (-1.82%) ⬇️
pandas/core/dtypes/common.py 96.35% <0%> (-1.44%) ⬇️
pandas/core/series.py 92.5% <0%> (-1.17%) ⬇️
pandas/core/groupby/ops.py 96% <0%> (-0.92%) ⬇️
pandas/core/tools/datetimes.py 85.05% <0%> (-0.74%) ⬇️
pandas/core/internals/blocks.py 95.01% <0%> (-0.58%) ⬇️
pandas/core/arrays/categorical.py 95.95% <0%> (-0.51%) ⬇️
... and 160 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 88ccb25...27fa92e. Read the comment docs.

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 think we should test this in windows, I guess Makefile is rarely used if ever, but we want to make sure the environment can be resolved.

I'll see if I have time to add the build of the docs from windows, and then we'll have a windows build using environment.yml, but if someone can test this before manually that would be great.

environment.yml Outdated
@@ -79,5 +81,4 @@ dependencies:
- xlrd # pandas.read_excel, DataFrame.to_excel, pandas.ExcelWriter, pandas.ExcelFile
- xlsxwriter # pandas.read_excel, DataFrame.to_excel, pandas.ExcelWriter, pandas.ExcelFile
- xlwt # pandas.read_excel, DataFrame.to_excel, pandas.ExcelWriter, pandas.ExcelFile
- pip:
- pyreadstat # pandas.read_spss
- pyreadstat # pandas.read_spss
Copy link
Member

Choose a reason for hiding this comment

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

Can you revert this change here please. After that, you should run ./scripts/generate_pip_deps_from_conda.py so requirements.txt is synchronized with the changes here.

Copy link
Author

@marcelotrevisani marcelotrevisani Jun 28, 2019

Choose a reason for hiding this comment

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

Sure, I will rebase my branch from master and that should be reverted

environment.yml Outdated
@@ -14,6 +14,8 @@ dependencies:

# building
- cython>=0.28.2
- cxx-compiler
- zlib
Copy link
Member

Choose a reason for hiding this comment

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

can you add a short description why those are needed

Copy link
Author

Choose a reason for hiding this comment

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

Sure! I will add the explanation, actually the zlib we can remove since it is already a dependency of other packages

Copy link
Author

Choose a reason for hiding this comment

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

I also think that the conda-forge channel should be prioritized by the defaults
since not all of the packages are present on the default channel and the project is using the missing packages from conda-forge, you might see some problems in the future (unlikely) but it is better to avoid any kind of problem

But I can create another PR for that

@datapythonista datapythonista added CI Continuous Integration Dependencies Required and optional dependencies labels Jun 27, 2019
@datapythonista datapythonista changed the title Improvement to the conda environment CI: Use conda environment in `environment.yml1 Jun 27, 2019
@datapythonista datapythonista changed the title CI: Use conda environment in `environment.yml1 CI: Use conda compiler in environment.yml Jun 27, 2019
@pep8speaks
Copy link

pep8speaks commented Jul 2, 2019

Hello @marcelotrevisani! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 165:16: E131 continuation line unaligned for hanging indent
Line 166:28: E131 continuation line unaligned for hanging indent
Line 168:67: W292 no newline at end of file

Comment last updated at 2019-07-02 07:38:21 UTC

@marcelotrevisani
Copy link
Author

I will squash my commits when it is ready to be integrated.
I just found one problem with Linux, for some reason one of the builds is still using the compiler from the system. It needs more investigation

@TomAugspurger
Copy link
Contributor

I will squash my commits when it is ready to be integrated.

No need to squash, we do that on merge.

@WillAyd
Copy link
Member

WillAyd commented Aug 28, 2019

@marcelotrevisani is this still active? Can you merge master?

@marcelotrevisani
Copy link
Author

@marcelotrevisani is this still active? Can you merge master?

Sure, during this weekend I will have some time and I am going to do it

CCACHE=ccache
echo "ccache: $CCACHE"
export CC="ccache $CC"
elif [ -z "$NOCACHE" ] && [ "${TRAVIS_OS_NAME}" == "osx" ]; then
Copy link
Member

Choose a reason for hiding this comment

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

Can this conditional branch be combined with the one above? Seems like mostly copy / paste save one off things so would be easier to read if consolidated

@jbrockmendel
Copy link
Member

@marcelotrevisani can you rebase

@jreback
Copy link
Contributor

jreback commented Oct 6, 2019

@marcelotrevisani we have had a fair amount of CI churn recently, so if you can merge master we can look again

@WillAyd
Copy link
Member

WillAyd commented Oct 11, 2019

Nice PR but I think this has gone stale. @marcelotrevisani ping if you'd like to pick this back up

@WillAyd WillAyd closed this Oct 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration Dependencies Required and optional dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants