Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation documentation for Windows Precompiled is wrong and confusing #16

Open
CodyMcCodeface opened this issue May 31, 2016 · 5 comments

Comments

@CodyMcCodeface
Copy link

The installation information page of PyCryptodome says the following under the "Windows (pre-compiled)" section:

  1. Install PyCryptodome as a wheel:

pip install pycryptodomex

  1. To make sure everything works fine, run the test suite:

python -m Cryptodome.SelfTest

There are several problems with this though:

  1. Contrary to what these instructions say, this will not install PyCryptoDome as a wheel, but it will rather download it and try to build it, resulting in an error if you don't have the correct build environment installed for the C components included in this package (and the entire mess related to this is the biggest benefit of using a wheel instead to begin with).
  2. Even if I instead download the correct wheel file from PyCryptoDome's PyPi page, I must (as far as I know?) instead use a command-line as follows to install it:

pip install c:\some\path\name-of-wheel-file.whl

This in turn makes it install under the default "Crypto" package instead of the "Cryptodome" package explicitly mentioned in the instructions (and therefore colliding in a breaking fashion with any pre-existing installations of the PyCrypto package).

For more details, please see the following StackOverflow question:

http://stackoverflow.com/questions/37504622/how-to-install-a-python-wheel-under-an-alternative-package-name-in-my-specific

Therefore, I suggest that:

  1. The docs be updated to reflect reality.
  2. Wheel files be created for both the "Cryptodome" and the "Crypto" package names, so that also Windows users without build environments can choose which to use.
@Varbin
Copy link
Contributor

Varbin commented Jun 1, 2016

I can not confirm this, on my Windows-machine following the installation steps correctly install pycryptodome under the "Cryptodome" namespace (using Python 3.5) as wheel (installation log).

After you installation failed you installed the "Crypto" namespace package (PyPi name: pycryptodome), but for the "Cryptodome" namespace packages the name is pycryptodomex. Here is the PyPi page for the Cryptodome namespace packages.

The documentation say this in the first paragraph:

The installation procedure depends on the package you want the library in. PyCryptodome can be used as:

        a drop-in replacement for the old PyCrypto library. You install it with:

        pip install pycryptodome

        In this case, all modules are installed under the Crypto package. You can test everything is right with:

        python -m Crypto.SelfTest

        One must avoid having both PyCrypto and PyCryptodome installed at the same time, as they will interfere with each other.

        This option is therefore recommended only when you are sure that the whole application is deployed in a virtualenv.

        a library independent of the old PyCrypto. You install it with:

        pip install pycryptodomex

        You can test everything is right with:

        python -m Cryptodome.SelfTest

        In this case, all modules are installed under the Cryptodome package. PyCrypto and PyCryptodome can coexist.

@CodyMcCodeface
Copy link
Author

After a bit more investigation, it seems that it does not work with Python 3.4 (or rather, the pip version that comes with it), but it works if I update pip to the latest version.

Here are the relevant parts of the install log when trying to install it on a Python 3.4 installation on Windows (8.1), and as you can see, it does not download the wheel file, but rather the source package and tries to build it, just like I described in my original post:

c:\Python34\Scripts>pip install pycryptodomex
You are using pip version 6.0.8, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pycryptodomex
Downloading pycryptodomex-3.4.2.tar.gz (6.5MB)
100% |################################| 6.5MB 56kB/s
Installing collected packages: pycryptodomex
Running setup.py install for pycryptodomex
Complete output from command C:\Python34\python.exe -c "import setuptools, t
okenize;file='C:\Users\Root\AppData\Local\Temp\pip-build-7ps_u0jl\pyc
ryptodomex\setup.py';exec(compile(getattr(tokenize, 'open', open)(file).rea
d().replace('\r\n', '\n'), file, 'exec'))" install --record C:\Users\Root\Ap
pData\Local\Temp\pip-lh3k5gte-record\install-record.txt --single-version-externa
lly-managed --compile:
running install

running build

running build_py

creating build

creating build\lib.win32-3.4

creating build\lib.win32-3.4\Crypto

copying lib\Crypto__init__.py -> build\lib.win32-3.4\Crypto

creating build\lib.win32-3.4\Crypto\Cipher

...

running build_ext


Command "C:\Python34\python.exe -c "import setuptools, tokenize;file='C:
\Users\Root\AppData\Local\Temp\pip-build-7ps_u0jl\pycryptodomex\setup.py
';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n',
'\n'), file, 'exec'))" install --record C:\Users\Root\AppData\Local\Temp\pip
-lh3k5gte-record\install-record.txt --single-version-externally-managed --compil
e" failed with error code 1 in C:\Users\Root\AppData\Local\Temp\pip-build-7ps_u0
jl\pycryptodomex

Is this expected?

@Varbin
Copy link
Contributor

Varbin commented Jun 2, 2016

It tested this now out on Python 3.4 on Windows XP machine and got the same error but after upgrading pip (pip install -U pip setuptools wheel) to 8.1.2 (my new installation had 7.1.2, you have 6.0.8) installing Pycryptodome from Pypi as wheel worked.

@u1735067
Copy link

u1735067 commented Aug 4, 2016

I had some trouble with PyCryptoDome / Cryptodome / pycryptodomex (too many names .. very confusing when you discover it because it's a dependency) too, I used the following command to install it :

py -m pip install --use-wheel pycryptodomex

and it went ok (py -m pip can be replaced by pip if it's in the PATH ; thanks https://stackoverflow.com/questions/27885397/how-do-i-install-a-python-package-with-a-whl-file).
Before that I tried the pip install pycryptodomex but I had the same result as when the package requiring it tried to install it : it couldn't finish the installation, ending without any error/notice, just not showing up in pip list.
Last line before the thing is dying is :

Copying file build\lib.win-amd64-3.5\Crypto\Util\__init__.py to build\lib.win-amd64-3.5\Cryptodome\Util\__init__.py

Not very informative :(

@Legorooj
Copy link
Contributor

Legorooj commented Jan 2, 2020

@CodyMcCodeface this is an issue with pip not pycryptodome. Therefore, I recommend this issue for closure. @Legrandin

Vangelis66 referenced this issue in yt-dlp/yt-dlp Feb 16, 2021
Authored-by: shirtjs <2660574+shirtjs@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants