Not able to import discord.py

How do i reimport discord.py?

i dont think it has anything to do with the code but something with the system.

**


i tried installing the import discord.py but it doesnt want to import. The error message i get is
(New users can only embed 1 link lmao)

ξΊ§ python3 main.py
Traceback (most recent call last):
  File "/home/runner/coc/main.py", line 4, in <module>
    import discord
ModuleNotFoundError: No module named 'discord'
exit status 1

btw. i had discord.py imported before and the code worked before too**
first 4 lines of main.py:

# imports

import os
import discord

(the name is in short for sth else)

To import the discord module, type this command into the shell:

pip install discord

If you have discord.py file in your project you can import it into another Python file using this line of code:

import discord

Still, does not work. :confused:

Try this command:

poetry add discord

That’s should also fail, since poetry relies on pip. I’ll find my fix for this.

Since this is a pip configuration error, try:

Then run the pip install again.

1 Like

Not working either, but maybe more info for debugging:

~/coc$ poetry add discord
The following packages are already present in the pyproject.toml and will be skipped:

  β€’ discord

If you want to update it to the latest compatible version, you can use `poetry update package`.
If you prefer to upgrade it to the latest available version, you can use `poetry add package@latest`.

Nothing to add.
~/coc$ poetry update package
Updating dependencies
Resolving dependencies... (0.2s)

Package operations: 16 installs, 0 updates, 0 removals

  β€’ Installing frozenlist (1.4.0): Failed

  CalledProcessError

  Command '['pip', 'install', '--no-deps', 'https://files.pythonhosted.org/packages/1e/28/74b8b6451c89c070d34e753d8b65a1e4ce508a6808b18529f36e8c0e2184/frozenlist-1.4.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=6918d49b1f90821e93069682c06ffde41829c346c66b721e65a5c62b4bab0300']' returned non-zero exit status 3.

  at /nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/lib/python3.10/subprocess.py:526 in run
       522β”‚             # We don't call process.wait() as .__exit__ does that for us.
       523β”‚             raise
       524β”‚         retcode = process.poll()
       525β”‚         if check and retcode:
    β†’  526β”‚             raise CalledProcessError(retcode, process.args,
       527β”‚                                      output=stdout, stderr=stderr)
       528β”‚     return CompletedProcess(process.args, retcode, stdout, stderr)
       529β”‚ 
       530β”‚ 

The following error occurred when trying to handle this error:


  EnvCommandError

  Command ['pip', 'install', '--no-deps', 'https://files.pythonhosted.org/packages/1e/28/74b8b6451c89c070d34e753d8b65a1e4ce508a6808b18529f36e8c0e2184/frozenlist-1.4.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=6918d49b1f90821e93069682c06ffde41829c346c66b721e65a5c62b4bab0300'] errored with the following return code 3
  
  Output:
  An error occurred during configuration: option use-feature: invalid choice: 'content-addressable-pool' (choose from 'fast-deps', 'truststore', 'no-binary-enable-wheel-cache')
  

  at /nix/store/6lfk2kyiijr9854nvfmxc28jz49vacrs-poetry-in-venv/env/lib/python3.10/site-packages/poetry/utils/env.py:1523 in _run
      1519β”‚                 output = ""
      1520β”‚             else:
      1521β”‚                 output = subprocess.check_output(cmd, stderr=stderr, env=env, **kwargs)
      1522β”‚         except CalledProcessError as e:
    β†’ 1523β”‚             raise EnvCommandError(e, input=input_)
      1524β”‚ 
      1525β”‚         return decode(output)
      1526β”‚ 
      1527β”‚     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

The following error occurred when trying to handle this error:


  PoetryException

  Failed to install https://files.pythonhosted.org/packages/1e/28/74b8b6451c89c070d34e753d8b65a1e4ce508a6808b18529f36e8c0e2184/frozenlist-1.4.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=6918d49b1f90821e93069682c06ffde41829c346c66b721e65a5c62b4bab0300

  at /nix/store/6lfk2kyiijr9854nvfmxc28jz49vacrs-poetry-in-venv/env/lib/python3.10/site-packages/poetry/utils/pip.py:27 in pip_install_from_url
       23β”‚     
       24β”‚     try:
       25β”‚         return environment.run_pip(*args)
       26β”‚     except EnvCommandError as e:
    β†’  27β”‚         raise PoetryException(f"Failed to install {url}") from e
       28β”‚ 
       29β”‚ def pip_install(
       30β”‚     path: Path,
       31β”‚     environment: Env,

  β€’ Installing idna (3.4): Failed

  CalledProcessError

  Command '['pip', 'install', '--no-deps', 'https://files.pythonhosted.org/packages/fc/34/3030de6f1370931b9dbb4dad48f6ab1015ab1d32447850b9fc94e60097be/idna-3.4-py3-none-any.whl#sha256=90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2']' returned non-zero exit status 3.

  at /nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/lib/python3.10/subprocess.py:526 in run
       522β”‚             # We don't call process.wait() as .__exit__ does that for us.
       523β”‚             raise
       524β”‚         retcode = process.poll()
       525β”‚         if check and retcode:
    β†’  526β”‚             raise CalledProcessError(retcode, process.args,
       527β”‚                                      output=stdout, stderr=stderr)
       528β”‚     return CompletedProcess(process.args, retcode, stdout, stderr)
       529β”‚ 
       530β”‚ 

The following error occurred when trying to handle this error:


  EnvCommandError

  Command ['pip', 'install', '--no-deps', 'https://files.pythonhosted.org/packages/fc/34/3030de6f1370931b9dbb4dad48f6ab1015ab1d32447850b9fc94e60097be/idna-3.4-py3-none-any.whl#sha256=90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2'] errored with the following return code 3
  
  Output:
  An error occurred during configuration: option use-feature: invalid choice: 'content-addressable-pool' (choose from 'fast-deps', 'truststore', 'no-binary-enable-wheel-cache')
  

  at /nix/store/6lfk2kyiijr9854nvfmxc28jz49vacrs-poetry-in-venv/env/lib/python3.10/site-packages/poetry/utils/env.py:1523 in _run
      1519β”‚                 output = ""
      1520β”‚             else:
      1521β”‚                 output = subprocess.check_output(cmd, stderr=stderr, env=env, **kwargs)
      1522β”‚         except CalledProcessError as e:
    β†’ 1523β”‚             raise EnvCommandError(e, input=input_)
      1524β”‚ 
      1525β”‚         return decode(output)
      1526β”‚ 
      1527β”‚     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

The following error occurred when trying to handle this error:


  PoetryException

  Failed to install https://files.pythonhosted.org/packages/fc/34/3030de6f1370931b9dbb4dad48f6ab1015ab1d32447850b9fc94e60097be/idna-3.4-py3-none-any.whl#sha256=90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2

  at /nix/store/6lfk2kyiijr9854nvfmxc28jz49vacrs-poetry-in-venv/env/lib/python3.10/site-packages/poetry/utils/pip.py:27 in pip_install_from_url
       23β”‚     
       24β”‚     try:
       25β”‚         return environment.run_pip(*args)
       26β”‚     except EnvCommandError as e:
    β†’  27β”‚         raise PoetryException(f"Failed to install {url}") from e
       28β”‚ 
       29β”‚ def pip_install(
       30β”‚     path: Path,
       31β”‚     environment: Env,

  β€’ Installing multidict (6.0.4): Failed

  CalledProcessError

  Command '['pip', 'install', '--no-deps', 'https://files.pythonhosted.org/packages/56/b5/ac112889bfc68e6cf4eda1e4325789b166c51c6cd29d5633e28fb2c2f966/multidict-6.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=36c63aaa167f6c6b04ef2c85704e93af16c11d20de1d133e39de6a0e84582a93']' returned non-zero exit status 3.

  at /nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/lib/python3.10/subprocess.py:526 in run
       522β”‚             # We don't call process.wait() as .__exit__ does that for us.
       523β”‚             raise
       524β”‚         retcode = process.poll()
       525β”‚         if check and retcode:
    β†’  526β”‚             raise CalledProcessError(retcode, process.args,
       527β”‚                                      output=stdout, stderr=stderr)
       528β”‚     return CompletedProcess(process.args, retcode, stdout, stderr)
       529β”‚ 
       530β”‚ 

The following error occurred when trying to handle this error:


  EnvCommandError

  Command ['pip', 'install', '--no-deps', 'https://files.pythonhosted.org/packages/56/b5/ac112889bfc68e6cf4eda1e4325789b166c51c6cd29d5633e28fb2c2f966/multidict-6.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=36c63aaa167f6c6b04ef2c85704e93af16c11d20de1d133e39de6a0e84582a93'] errored with the following return code 3
  
  Output:
  An error occurred during configuration: option use-feature: invalid choice: 'content-addressable-pool' (choose from 'fast-deps', 'truststore', 'no-binary-enable-wheel-cache')
  

  at /nix/store/6lfk2kyiijr9854nvfmxc28jz49vacrs-poetry-in-venv/env/lib/python3.10/site-packages/poetry/utils/env.py:1523 in _run
      1519β”‚                 output = ""
      1520β”‚             else:
      1521β”‚                 output = subprocess.check_output(cmd, stderr=stderr, env=env, **kwargs)
      1522β”‚         except CalledProcessError as e:
    β†’ 1523β”‚             raise EnvCommandError(e, input=input_)
      1524β”‚ 
      1525β”‚         return decode(output)
      1526β”‚ 
      1527β”‚     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

The following error occurred when trying to handle this error:


  PoetryException

  Failed to install https://files.pythonhosted.org/packages/56/b5/ac112889bfc68e6cf4eda1e4325789b166c51c6cd29d5633e28fb2c2f966/multidict-6.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=36c63aaa167f6c6b04ef2c85704e93af16c11d20de1d133e39de6a0e84582a93

  at /nix/store/6lfk2kyiijr9854nvfmxc28jz49vacrs-poetry-in-venv/env/lib/python3.10/site-packages/poetry/utils/pip.py:27 in pip_install_from_url
       23β”‚     
       24β”‚     try:
       25β”‚         return environment.run_pip(*args)
       26β”‚     except EnvCommandError as e:
    β†’  27β”‚         raise PoetryException(f"Failed to install {url}") from e
       28β”‚ 
       29β”‚ def pip_install(
       30β”‚     path: Path,
       31β”‚     environment: Env,

Still the same error and it doesn’t know what sed is. :confused:

Try running these commands:

Still does not work. I don’t think that is good haha:

first part:

~/coc$ rm .pythonlibs -r
rm: cannot remove '.pythonlibs': No such file or directory
~/coc$ poetry remove poetry

The following packages were not found: poetry
~/coc$ poetry add mpmath

third command output too long for shell, 2nd time running it:

~/coc$ poetry add mpmath
Using version ^1.3.0 for mpmath

Updating dependencies
Resolving dependencies... (0.4s)

Package operations: 17 installs, 0 updates, 0 removals

  β€’ Installing frozenlist (1.4.0): Failed

  CalledProcessError

  Command '['pip', 'install', '--no-deps', 'https://files.pythonhosted.org/packages/1e/28/74b8b6451c89c070d34e753d8b65a1e4ce508a6808b18529f36e8c0e2184/frozenlist-1.4.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=6918d49b1f90821e93069682c06ffde41829c346c66b721e65a5c62b4bab0300']' returned non-zero exit status 3.

  at /nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/lib/python3.10/subprocess.py:526 in run
       522β”‚             # We don't call process.wait() as .__exit__ does that for us.
       523β”‚             raise
       524β”‚         retcode = process.poll()
       525β”‚         if check and retcode:
    β†’  526β”‚             raise CalledProcessError(retcode, process.args,
       527β”‚                                      output=stdout, stderr=stderr)
       528β”‚     return CompletedProcess(process.args, retcode, stdout, stderr)
       529β”‚ 
       530β”‚ 

The following error occurred when trying to handle this error:


  EnvCommandError

  Command ['pip', 'install', '--no-deps', 'https://files.pythonhosted.org/packages/1e/28/74b8b6451c89c070d34e753d8b65a1e4ce508a6808b18529f36e8c0e2184/frozenlist-1.4.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=6918d49b1f90821e93069682c06ffde41829c346c66b721e65a5c62b4bab0300'] errored with the following return code 3
  
  Output:
  An error occurred during configuration: option use-feature: invalid choice: 'content-addressable-pool' (choose from 'fast-deps', 'truststore', 'no-binary-enable-wheel-cache')
  

  at /nix/store/6lfk2kyiijr9854nvfmxc28jz49vacrs-poetry-in-venv/env/lib/python3.10/site-packages/poetry/utils/env.py:1523 in _run
      1519β”‚                 output = ""
      1520β”‚             else:
      1521β”‚                 output = subprocess.check_output(cmd, stderr=stderr, env=env, **kwargs)
      1522β”‚         except CalledProcessError as e:
    β†’ 1523β”‚             raise EnvCommandError(e, input=input_)
      1524β”‚ 
      1525β”‚         return decode(output)
      1526β”‚ 
      1527β”‚     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

The following error occurred when trying to handle this error:


  PoetryException

  Failed to install https://files.pythonhosted.org/packages/1e/28/74b8b6451c89c070d34e753d8b65a1e4ce508a6808b18529f36e8c0e2184/frozenlist-1.4.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=6918d49b1f90821e93069682c06ffde41829c346c66b721e65a5c62b4bab0300

  at /nix/store/6lfk2kyiijr9854nvfmxc28jz49vacrs-poetry-in-venv/env/lib/python3.10/site-packages/poetry/utils/pip.py:27 in pip_install_from_url
       23β”‚     
       24β”‚     try:
       25β”‚         return environment.run_pip(*args)
       26β”‚     except EnvCommandError as e:
    β†’  27β”‚         raise PoetryException(f"Failed to install {url}") from e
       28β”‚ 
       29β”‚ def pip_install(
       30β”‚     path: Path,
       31β”‚     environment: Env,

  β€’ Installing idna (3.4): Failed

  CalledProcessError

  Command '['pip', 'install', '--no-deps', 'https://files.pythonhosted.org/packages/fc/34/3030de6f1370931b9dbb4dad48f6ab1015ab1d32447850b9fc94e60097be/idna-3.4-py3-none-any.whl#sha256=90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2']' returned non-zero exit status 3.

  at /nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/lib/python3.10/subprocess.py:526 in run
       522β”‚             # We don't call process.wait() as .__exit__ does that for us.
       523β”‚             raise
       524β”‚         retcode = process.poll()
       525β”‚         if check and retcode:
    β†’  526β”‚             raise CalledProcessError(retcode, process.args,
       527β”‚                                      output=stdout, stderr=stderr)
       528β”‚     return CompletedProcess(process.args, retcode, stdout, stderr)
       529β”‚ 
       530β”‚ 

The following error occurred when trying to handle this error:


  EnvCommandError

  Command ['pip', 'install', '--no-deps', 'https://files.pythonhosted.org/packages/fc/34/3030de6f1370931b9dbb4dad48f6ab1015ab1d32447850b9fc94e60097be/idna-3.4-py3-none-any.whl#sha256=90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2'] errored with the following return code 3
  
  Output:
  An error occurred during configuration: option use-feature: invalid choice: 'content-addressable-pool' (choose from 'fast-deps', 'truststore', 'no-binary-enable-wheel-cache')
  

  at /nix/store/6lfk2kyiijr9854nvfmxc28jz49vacrs-poetry-in-venv/env/lib/python3.10/site-packages/poetry/utils/env.py:1523 in _run
      1519β”‚                 output = ""
      1520β”‚             else:
      1521β”‚                 output = subprocess.check_output(cmd, stderr=stderr, env=env, **kwargs)
      1522β”‚         except CalledProcessError as e:
    β†’ 1523β”‚             raise EnvCommandError(e, input=input_)
      1524β”‚ 
      1525β”‚         return decode(output)
      1526β”‚ 
      1527β”‚     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

The following error occurred when trying to handle this error:


  PoetryException

  Failed to install https://files.pythonhosted.org/packages/fc/34/3030de6f1370931b9dbb4dad48f6ab1015ab1d32447850b9fc94e60097be/idna-3.4-py3-none-any.whl#sha256=90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2

  at /nix/store/6lfk2kyiijr9854nvfmxc28jz49vacrs-poetry-in-venv/env/lib/python3.10/site-packages/poetry/utils/pip.py:27 in pip_install_from_url
       23β”‚     
       24β”‚     try:
       25β”‚         return environment.run_pip(*args)
       26β”‚     except EnvCommandError as e:
    β†’  27β”‚         raise PoetryException(f"Failed to install {url}") from e
       28β”‚ 
       29β”‚ def pip_install(
       30β”‚     path: Path,
       31β”‚     environment: Env,

  β€’ Installing multidict (6.0.4): Failed

  CalledProcessError

  Command '['pip', 'install', '--no-deps', 'https://files.pythonhosted.org/packages/56/b5/ac112889bfc68e6cf4eda1e4325789b166c51c6cd29d5633e28fb2c2f966/multidict-6.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=36c63aaa167f6c6b04ef2c85704e93af16c11d20de1d133e39de6a0e84582a93']' returned non-zero exit status 3.

  at /nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/lib/python3.10/subprocess.py:526 in run
       522β”‚             # We don't call process.wait() as .__exit__ does that for us.
       523β”‚             raise
       524β”‚         retcode = process.poll()
       525β”‚         if check and retcode:
    β†’  526β”‚             raise CalledProcessError(retcode, process.args,
       527β”‚                                      output=stdout, stderr=stderr)
       528β”‚     return CompletedProcess(process.args, retcode, stdout, stderr)
       529β”‚ 
       530β”‚ 

The following error occurred when trying to handle this error:


  EnvCommandError

  Command ['pip', 'install', '--no-deps', 'https://files.pythonhosted.org/packages/56/b5/ac112889bfc68e6cf4eda1e4325789b166c51c6cd29d5633e28fb2c2f966/multidict-6.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=36c63aaa167f6c6b04ef2c85704e93af16c11d20de1d133e39de6a0e84582a93'] errored with the following return code 3
  
  Output:
  An error occurred during configuration: option use-feature: invalid choice: 'content-addressable-pool' (choose from 'fast-deps', 'truststore', 'no-binary-enable-wheel-cache')
  

  at /nix/store/6lfk2kyiijr9854nvfmxc28jz49vacrs-poetry-in-venv/env/lib/python3.10/site-packages/poetry/utils/env.py:1523 in _run
      1519β”‚                 output = ""
      1520β”‚             else:
      1521β”‚                 output = subprocess.check_output(cmd, stderr=stderr, env=env, **kwargs)
      1522β”‚         except CalledProcessError as e:
    β†’ 1523β”‚             raise EnvCommandError(e, input=input_)
      1524β”‚ 
      1525β”‚         return decode(output)
      1526β”‚ 
      1527β”‚     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

The following error occurred when trying to handle this error:


  PoetryException

  Failed to install https://files.pythonhosted.org/packages/56/b5/ac112889bfc68e6cf4eda1e4325789b166c51c6cd29d5633e28fb2c2f966/multidict-6.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=36c63aaa167f6c6b04ef2c85704e93af16c11d20de1d133e39de6a0e84582a93

  at /nix/store/6lfk2kyiijr9854nvfmxc28jz49vacrs-poetry-in-venv/env/lib/python3.10/site-packages/poetry/utils/pip.py:27 in pip_install_from_url
       23β”‚     
       24β”‚     try:
       25β”‚         return environment.run_pip(*args)
       26β”‚     except EnvCommandError as e:
    β†’  27β”‚         raise PoetryException(f"Failed to install {url}") from e
       28β”‚ 
       29β”‚ def pip_install(
       30β”‚     path: Path,
       31β”‚     environment: Env,

the error means that there’s no file with path .config/pip/pip.conf (relative to the working directory, which here is the IDE’s Files) as specified in the command