andreped / super-ml-pets

🐢 AI for Super Auto Pets
MIT License
31 stars 13 forks source link

scikit installation error #75

Closed Gyrnw closed 10 months ago

Gyrnw commented 10 months ago

Describe the bug scikit fails to install while installing requirements.txt

To Reproduce Collecting scikit-learn<=1.1 (from -r requirements.txt (line 10)) Using cached scikit-learn-1.1.0.tar.gz (6.8 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
      ╰─> [66 lines of output]
          Partial import of sklearn during the build process.
          setup.py:128: DeprecationWarning:

            `numpy.distutils` is deprecated since NumPy 1.23.0, as a result
            of the deprecation of `distutils` itself. It will be removed for
            Python >= 3.12. For older Python versions it will remain present.
            It is recommended to use `setuptools < 60.0` for those Python versions.
            For more details, see:
              https://numpy.org/devdocs/reference/distutils_status_migration.html

            from numpy.distutils.command.build_ext import build_ext  # noqa
          INFO: No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
          Traceback (most recent call last):
            File "C:\Users\HP\super-ml-pets\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
              main()
            File "C:\Users\HP\super-ml-pets\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
              json_out['return_val'] = hook(**hook_input['kwargs'])
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "C:\Users\HP\super-ml-pets\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 149, in prepare_metadata_for_build_wheel
              return hook(metadata_directory, config_settings)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "C:\Users\HP\AppData\Local\Temp\pip-build-env-msie9ef9\overlay\Lib\site-packages\setuptools\build_meta.py", line 174, in prepare_metadata_for_build_wheel
              self.run_setup()
            File "C:\Users\HP\AppData\Local\Temp\pip-build-env-msie9ef9\overlay\Lib\site-packages\setuptools\build_meta.py", line 268, in run_setup
              self).run_setup(setup_script=setup_script)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "C:\Users\HP\AppData\Local\Temp\pip-build-env-msie9ef9\overlay\Lib\site-packages\setuptools\build_meta.py", line 158, in run_setup
              exec(compile(code, __file__, 'exec'), locals())
            File "setup.py", line 328, in <module>
              setup_package()
            File "setup.py", line 324, in setup_package
              setup(**metadata)
            File "C:\Users\HP\AppData\Local\Temp\pip-build-env-msie9ef9\overlay\Lib\site-packages\numpy\distutils\core.py", line 135, in setup
              config = configuration()
                       ^^^^^^^^^^^^^^^
            File "setup.py", line 187, in configuration
              config.add_subpackage("sklearn")
            File "C:\Users\HP\AppData\Local\Temp\pip-build-env-msie9ef9\overlay\Lib\site-packages\numpy\distutils\misc_util.py", line 1050, in add_subpackage
              config_list = self.get_subpackage(subpackage_name, subpackage_path,
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "C:\Users\HP\AppData\Local\Temp\pip-build-env-msie9ef9\overlay\Lib\site-packages\numpy\distutils\misc_util.py", line 1016, in get_subpackage
              config = self._get_configuration_from_setup_py(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "C:\Users\HP\AppData\Local\Temp\pip-build-env-msie9ef9\overlay\Lib\site-packages\numpy\distutils\misc_util.py", line 958, in _get_configuration_from_setup_py
              config = setup_module.configuration(*args)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "C:\Users\HP\AppData\Local\Temp\pip-install-u2kdeqt5\scikit-learn_93eab9ee716e470fb1ea9a6ccb18568c\sklearn\setup.py", line 85, in configuration
              cythonize_extensions(top_path, config)
            File "C:\Users\HP\AppData\Local\Temp\pip-install-u2kdeqt5\scikit-learn_93eab9ee716e470fb1ea9a6ccb18568c\sklearn\_build_utils\__init__.py", line 47, in cythonize_extensions
              basic_check_build()
            File "C:\Users\HP\AppData\Local\Temp\pip-install-u2kdeqt5\scikit-learn_93eab9ee716e470fb1ea9a6ccb18568c\sklearn\_build_utils\pre_build_helpers.py", line 119, in basic_check_build
              compile_test_program(code)
            File "C:\Users\HP\AppData\Local\Temp\pip-install-u2kdeqt5\scikit-learn_93eab9ee716e470fb1ea9a6ccb18568c\sklearn\_build_utils\pre_build_helpers.py", line 75, in compile_test_program
              ccompiler.compile(
            File "C:\Users\HP\AppData\Local\Temp\pip-build-env-msie9ef9\overlay\Lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 327, in compile
              self.initialize()
            File "C:\Users\HP\AppData\Local\Temp\pip-build-env-msie9ef9\overlay\Lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 224, in initialize
              vc_env = _get_vc_env(plat_spec)
                       ^^^^^^^^^^^^^^^^^^^^^^
            File "C:\Users\HP\AppData\Local\Temp\pip-build-env-msie9ef9\overlay\Lib\site-packages\setuptools\msvc.py", line 316, in msvc14_get_vc_env
              return _msvc14_get_vc_env(plat_spec)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "C:\Users\HP\AppData\Local\Temp\pip-build-env-msie9ef9\overlay\Lib\site-packages\setuptools\msvc.py", line 270, in _msvc14_get_vc_env
              raise distutils.errors.DistutilsPlatformError(
          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.

Screenshots image Downloaded the build tools from the Microsoft C++ Build Tools link provided in the error message, but produced the same error upon retrying installation

Desktop (please complete the following information):

andreped commented 10 months ago

Hello, @Gyrnw!

Your Python version is incompatible with super-ml-pets. Sadly, super-ml-pets depends on some older packages that cannot be upgraded, so we are unable to support newer versions of Python. However, Python 3.8-3.10 should work fine. Please install an older version and try again.

This fails because it tries to build some dependency from scratch, which only happens if there is no precompiled wheel for your Python version matching the library with version in question. By downgrading to a supported Python version, the wheel should install find, without needing to build it.

Gyrnw commented 10 months ago

I switched to Python 3.10 but venv tries to access the nonexistent old 3.11 folder when trying to do the requirements.txt installation, how do I fix this ?

andreped commented 10 months ago

I switched to Python 3.10 but venv tries to access the nonexistent old 3.11 folder when trying to do the requirements.txt installation, how do I fix this ?

You will have to delete the old venv/ folder and run the venv installation again.

Gyrnw commented 10 months ago

When I enter the virtual environment python doesn't seem to work anymore

Pre-venv check: PS C:\Users\HP\super-ml-pets> python --version Python 3.10.11

Post-venv check: (venv) PS C:\Users\HP\super-ml-pets> python --version Unable to create process using 'C:\Users\HP\AppData\Local\Programs\Python\Python39\python.exe --version'

Upon entering: (venv) PS C:\Users\HP\super-ml-pets> pip install -r requirements.txt

This error is returned: Unable to create process using 'C:\Users\HP\AppData\Local\Programs\Python\Python39\python.exe "C:\Users\HP\super-ml-pets\venv\Scripts\pip.exe" install -r requirements.txt'

I suspect it is trying to access the wrong one (shown in image 2), but according to my microsoft store library python 3.10 is the only one I have, i don't know if the other ones are from pycharm or anywhere else

image image

andreped commented 10 months ago

Delete the Python version that does not work. You only need one. Then open a new terminal and run: py -V or python -V to see which version you have accessible.

Then delete the old virtual env and create a new one.

If you are paranoid like me, be sure to write py -m virtualenv and not just virtualenv, that should ensure that you map to the right Python version.

Alternative use venv which is much easier: py -m venv venv/


Also, it was a bit confusing. It looks like you have two Python versions, why are you unable to find/delete the other? Where did you look to find both.

Gyrnw commented 10 months ago

I looked in "Add or remove programs" and they were there, but not in the microsoft store library so they might not be for terminal . Ill delete the 3.9 ones and edit this comment on what happens.

andreped commented 10 months ago

I looked in "Add or remove programs" and they were there, but not in the microsoft store library so they might not be for terminal . Ill delete the 3.9 ones and edit this comment on what happens.

Yes, do that. Let me know if that resolves your issues.

If all else fails, I can recommend using Anaconda if you are having issues, just note that this is a separate instance of Python, but it comes with a lot of convenvience methods. Installing deps has to be done with conda and activating it is also different. I prefer pip and the standard python-way, but conda is quite popular as well. Just note that I have yet to test if conda is compatible with our current setup. For conda you also need the same python version that is compatible with the current setup, but it is easier to switch python versions.

Gyrnw commented 10 months ago

It is now resolved, i also used python instead of py when installing virtualenv, I didn't realize the difference between them before, using py lead to the virtual environment being ran in the 3.9 launcher.

Thank you for being patient with me, I'm a total newbie at running things through terminal.

andreped commented 10 months ago

It is now resolved, i also used python instead of py when installing virtualenv, I didn't realize the difference between them before, using py lead to the virtual environment being ran in the 3.9 launcher.

Thank you for being patient with me, I'm a total newbie at running things through terminal.

Fantastic! No worries! I have been there myself once and see the value of getting constructive feedback and assistance.

Note that the bot currently is not compatible with the current state of the game. They have changed the pet and UI style too much. Perhaps I can fix this later today, such that you could play around with the bot tomorrow?