Discord.py: [WinError 193] %1 is not a valid Win32 application when installing discord.py[voice]

Created on 22 Jul 2018  路  7Comments  路  Source: Rapptz/discord.py

Below is the code I get when I try to run the python3 -m pip install -U discord.py[voice] voice command :/ . I am running this on windows 10, with python 3.7.

Running setup.py install for PyNaCl ... error
    Complete output from command c:\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Taylor\\AppData\\Local\\Temp\\pip-install-2r6c13hz\\PyNaCl\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Taylor\AppData\Local\Temp\pip-record-vukv8v29\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    creating build\lib.win-amd64-3.7\nacl
    copying src\nacl\encoding.py -> build\lib.win-amd64-3.7\nacl
    copying src\nacl\exceptions.py -> build\lib.win-amd64-3.7\nacl
    copying src\nacl\hash.py -> build\lib.win-amd64-3.7\nacl
    copying src\nacl\public.py -> build\lib.win-amd64-3.7\nacl
    copying src\nacl\secret.py -> build\lib.win-amd64-3.7\nacl
    copying src\nacl\signing.py -> build\lib.win-amd64-3.7\nacl
    copying src\nacl\utils.py -> build\lib.win-amd64-3.7\nacl
    copying src\nacl\__init__.py -> build\lib.win-amd64-3.7\nacl
    creating build\lib.win-amd64-3.7\nacl\bindings
    copying src\nacl\bindings\crypto_box.py -> build\lib.win-amd64-3.7\nacl\bindings
    copying src\nacl\bindings\crypto_hash.py -> build\lib.win-amd64-3.7\nacl\bindings
    copying src\nacl\bindings\crypto_scalarmult.py -> build\lib.win-amd64-3.7\nacl\bindings
    copying src\nacl\bindings\crypto_secretbox.py -> build\lib.win-amd64-3.7\nacl\bindings
    copying src\nacl\bindings\crypto_sign.py -> build\lib.win-amd64-3.7\nacl\bindings
    copying src\nacl\bindings\randombytes.py -> build\lib.win-amd64-3.7\nacl\bindings
    copying src\nacl\bindings\sodium_core.py -> build\lib.win-amd64-3.7\nacl\bindings
    copying src\nacl\bindings\__init__.py -> build\lib.win-amd64-3.7\nacl\bindings
    running build_clib
    error: [WinError 193] %1 is not a valid Win32 application

    ----------------------------------------
  Rolling back uninstall of pynacl
Command "c:\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Taylor\\AppData\\Local\\Temp\\pip-install-2r6c13hz\\PyNaCl\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Taylor\AppData\Local\Temp\pip-record-vukv8v29\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Taylor\AppData\Local\Temp\pip-install-2r6c13hz\PyNaCl\

Most helpful comment

The current version on PyPI does not support Python 3.7. See #1249 and #1401.
However, the rewrite branch now supports 3.7 with all its dependencies, since https://github.com/Rapptz/discord.py/commit/34ece4d1dfee955d23100737d70190a5cdd3ee8d including voice, with https://github.com/Rapptz/discord.py/commit/134bc21fda25657b76bc9d98a619093eecebff66.
~~The exception is PyNaCl, for which you'll probably still encounter this error with when installing with voice support on 3.7.

This error is due to PyNaCl not having a 3.7 wheel for the locked version 1.1.2:
https://github.com/Rapptz/discord.py/blob/8d3b2d0b7094d924b1f1640c1ef75c40cfe180b2/setup.py#L45
I recommend installing the rewrite branch of discord.py[voice] without dependencies and installing the dependencies manually, so that you can install PyNaCl 1.2.1 with the 3.7 wheel on PyPI.
Alternatively, installing the rewrite branch without voice and then installing PyNaCl 1.2.1 should work as well.

All 7 comments

The current version on PyPI does not support Python 3.7. See #1249 and #1401.
However, the rewrite branch now supports 3.7 with all its dependencies, since https://github.com/Rapptz/discord.py/commit/34ece4d1dfee955d23100737d70190a5cdd3ee8d including voice, with https://github.com/Rapptz/discord.py/commit/134bc21fda25657b76bc9d98a619093eecebff66.
~~The exception is PyNaCl, for which you'll probably still encounter this error with when installing with voice support on 3.7.

This error is due to PyNaCl not having a 3.7 wheel for the locked version 1.1.2:
https://github.com/Rapptz/discord.py/blob/8d3b2d0b7094d924b1f1640c1ef75c40cfe180b2/setup.py#L45
I recommend installing the rewrite branch of discord.py[voice] without dependencies and installing the dependencies manually, so that you can install PyNaCl 1.2.1 with the 3.7 wheel on PyPI.
Alternatively, installing the rewrite branch without voice and then installing PyNaCl 1.2.1 should work as well.

Thanks! For clarification, just to be sure, the dependencies are
aiohttp, websockets, and PyNaCl? If so then it appears everything is fixed!

Yes, for discord.py[voice], that's correct.

Awesome, thanks again!

I'm still getting this error on the rewrite branch with PyNaCl 1.2.1 and Python 3.7.0 when I try to load the Opus dll.

This error occurs when installing from PyPI without a wheel.
It shouldn't have anything to do with loading Opus.

It was the error I was getting when I did discord.opus.load_opus(Path_To_Opus_DLL) but I found it is automatically loaded on Windows so I suppose I avoided the error.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tairabiteru picture tairabiteru  路  3Comments

JackL0 picture JackL0  路  3Comments

reuscam picture reuscam  路  3Comments

Nicba1010 picture Nicba1010  路  3Comments

j0hnmeow picture j0hnmeow  路  3Comments