Apache Airflow ImportError: cannot import name '_psutil_linux'
Asked Answered
T

2

9

I am installing apache airflow as per the installation steps provided at https://airflow.apache.org/start.html#quick-start

  1. First Step - export AIRFLOW_HOME=~/airflow (No error)

  2. Second Step - pip install apache-airflow (No error)

  3. Third Step - airflow initdb ( Error - ImportError: cannot import name '_psutil_linux')

Detailed of error is shown in below image:

enter image description here

Environment detail is as below-

  • Python Version - Python 3.6.3 :: Anaconda custom (32-bit)
  • Pip Version - 10.0.1
  • Ubuntu Version - 14.04 LTS
  • OS Type - 32 bits

How should I go on resolving it? I have already tried updating pip and installing python-dev but that does not work.

Tomsk answered 3/6, 2018 at 22:49 Comment(1)
I had same problem in Ubuntu 16.04 with other python code. It turns out the problem is python 3.7. When I ran the code with pyton 3.5 the problem solved.Ferromagnetic
A
11

I've overcome this problem through the following command:

pip install -U --ignore-installed psutil

This works if you have installed psutil by pip, otherwise, try via apt in Ubuntu:

apt-get update
apt-get --only-upgrade install python-psutil
apt-get install python-psutil
Assiniboine answered 7/1, 2020 at 7:32 Comment(1)
psutil package is not recognised by apt-getTrattoria
D
3

installing python-dev will do the job

if you are running ubuntu then sudo apt-get install python-dev

or simply running pip install -U psutil should do the job.

Dispeople answered 4/6, 2018 at 5:8 Comment(1)
installing python-dev does not help as it states that it is already the newest version. Error remains as it is even after running above commands.Tomsk

© 2022 - 2024 — McMap. All rights reserved.