ilhaam Shaikh
ilhaam Shaikh

Reputation: 93

ImportError: cannot import name 'WebClient'

I can't do

from slack import WebClient

I get this error:

ImportError: cannot import name 'WebClient'

Have installed slack module

pip install slack

Error:

Traceback (most recent call last): File "E:\Downloads\slack-automation-master\channel_messages.py", line 3, in from slack import WebClient ImportError: cannot import name 'WebClient'

Upvotes: 9

Views: 17302

Answers (5)

alarrain
alarrain

Reputation: 49

uninstall slack and slackclient first: pip uninstall slack pip uninstall slackclient

then re-install, slack first

pip install slack pip install slacklient

works for versions 0.0.2 and 2.9.3 respectively

Upvotes: 1

Arcones
Arcones

Reputation: 4632

I got this error too after an upgrade of my dependencies where I was already having slack (0.0.2) and slackclient (2.9.3)

As I was in python 3.6, I upgraded to 3.8 just to check if then it works, and BINGO, it started to work (scumbag python)

Upvotes: 0

Pradeep Panga
Pradeep Panga

Reputation: 1

Move to pipenv.

pip install pipenv
pipenv install -r requirements.txt
pipenv run python my_program.py

Upvotes: 0

Nitish Pandey
Nitish Pandey

Reputation: 1

THere is no one solution. This is because Python version control and package dependency paths are a nightmare. What solved for me was to Sudo -H pip uninstall slack Sudo -H pip install slack

In fact the install failed because it said that the dependency was already available. Meaming, that earlier 2 versions of slack were installed. One in /usr/local/lib... folder and the other in /home/nitish/lib/...folder

What a spaghetti python is. Living up to it's name.

Upvotes: -2

TOM
TOM

Reputation: 312

pip install slack

pip install slackclient

Should do

Upvotes: 17

Related Questions