Error while installing scikit-learn with pip : Preparing metadata (pyproject.toml) did not run successfully

I try to install scikit-learn==1.2.2 for the django project and I got this error.

 Collecting scikit-learn==1.2.2
  Using cached scikit-learn-1.2.2.tar.gz (7.3 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [36 lines of output]
      Partial import of sklearn during the build process.
      Traceback (most recent call last):
        File "D:Group Project BackendPredictionenvLibsite-packagespip_vendorpyproject_hooks_in_process_in_process.py", line 353, in <module>
          main()
        File "D:Group Project BackendPredictionenvLibsite-packagespip_vendorpyproject_hooks_in_process_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "D:Group Project BackendPredictionenvLibsite-packagespip_vendorpyproject_hooks_in_process_in_process.py", line 149, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:UsersASUSAppDataLocalTemppip-build-env-_ej3exweoverlayLibsite-packagessetuptoolsbuild_meta.py", line 366, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "C:UsersASUSAppDataLocalTemppip-build-env-_ej3exweoverlayLibsite-packagessetuptoolsbuild_meta.py", line 487, in run_setup
          super().run_setup(setup_script=setup_script)
        File "C:UsersASUSAppDataLocalTemppip-build-env-_ej3exweoverlayLibsite-packagessetuptoolsbuild_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 669, in <module>
        File "<string>", line 663, in setup_package
        File "<string>", line 597, in configure_extension_modules
        File "C:UsersASUSAppDataLocalTemppip-install-xv622fd3scikit-learn_6df30b226b524d1caf236a6b94005795sklearn_build_utils__init__.py", line 47, in cythonize_extensions
          basic_check_build()
        File "C:UsersASUSAppDataLocalTemppip-install-xv622fd3scikit-learn_6df30b226b524d1caf236a6b94005795sklearn_build_utilspre_build_helpers.py", line 82, in basic_check_build
          compile_test_program(code)
        File "C:UsersASUSAppDataLocalTemppip-install-xv622fd3scikit-learn_6df30b226b524d1caf236a6b94005795sklearn_build_utilspre_build_helpers.py", line 38, in compile_test_program
          ccompiler.compile(
        File "C:UsersASUSAppDataLocalTemppip-build-env-_ej3exweoverlayLibsite-packagessetuptools_distutils_msvccompiler.py", line 343, in compile
          self.initialize()
        File "C:UsersASUSAppDataLocalTemppip-build-env-_ej3exweoverlayLibsite-packagessetuptools_distutils_msvccompiler.py", line 253, in initialize
          vc_env = _get_vc_env(plat_spec)
                   ^^^^^^^^^^^^^^^^^^^^^^
        File "C:UsersASUSAppDataLocalTemppip-build-env-_ej3exweoverlayLibsite-packagessetuptoolsmsvc.py", line 230, in msvc14_get_vc_env
          return _msvc14_get_vc_env(plat_spec)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:UsersASUSAppDataLocalTemppip-build-env-_ej3exweoverlayLibsite-packagessetuptoolsmsvc.py", line 187, in _msvc14_get_vc_env
          raise distutils.errors.DistutilsPlatformError("Unable to find vcvarsall.bat")
      distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
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.

`

I am using pyhton 3.12.2 in my windows machine. I am building career prediction website using React and django.I use vscode as my IDE. I train a model using google collab and it is used version 1.2.2 of the scikit-learn. I can install other packages like Django,djangorestframework but can’t install scikit-learn.
I’m installing everything in virtual environment.

New contributor

Chandima Maduwantha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật