ModuleNotFoundError: No module named 'setuptools_rust' error is not because of pip

209 Views Asked by At

I'm trying to install autopy, but I get this error

Collecting autopy
  Using cached autopy-4.0.0.tar.gz (20 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      Traceback (most recent call last):
        File "C:\Users\89651\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\89651\AppData\Local\Programs\Python\Python311\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\89651\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\89651\AppData\Local\Temp\pip-build-env-2ctyo4gw\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\89651\AppData\Local\Temp\pip-build-env-2ctyo4gw\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "C:\Users\89651\AppData\Local\Temp\pip-build-env-2ctyo4gw\overlay\Lib\site-packages\setuptools\build_meta.py", line 480, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "C:\Users\89651\AppData\Local\Temp\pip-build-env-2ctyo4gw\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 8, in <module>
      ModuleNotFoundError: No module named 'setuptools_rust'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel 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.

I googled it and found that this is because of outdated pip. But I have the latest version of pip and the note says that it's likely not a problem with pip. I also found that people get this error on versions of python above 3.8, but I didn't upgrade my python and it was working just fine. What do I do?

2

There are 2 best solutions below

0
Deadpool On

I am not sure if you have installed the necessary prerequisites or not, but as you can see in the autopy repository installation guide, you have to:

  1. Install the rustup
  2. Install the nightly version of Rust 2019 (nightly-2019-10-05) through therustup.
  3. Install the setuptools-rust through the pip: pip install -U setuptools-rust (Take a look at the repository guide for further details).
  4. Finally, you will be able to install the autopy
0
lebed lebedev On

It turns out I was running python with autopy in a different environment, where python version was 3.8, so it was working there, but not in python 3.11. Thank you all who answered