Discord Py bot not workin after nix migration


I hope you’re all doing well! I recently migrated my Discord bot project to the new Nix environment on Replit.

Whenever I try to run my bot after the migration, I encounter the following error:

ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: 'METADATA'
Consider using the --user option or check the permissions.

I’ve ensured that I’m using the --user option consistently for package installation, but this permission error keeps coming again and again.

could you send the link to the repl? Not an invite, just the URL in the address bar.
Ensure that you use poetry to install any packages and not pip. poetry is used by the Packages tool. Packages no longer need to be reinstalled in case the repl reboots.


Sorry, why can pip not be used?

1 Like

It can, but poetry is more stable. Packages it adds won’t be removed by a reboot. Also, using poetry should be compatible with the Packager.

1 Like



oh, you’re on a Blank Repl. Try after running in Shell

. <(curl https://pythonify.util.repl.co/pythonify.sh)
1 Like

After I did this when i tried to run the code with run button set to “pip install pipenv && pipenv install && python bot.py” It gave error then i changed it to “python bot.py”.
now the error which am getting is:

  python bot.py
Traceback (most recent call last):
  File "/home/runner/Rgmailnew/bot.py", line 17, in <module>
    import discord
ModuleNotFoundError: No module named 'discord'
exit status 1
 pip install -U discord.py
An error occurred during configuration: option use-feature: invalid choice: 'content-addressable-pool' (choose from '2020-resolver', 'fast-deps', 'in-tree-build')

In case you ever do need to use pip, e.g. to update/fix poetry, run this in Shell to fix that error:

sed -i /use-feature/d .config/pip/pip.conf

You could install the version you need by running in Shell:

poetry add discord.py@^1.7.3

Run it without the @^1.7.3 if you want to migrate your bot to discord.py v2


Sorry i couldnt reply due to exams, now the error which it throws is

~/Rgmailnew$ poetry add discord.py@^1.7.3
The currently activated Python version 3.9.6 is not supported by the project (3.8).
Trying to find and use a compatible version. 


  Poetry was unable to find a compatible version. If you have one, you can explicitly use it via the "env use" command.

  at /nix/store/9y2brn67pa2arhn12fsj2wng66qjg9xb-python3.9-poetry-1.1.11/lib/python3.9/site-packages/poetry/utils/env.py:768 in create_venv
       764│                     python_minor = ".".join(python_patch.split(".")[:2])
       765│                     break
       767│             if not executable:
    →  768│                 raise NoCompatiblePythonVersionFound(
       769│                     self._poetry.package.python_versions
       770│                 )
       772│         if root_venv:

Try changing the python requirement in pyproject.toml from 3.8 to 3.9.6, that seems like it’d work.

It work i could install discord.py

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

  • discord.py

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.

but still when i try to run the code it gives:

 python bot.py
Traceback (most recent call last):
  File "/home/runner/Rgmailnew/bot.py", line 17, in <module>
    import discord
ModuleNotFoundError: No module named 'discord'
exit status 1 

Try running this again:

then this one:

poetry install