Skip to content

DOC: Windows build instructions #59689

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
1 task done
andrewgsavage opened this issue Sep 2, 2024 · 9 comments · Fixed by #60170
Closed
1 task done

DOC: Windows build instructions #59689

andrewgsavage opened this issue Sep 2, 2024 · 9 comments · Fixed by #60170
Assignees
Labels
Build Library building on various platforms Docs Windows Windows OS

Comments

@andrewgsavage
Copy link

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

https://pandas.pydata.org/docs/dev/development/contributing_environment.html#step-1-install-a-c-compiler

Documentation problem

Installing VS Build Tools 2022 with default settings gives me the following error when I build with mason:


(pandas-dev) C:\Users\andre\repos\pandas>python -m pip install -ve . --no-build-isolation --config-settings editable-verbose=true
Using pip 24.2 from C:\Users\andre\mambaforge\envs\pandas-dev\lib\site-packages\pip (python 3.10)
Obtaining file:///C:/Users/andre/repos/pandas
  Running command Checking if build backend supports build_editable
  Checking if build backend supports build_editable ... done
  Running command Preparing editable metadata (pyproject.toml)
  + meson setup C:\Users\andre\repos\pandas C:\Users\andre\repos\pandas\build\cp310 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --vsenv --native-file=C:\Users\andre\repos\pandas\build\cp310\meson-python-native-file.ini
  The Meson build system
  Version: 1.2.1
  Source dir: C:\Users\andre\repos\pandas
  Build dir: C:\Users\andre\repos\pandas\build\cp310
  Build type: native build
  Project name: pandas
  Project version: 3.0.0.dev0+1427.ge07453e24d

  ..\..\meson.build:2:0: ERROR: Unknown compiler(s): [['cl.exe']]
  The following exception(s) were encountered:
  Running `cl.exe /?` gave "[WinError 2] The system cannot find the file specified"

  A full log can be found at C:\Users\andre\repos\pandas\build\cp310\meson-logs\meson-log.txt
  error: subprocess-exited-with-error

  × Preparing editable metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: 'C:\Users\andre\mambaforge\envs\pandas-dev\python.exe' 'C:\Users\andre\mambaforge\envs\pandas-dev\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py' prepare_metadata_for_build_editable 'C:\Users\andre\AppData\Local\Temp\tmp_6e6694l'
  cwd: C:\Users\andre\repos\pandas
  Preparing editable metadata (pyproject.toml) ... error
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Suggested fix for documentation

Include instructions to select the optional MSVC v142 - VS 2019 C++ x64/x86 build tools on the right of the window:

image

after installing this it compiled.

@andrewgsavage andrewgsavage added Docs Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 2, 2024
@rhshadrach
Copy link
Member

Thanks for the report. How did you install VS Build Tools 2022 prior to adding MSVC v142?

@rhshadrach rhshadrach added Build Library building on various platforms Windows Windows OS Needs Info Clarification about behavior needed to assess issue and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 4, 2024
@ammar-qazi
Copy link
Contributor

@andrewgsavage
Thanks for this information. Thanks to you, I was able to compile pandas on my Windows system. That said, I also encountered an additional issue.

I couldn't import pandas outside the miniforge. When I tried doing so via VS Code and Pycharm, I got the following errors:

[11/37] Linking target pandas/_libs/tslibs/conversion.cp310-win_amd64.pyd
FAILED: pandas/_libs/tslibs/conversion.cp310-win_amd64.pyd 
"link"  /MACHINE:x64 /OUT:pandas/_libs/tslibs/conversion.cp310-win_amd64.pyd pandas/_libs/tslibs/conversion.cp310-win_amd64.pyd.p/meson-generated_pandas__libs_tslibs_conversion.pyx.c.obj "/nologo" "/release" "/nologo" "/OPT:REF" "/DLL" "/IMPLIB:pandas\_libs\tslibs\conversion.cp310-win_amd64.lib" "C:\Users\Ammar\.conda\envs\pandas-dev\libs\python310.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "comdlg32.lib" "advapi32.lib"
LINK : fatal error LNK1104: cannot open file 'pandas\_libs\tslibs\conversion.cp310-win_amd64.pyd'
[22/37] Compiling C object pandas/_libs/index.cp310-win_amd64.pyd.p/meson-generated_pandas__libs_index.pyx.c.obj
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "d:\Programming\Open Source Projects\Pandas\pandas-ammar\tempCodeRunnerFile.python", line 1, in <module>
    import pandas
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1002, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 945, in _find_spec
  File "C:\Users\Ammar\.conda\envs\pandas-dev\lib\site-packages\_pandas_editable_loader.py", line 268, in find_spec
    tree = self.rebuild()
  File "C:\Users\Ammar\.conda\envs\pandas-dev\lib\site-packages\_pandas_editable_loader.py", line 309, in rebuild
    subprocess.run(self._build_cmd, cwd=self._build_path, env=env, stdout=stdout, check=True)
  File "C:\Users\Ammar\.conda\envs\pandas-dev\lib\subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['meson', 'compile']' returned non-zero exit status 1.

While I couldn't find any documentation on the error, there was a comment on Stackflow, suggesting users to do pip install cython for resolving pandas import issues. I did the same, and my problem got resolved.

What's the reason for that? Isn't cython already present in the virtual environment?

@andrewgsavage
Copy link
Author

Thanks for the report. How did you install VS Build Tools 2022 prior to adding MSVC v142?

The same way, with everything in that screenshot, other than MSVC v142, selected.

@rhshadrach
Copy link
Member

Thanks @andrewgsavage. This was updated in #49799. @natmokval - when changing from VS Build Tools 2019 to 2022, do you know if it was ever verified that 2022 works with building pandas?

@rhshadrach rhshadrach added Needs Discussion Requires discussion from core team before further action and removed Needs Info Clarification about behavior needed to assess issue labels Sep 7, 2024
@natmokval
Copy link
Contributor

Thanks @andrewgsavage. This was updated in #49799. @natmokval - when changing from VS Build Tools 2019 to 2022, do you know if it was ever verified that 2022 works with building pandas?

@rhshadrach - If I remember correctly, I checked that VS Build Tools 2022 works for building pandas before updating the documentation on how to install a C compiler on Windows. See DOC: BT for VisualStudio2022

@Dr-Irv
Copy link
Contributor

Dr-Irv commented Sep 9, 2024

#59576 is related

@Ravenin7
Copy link
Contributor

I had the same error after following the steps on the doc here and it was resolved after adding MSVC v142 - VS 2019 C++ x64/x86 to the build tools.

If it's relevant, I also installed all the default selected tools given in that screenshot (except C++ ATL, C++ MFC, C++/CLI, and C++ Modules, which were unselected by default).

Thanks for the information @andrewgsavage!

@rhshadrach rhshadrach removed the Needs Discussion Requires discussion from core team before further action label Oct 30, 2024
@rhshadrach
Copy link
Member

Thanks @Ravenin7 - PRs to update the docs are welcome!

@Ravenin7
Copy link
Contributor

take

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 Docs Windows Windows OS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants