GhostCat
GhostCat

Reputation: 140407

Failed to import 'keystoneauth1' ... albeit installed?

I am using python3 via brew on MacOs.

When I do

> python3 -c "import keystoneauth1"

I get:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'keystoneauth1'

But then:

> pip3 install keystoneauth1
Requirement already satisfied: keystoneauth1 in /usr/local/lib/python3.7/site-packages (3.9.0)
Requirement already satisfied: iso8601>=0.1.11 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (0.1.12)
Requirement already satisfied: os-service-types>=1.2.0 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (1.2.0)
Requirement already satisfied: stevedore>=1.20.0 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (1.28.0)
Requirement already satisfied: pbr!=2.1.0,>=2.0.0 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (4.1.0)
Requirement already satisfied: six>=1.10.0 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (1.11.0)
Requirement already satisfied: requests>=2.14.2 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (2.19.1)
Requirement already satisfied: idna<2.8,>=2.5 in /usr/local/lib/python3.7/site-packages (from requests>=2.14.2->keystoneauth1) (2.7)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/site-packages (from requests>=2.14.2->keystoneauth1) (2018.4.16)
Requirement already satisfied: urllib3<1.24,>=1.21.1 in /usr/local/lib/python3.7/site-packages (from requests>=2.14.2->keystoneauth1) (1.23)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.7/site-packages (from requests>=2.14.2->keystoneauth1) (3.0.4)

Nothing else shows up there. When I then verify the installation, things look good:

> pip3 show keystoneauth1
Name: keystoneauth1
Version: 3.9.0
Summary: Authentication Library for OpenStack Identity
Home-page: https://docs.openstack.org/keystoneauth/latest/
Author: OpenStack
Author-email: [email protected]
License: UNKNOWN
Location: /usr/local/lib/python3.7/site-packages
Requires: stevedore, requests, pbr, os-service-types, six, iso8601
Required-by: openstacksdk, keystoneauth

But as shown, already importing that module doesn't work.

For me, the problem manifested itself after upgrading brew python to the lastest version 3.7.6.

I explicitly upgraded brew, and pip3 as well, but no luck.

And sorry for the repeated typos. The module name is really keystoneauth1.

Upvotes: 1

Views: 682

Answers (1)

GhostCat
GhostCat

Reputation: 140407

I really don't understand what exactly is going on here.

So this isn't really an answer that explains and solves the issue, but the workaround that worked for me:

  • First, I force removed python brew uninstall --ignore-dependencies python
  • Then, I only installed it again brew install python

And afterwards, my scripts (that in the end used that import) work again without any problems?!

Upvotes: 1

Related Questions