2

Problem

I am trying to install psutil using pip so I ran pip install psutil but I receive the following error message:

Failed building wheel for psutil
Running setup.py clean for psutil


What I have tried

It seems like the problem is occurring during setup.py: Building wheel for psutil (setup.py) ... error.

I have tried running :

xcode-select --install

but I get the following error message:

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

I have also tried:

sudo xcode-select --switch /Library/Developer/CommandLineTools

and

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

Both work fine but even after restarting the terminal, I see no change.


And finally, I have tried running:

sudo xcode-select --reset

Which also makes no difference.

  • 1
    Please post the complete log of the `pip install psutil` command. – hoefling Jun 16 '20 at 21:50
  • The error was very long so I attached it using google drive. –  Jun 16 '20 at 22:20
  • 3
    The log is still stripped, but I suppose this is the same issue as [#1632](https://github.com/giampaolo/psutil/issues/1632). Try downloading an older SDK (e.g. 10.9 from [here](https://github.com/phracker/MacOSX-SDKs/releases)), unpack and install via `CFLAGS="-isysroot /path/to/MacOSX10.9.sdk" pip install psutil`. If you don't succeed, I can upload the wheels built on my machine. – hoefling Jun 16 '20 at 22:41
  • Thanks, for directing me to that site. It actually turned out that I had 2 versions of the sdk installed so all I had to do was delete the older one and that got it to work. –  Jun 16 '20 at 22:48

1 Answers1

4

I just typed:

sudo open /Library/Developer/CommandLineTools/SDKs

into my terminal and it turns out that I have 2 versions of the Command Line SDK installed so it looked like this:

MacOSX.sdk -> MacOSX10.15.sdk
MacOSX10.15.sdk
MacOSX10.14.sdk

I then just deleted the older MacOSX10.14.sdk and everything starting working correctly.

Solution found here: https://github.com/giampaolo/psutil/issues/1632#issuecomment-564800186