Pip install fails to install PsychoPy with PyCharm

Sorry for asking silly questions. I thought changing to PsychoPy 3 would also a good point changing to PyCharm (replacing spyder). I used pip install psychopy from within PyCharm which immediately collected all necessary packages including the dependencies (great!). Almost all stuff got installed, however, not PsychoPy. Below is what I get. Any suggestions?

Installing collected packages: greenlet, gevent, msgpack, msgpack-numpy, msgpack-python, psutil, pbr, mock, numexpr, tables, pyzmq, decorator, tqdm, proglog, imageio, imageio-ffmpeg, moviepy, opencv-python, python-gitlab, smmap2, gitdb2, gitpython, wheel, astunparse, esprima, freetype-py, wxPython, pyobjc-core, pyobjc-framework-Cocoa, pyobjc-framework-Quartz, PyQt5-sip, pyqt5, psychopy
Running setup.py install for greenlet … error
Complete output from command /Users/ghorstmann/PycharmProjects/untitled/venv/bin/python -u -c “import setuptools, tokenize;file=’/private/var/folders/n2/4dg_yrwn3qj2065mlglb9v4w0000gn/T/pip-install-moivn4_a/greenlet/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /private/var/folders/n2/4dg_yrwn3qj2065mlglb9v4w0000gn/T/pip-record-cchciacw/install-record.txt --single-version-externally-managed --compile --install-headers /Users/ghorstmann/PycharmProjects/untitled/venv/include/site/python3.6/greenlet:
running install
running build
running build_ext
building ‘greenlet’ extension
creating build
creating build/temp.macosx-10.12-x86_64-3.6
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/Users/ghorstmann/PycharmProjects/untitled/venv/include -I/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c greenlet.c -o build/temp.macosx-10.12-x86_64-3.6/greenlet.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command ‘clang’ failed with exit status 1
----------------------------------------
Command “/Users/ghorstmann/PycharmProjects/untitled/venv/bin/python -u -c “import setuptools, tokenize;file=’/private/var/folders/n2/4dg_yrwn3qj2065mlglb9v4w0000gn/T/pip-install-moivn4_a/greenlet/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /private/var/folders/n2/4dg_yrwn3qj2065mlglb9v4w0000gn/T/pip-record-cchciacw/install-record.txt --single-version-externally-managed --compile --install-headers /Users/ghorstmann/PycharmProjects/untitled/venv/include/site/python3.6/greenlet” failed with error code 1 in /private/var/folders/n2/4dg_yrwn3qj2065mlglb9v4w0000gn/T/pip-install-moivn4_a/greenlet/

I did a google search for this error and found this suggested fix.

Please let us know if usating xcode fixes the issue for you as well.

Made it work. Many thanks, Sol!

The system cannot execute the specified program.