-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Parallel build_ext might fail due to file collisions #30873
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
Comments
You are using the MSVC compiler right? Not sure if it matters just asking |
Yes. |
I sometimes do pandas dev on windows and recall running into this exact problem with |
Maybe @scoder or someone from Cython can help? |
Was this fixed by #30862? Can this be closed now? |
@adamjstewart Don't think so. I opened this one while #30862 was being developed. |
This is actually a pretty awful bug in distutils. Basically, if you use the same source file in two extensions, distutils can hit pretty nasty race conditions compiling the file twice simultaneously. This is especially bad on Linux because there's no immediate error, but the installed extensions are simply broken (e.g. missing symbols). I'm going to submit a PR shortly. |
I'm equally astonished, appalled, and disappointed that Pandas developers like @jreback pushed back against #40285 with nonsensical commentary like "why is j more than like 4 actually useful?" I mean, come on. Scalability is an unconditional good. This is not up for meaningful debate. 🤦 The trivial resolution here is to do what everyone else in Python's standard scientific stack does: disable parallel building entirely by forcing Fortunately, this is trivial. Just override the
Boom! Issue trivially solved. Pandas then happily munch on bamboo shoots as a show of appreciation. 🎍 🐼 |
I can reliably reproduce this on Windows, see e.g. #46611 |
Can anyone confirm if choosing a different compiler helps? I assume by default this issue is affecting the visual studio compiler. I'm wondering if it is reproducible using another compiler on Windows |
Also does stdout show the MSVC as actually using the -j flag during compilation or is it mapped to something else? MSVC should be using /MP as the flag, so curious if that gets translated by setuptools along the way https://docs.microsoft.com/en-us/cpp/build/reference/mp-build-with-multiple-processes?view=msvc-170 |
Given the discussion above, I don't think it's a compiler issue. It has to do with how |
Might be overlooking but where is the setuptools discussion?
…Sent from my iPhone
On Apr 6, 2022, at 8:49 AM, Irv Lustig ***@***.***> wrote:
Can anyone confirm if choosing a different compiler helps? I assume by default this issue is affecting the visual studio compiler. I'm wondering if it is reproducible using another compiler on Windows
Given the discussion above, I don't think it's a compiler issue. It has to do with how setuptools has no intention of fixing this.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.
|
See above, particularly #30873 (comment) and #30873 (comment) |
I checked setuptools github but didn't find any bug report. Can someone link what is alluded to in those comments? The closest I could find is this. It is similar but not exactly the same: From personal experience I have found the MSVC to be pretty lacking compared to other compilers, from standards complaince, feature, and error / warning reporting perspectives. So it would be good to at least try some other compilers out and figure out if this is an OS issue or a compiler issue Depending on what we can figure out there we can try to report upstream in the appropriate channel. I think we all agree this isn't necessarily a pandas issue but if its something we want addressed we can likely push this along forward process of elimination |
See my original description at the top of this issue here; #30873 (comment) The parallelization of the process is done by Based on comments above, it could happen in Linux too. Probably the right solution for us is to split the building of the extensions in two parts. One part where there are no conflicts, and you can use the |
closed by #51525. |
Code Sample, a copy-pastable example if possible
Problem description
See some discussion in #30862 . I have 8 cores on Windows. When I use
-j 8
, in the middle of the build, I will get this error message:What I think is happening is that in
setup.py
,_libs.tslibs.conversion
,libs.tslibs.np_datetime
and_libs.tslibs.period
all have to compilepandas/_libs/tslibs/src/datetime/np_datetime.c
. If the parallel build is timed in such a way that two of those extensions are being built at the same time, then they can conflict in writingnp_datetime.obj
. A similar thing can happen with_libs.lib
,_libs.parsers
, and_libs.tslibs.parsing
all having to compilepandas/_libs/src/parser/tokenizer.c
.If I do two
python setup.py build_ext --inplace -j 8
steps in a row, then everything is fine. Also things are fine with-j 4
. But I can imagine that even with-j 4
, you could end up with the same kind of issue, even in CI.I don't know enough about how extensions are built, distutils and setuptools in order to avoid this potential collision during the build process.
Output of
pd.show_versions()
c:\Code\pandas_dev\pandas\pandas\core\index.py:29: FutureWarning: pandas.core.index is deprecated and will be removed in a future version. The public classes are available in the top-level namespace.
FutureWarning,
INSTALLED VERSIONS
commit : 13858f6
python : 3.7.6.final.0
python-bits : 64
OS : Windows
OS-release : 10
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 13, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.None
pandas : 0.26.0.dev0+1734.g13858f6e1
numpy : 1.17.3
pytz : 2019.3
dateutil : 2.8.1
pip : 19.3.1
setuptools : 42.0.2.post20191201
Cython : 0.29.14
pytest : 5.3.2
hypothesis : 4.57.1
sphinx : 2.3.1
blosc : None
feather : None
xlsxwriter : 1.2.7
lxml.etree : 4.4.2
html5lib : 1.0.1
pymysql : None
psycopg2 : None
jinja2 : 2.10.3
IPython : 7.10.1
pandas_datareader: None
bs4 : 4.8.2
bottleneck : 1.3.1
fastparquet : 0.3.2
gcsfs : None
lxml.etree : 4.4.2
matplotlib : 3.1.2
numexpr : 2.7.0
odfpy : None
openpyxl : 3.0.1
pandas_gbq : None
pyarrow : 0.15.1
pytables : None
pytest : 5.3.2
s3fs : 0.4.0
scipy : 1.3.1
sqlalchemy : 1.3.12
tables : 3.6.1
tabulate : 0.8.6
xarray : 0.14.1
xlrd : 1.2.0
xlwt : 1.3.0
xlsxwriter : 1.2.7
numba : 0.46.0
The text was updated successfully, but these errors were encountered: