issues installing psutil with pip in virtual environment

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

issues installing psutil with pip in virtual environment

Anil F Duggirala
hello,
I am running into an issue installing psutil: pip3 install psutil, in a
virtual environment. I have upgraded my pip and setuptools with no
avail. I am getting this error: https://pastebin.com/2Xb7UN9g
Some have suggested installing the python3-dev package. Saying that I
require "header" files (don't know what those are). So this means
installing that package and creating a new venv, where those files are
available. Is there a way to make this install work without installing
that package? Is that package really necessary? Does this mean my
virtual environments are somehow subject to what libraries are
available in my system python installation? Is there some pip
installabel package that provides these files?
thank you,

Reply | Threaded
Open this post in threaded view
|

Re: issues installing psutil with pip in virtual environment

Sandro Tosi-6
> I am running into an issue installing psutil: pip3 install psutil, in a
> virtual environment. I have upgraded my pip and setuptools with no
> avail. I am getting this error: https://pastebin.com/2Xb7UN9g

psutil is not pure python, and contains some extensions that need to
be compiled, so your system needs to have a compiler, gcc, installed;
since it's not you get "unable to execute 'x86_64-linux-gnu-gcc': No
such file or directory"

> Some have suggested installing the python3-dev package. Saying that I
> require "header" files (don't know what those are). So this means
> installing that package and creating a new venv, where those files are
> available. Is there a way to make this install work without installing
> that package? Is that package really necessary? Does this mean my

you will necessarily need to install python3-dev

> virtual environments are somehow subject to what libraries are
> available in my system python installation?

yes, in a similar way as they are dependent on the system interpreter
to create and run the venv

> Is there some pip
> installabel package that provides these files?

some packages on PyPI provide binary releases, but psutil looks like
it doesnt for linux, so you need to compile it.

alternatively you can install python3-psutil on your host and then
"virtualenv --system-site-packages" to use the system-available
modules.

Regards,
--
Sandro "morph" Tosi
My website: http://sandrotosi.me/
Me at Debian: http://wiki.debian.org/SandroTosi
Twitter: https://twitter.com/sandrotosi

Reply | Threaded
Open this post in threaded view
|

Re: issues installing psutil with pip in virtual environment

Scott Kitterman-5
In reply to this post by Anil F Duggirala


On April 26, 2020 4:06:00 PM UTC, Anil F Duggirala <[hidden email]> wrote:

>hello,
>I am running into an issue installing psutil: pip3 install psutil, in a
>virtual environment. I have upgraded my pip and setuptools with no
>avail. I am getting this error: https://pastebin.com/2Xb7UN9g
>Some have suggested installing the python3-dev package. Saying that I
>require "header" files (don't know what those are). So this means
>installing that package and creating a new venv, where those files are
>available. Is there a way to make this install work without installing
>that package? Is that package really necessary? Does this mean my
>virtual environments are somehow subject to what libraries are
>available in my system python installation? Is there some pip
>installabel package that provides these files?
>thank you,

No.  No.  Yes.  Yes.  No.

Pip doesn't provide the python interpreter.  The solution is in the traceback you posted:

("sudo apt-get install gcc python%s-dev" % py3)
      File "/tmp/pip-install-b88905i2/psutil/setup.py", line 116, in missdeps
        s = hilite("C compiler or Python headers are not installed ", ok=False)

So install gcc and python3-dev and try again.

Scott K