I'm working on a discord bot using the discord
.
The bot works using the command python3.5 bot.py
.
I'm unable to find out why discord
isn't recognized by 3.10.4
. I'd really like this to work on at least Python 3.6
as I'm attempting to import some other modules that use f strings.
I'm specifically having issues with the first line of the code:
import discord
For context, here's what returns running my python versions:
$ python -V
bash: python: command not found
$ python3 -V
Python 3.10.4
$ python3.5 -V
Python 3.5.3
$ python3.10 -V
Python 3.10.4
As mentioned previously the bot works using the command python3.5 bot.py
but here are all the other errors:
$ python bot.py
bash: python: command not found
$ python3 bot.py
Traceback (most recent call last):
File "/home/pi/Desktop/Bot/bot.py", line 1, in <module>
import discord
ModuleNotFoundError: No module named 'discord'
$ python3.10 bot.py
Traceback (most recent call last):
File "/home/pi/Desktop/Bot/bot.py", line 1, in <module>
import discord
ModuleNotFoundError: No module named 'discord'
I am also working on a Raspberry Pi 3 B+.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 9.13 (stretch)
Release: 9.13
Codename: stretch
UPDATE: Random Davis Has helped in identifying that both my pip
and pip3
were out of date (pip 20.3.4 python 3.5). Davis offered a link that allowed you to run pip with a specific version using python3 -m pip
revealing great results of (pip 22.0.4 python 3.10).
However there exists some issues installing discord.py
using python3 -m pip install discord.py
. Seems to be some SSL Error. The full error is listed below:
Defaulting to user installation because normal site-packages is not writeable
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/discord-py/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/discord-py/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/discord-py/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/discord-py/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/discord-py/
Could not fetch URL https://pypi.org/simple/discord-py/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/discord-py/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/discord-py/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/discord-py/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/discord-py/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/discord-py/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/discord-py/
Could not fetch URL https://www.piwheels.org/simple/discord-py/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='www.piwheels.org', port=443): Max retries exceeded with url: /simple/discord-py/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
ERROR: Could not find a version that satisfies the requirement discord.py (from versions: none)
ERROR: No matching distribution found for discord.py
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
Could not fetch URL https://www.piwheels.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='www.piwheels.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
I tried searching for some things and tried python3 -m pip install --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org --trusted-host=piwheels.org discord
producing similar results.