Étienne
Étienne

Reputation: 4994

Python package not found even though the package is there

I downloaded the python package "swagger-client" in order to interface with a website's API (swagger is a framework to automate API creation for client/server communication). Then, I installed the swagger-client package using:

./venv/bin/python python-client/setup.py install

I can see that the package is deployed in

venv/lib/python3.7/site-packages/swagger_client-1.0.0-py3.7.egg

Also, my IDE PyCharm shows that the swagger-client package is "found": enter image description here enter image description here

However, when I try to import the package using "import swagger_client", I get an error <class 'tuple'>: (<class 'ModuleNotFoundError'>, ModuleNotFoundError("No module named 'swagger_client'"), <traceback object at 0x7fd74cac4948>)

What am I doing wrong?

Upvotes: 1

Views: 1820

Answers (1)

&#201;tienne
&#201;tienne

Reputation: 4994

It appears that the method I used to install the swagger_client module was wrong.

I used:

./venv/bin/python3.7 python-client/setup.py install

which produced this warning:

warning: install_lib: 'build/lib' does not exist -- no Python modules to install

but this is the correct way to do it:

cd python-client
../venv/bin/python3.7 setup.py install

Upvotes: 1

Related Questions