2

For reference, I am using a Mac

I downloaded pycharm and wanted to get started on a project (I have never used pycharm on that specific laptop before)

When I tried to run the code, it was giving me an error. Turns out I didn't have an interpreter configured. It said:

<No interpreter>

So I went online and it said to

  1. click on "add interpreter"
  2. select "Existing" next to environment
  3. then to put /usr/bin/python3 as the interpreter

After doing this I was able to run the code. However, when I tried to add a library (PyQt5 in this case), it gave me an error

A little bit of digging and I figured the problem was that I was using System Python (aka the python3 that comes downloaded with the OS)

Then I thought I would install Python myself. To do so, I did the following:

  1. installed pyenv using homebrew
  2. downloaded python 3.11.0 using pyenv

Then I went back to PyCharm and created another interpreter. I did the following:

  1. clicked on "add interpreter"
  2. selected "Existing" next to environment
  3. put in Users/<username>/.pyenv/versions/3.11.0/bin/python3

Similar to my first attempt - the code ran but I was unable to download libraries

I tried a different path - Users/<username>/.pyenv/versions/3.11.0/bin/python Still didn't work.

The error that I am receiving when I try to download a library is as follows:

 error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [33 lines of output]
      Traceback (most recent call last):
        File "/Users/<username>/.pyenv/versions/3.11.0/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 144, in prepare_metadata_for_build_wheel
          hook = backend.prepare_metadata_for_build_wheel
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/Users/<username>/.pyenv/versions/3.11.0/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>
          main()
        File "/Users/<username>/.pyenv/versions/3.11.0/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 333, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/<username>/.pyenv/versions/3.11.0/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 148, in prepare_metadata_for_build_wheel
          whl_basename = backend.build_wheel(metadata_directory, config_settings)
          

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//keeps going - I can copy the rest if needed

Any idea, how I can properly configure the interpreter? How I can start using libraries?

Thanks

green
  • 77
  • 7
  • 1
    How are you trying to add the libraries? Using pip? – Andrew Allaire Feb 22 '23 at 19:04
  • I just clicked on "file" -> "New Projects Setup" -> "Preferences for new projects" -> "Python interpreter" -> "+" in order to add a library – green Feb 22 '23 at 20:03
  • I also tried directly using pip. Neither `pip3 install PyQt5` nor `pip install PyQt5` worked when directly typed into the terminal. I was shown the same error as above – green Feb 22 '23 at 20:29
  • Hmm ok, looks like maybe it is not a pycharm issue but maybe same as this one: https://stackoverflow.com/questions/65447314/attributeerror-module-sipbuild-api-has-no-attribute-prepare-metadata-for-bui – Andrew Allaire Feb 23 '23 at 17:48

0 Answers0