cannot import name '_psutil_linux'

See original GitHub issue

The output of thefuck --version (something like The Fuck 3.1 using Python 3.5.0):

thefuck --version

Traceback (most recent call last): File “/usr/local/bin/thefuck”, line 7, in <module> from thefuck.entrypoints.main import main File “/usr/local/lib/python3.5/dist-packages/thefuck/entrypoints/main.py”, line 11, in <module> from .alias import print_alias # noqa: E402 File “/usr/local/lib/python3.5/dist-packages/thefuck/entrypoints/alias.py”, line 3, in <module> from …shells import shell File “/usr/local/lib/python3.5/dist-packages/thefuck/shells/init.py”, line 6, in <module> from psutil import Process File “/usr/lib/python2.7/dist-packages/psutil/init.py”, line 68, in <module> from . import _pslinux as _psplatform File “/usr/lib/python2.7/dist-packages/psutil/_pslinux.py”, line 24, in <module> from . import _psutil_linux as cext ImportError: cannot import name ‘_psutil_linux’

Your shell and its version (bash, zsh, Windows PowerShell, etc.):

bash --version GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu) Copyright © 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html

This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

Your system (Debian 7, ArchLinux, Windows, etc.):

Ubuntu 16.04 LTS

How to reproduce the bug:

typing 'fuck' or 'thefuck --version'. In short, it always gives me the same traceback of the name  import error 

The output of The Fuck with THEFUCK_DEBUG=true exported (typically execute export THEFUCK_DEBUG=true in your shell before The Fuck):

IDK, whatever command I use with "thefuck" included, same beforementioned issue 

If the bug only appears with a specific application, the output of that application and its version:

N/A

Anything else you think is relevant:

which -a python /home/antoniodn/anaconda2/bin/python /home/antoniodn/anaconda2/bin/python /usr/bin/python

which -a python3 /usr/bin/python3

which -a pip /home/antoniodn/anaconda2/bin/pip /home/antoniodn/anaconda2/bin/pip /usr/local/bin/pip /usr/bin/pip

which -a pip3 /usr/local/bin/pip3 /usr/bin/pip3

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
golddragon007commented, Feb 2, 2021

I had now the same issue, I needed to reinstall the psutil and decorator packages…

sudo pip uninstall psutil
sudo pip install -U psutil
sudo pip uninstall decorator
sudo pip install -U decorator

And now it seems it works…

2reactions
liuzongqingcommented, Dec 29, 2021

Just pip install psutil==5.7.0 works for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to resolve ImportError: cannot import name '_psutil_linux'
I am installing apache airflow as per the installation steps provided at https://airflow.apache.org/start.html#quick-start First Step ...
Read more >
Apache Airflow ImportError: cannot import name '_psutil_linux'
I've overcome this problem through the following command: pip install -U --ignore-installed psutil. This works if you have installed psutil ...
Read more >
Why am I receiving the error message "cannot import name ...
Unexpected Exception, this is probably a bug: cannot import name '_psutil_linux' from partially initialized module 'psutil' (most likely due ...
Read more >
mach install fails with: cannot import name _psutil_linux
mach install fails on my machine: $ ./mach install Error running mach: ['install'] The error occurred in code that was called by the...
Read more >
from psutil import _common ImportError: cannot imp... - 121001
from psutil import _common ImportError: cannot import name _common issue ... -o build/temp.linux-x86_64-2.7/psutil/_psutil_linux.o In file included from ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found