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
- click on "add interpreter"
- select "Existing" next to environment
- 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:
- installed pyenv using homebrew
- downloaded python 3.11.0 using pyenv
Then I went back to PyCharm and created another interpreter. I did the following:
- clicked on "add interpreter"
- selected "Existing" next to environment
- 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