pythonpython-3.xpycharmvirtualenv

ModuleNotFoundError when using venv


I have just installed Python 3.8 on a Mac Catalina machine.
I have created a new virtual env using PyCharm and installed the slackclient package using PyCharm's preferences.
However, whichever way I try to run the app, I get the ModuleNotFoundError: No module named 'slackclient' error. I have verified that it is installed in the OS terminal (zsh):

(venv) *** pip list            
Package       Version
------------- -------
aiohttp       3.6.2  
async-timeout 3.0.1  
attrs         19.3.0 
chardet       3.0.4  
idna          2.9    
multidict     4.7.5  
pip           20.0.2 
setuptools    46.1.3 
slackclient   2.5.0  
yarl          1.4.2  
(venv) *** python studiobot.py 
Traceback (most recent call last):
  File "studiobot.py", line 4, in <module>
    from slackclient import SlackClient
ModuleNotFoundError: No module named 'slackclient'

What am I doing wrong?


Solution

  • You should be using something like

    from slack import WebClient
    

    https://github.com/slackapi/python-slackclient#sending-a-message-to-slack