opened
aronsky
username_0
Installing pycrypto on Windows is a pain - it requires Visual Studio for compilation, or looking for binary distributions by 3rd parties, which aren't always available for the latest Python versions.

Furthermore, the whole project is abandoned, and it's recommended to use pycryptodome instead. It's a drop-in replacement for pycrypto - no need to change the source code at all.
Switch from pycrypto to pycryptodome.
issue
created
VipPat
username_1
how do you go about switching them? Is there a quick fix i Can do on my end to commit this to my local repo?
comment
created
aronsky
username_0
1. You can fork [my repo](https://github.com/username_0/python-broadlink) (this one hasn't been touched for a while, so you aren't missing any commits).
2. You can look at my commits and make those changes locally in your repo (it's a really simple change)
3. You can add my repo as an upstream remote, and merge my master branch into yours.
comment
created
VipPat
username_1
Thanks Lev. Broadlink was pulled as a package when I installed Home
Assistant. I'm new to this. Would you be kind enough to point out to the
location of the various modules that are installed where I can modify those
two files.


Regards,
Vipul
comment
created
aronsky
username_0
Well, that really depends on the way you installed Home Assistant. Assuming you haven't used virtual environments, and installed it with ```pip```, it should be under the Python ```site-packages``` folder. By default, this should be located at ```C:\Users\<your username>\AppData\Local\Programs\Python\Python36\lib\site-packages\broadlink-0.3-py3.6.egg``` or somewhere around there. In my experience, the installation of the package fails on Windows, unless you have a properly configured compiler (since it depends on ```pycrypto```, which has to be compiled). But I don't know in which state Home Assistant left the installation, and whether you can find the module, update the setup script, and continue from there.

I suggest you simply clone my repo, and run ```py setup.py install``` to install my version, which depends on ```pycryptodome``` (which, in turn, can be installed on Windows without compilation). If you are using a virtual environment for Home Assistant, simply switch to it before running ```py setup.py install```.
comment
created
VipPat
username_1
Thank you! I ended up downloading your master and making changes. still
errors on installation. Pasting the log below


C:\python-broadlink-master>py setup.py install
running install
running bdist_egg
running egg_info
creating broadlink.egg-info
writing broadlink.egg-info\PKG-INFO
writing dependency_links to broadlink.egg-info\dependency_links.txt
writing requirements to broadlink.egg-info\requires.txt
writing top-level names to broadlink.egg-info\top_level.txt
writing manifest file 'broadlink.egg-info\SOURCES.txt'
reading manifest file 'broadlink.egg-info\SOURCES.txt'
writing manifest file 'broadlink.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
creating build
creating build\lib
creating build\lib\broadlink
copying broadlink\__init__.py -> build\lib\broadlink
creating build\bdist.win32
creating build\bdist.win32\egg
creating build\bdist.win32\egg\broadlink
copying build\lib\broadlink\__init__.py -> build\bdist.win32\egg\broadlink
byte-compiling build\bdist.win32\egg\broadlink\__init__.py to
__init__.cpython-36.pyc
creating build\bdist.win32\egg\EGG-INFO
copying broadlink.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO
copying broadlink.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO
copying broadlink.egg-info\dependency_links.txt ->
build\bdist.win32\egg\EGG-INFO
copying broadlink.egg-info\not-zip-safe -> build\bdist.win32\egg\EGG-INFO
copying broadlink.egg-info\requires.txt -> build\bdist.win32\egg\EGG-INFO
copying broadlink.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO
creating dist
creating 'dist\broadlink-0.3-py3.6.egg' and adding 'build\bdist.win32\egg'
to it
removing 'build\bdist.win32\egg' (and everything under it)
Processing broadlink-0.3-py3.6.egg
creating c:\python\lib\site-packages\broadlink-0.3-py3.6.egg
Extracting broadlink-0.3-py3.6.egg to c:\python\lib\site-packages
Adding broadlink 0.3 to easy-install.pth file

Installed c:\python\lib\site-packages\broadlink-0.3-py3.6.egg
Processing dependencies for broadlink==0.3
Searching for pycryptodome==3.4.4
Reading https://pypi.python.org/simple/pycryptodome/
Downloading
https://pypi.python.org/packages/54/c1/4e8412b3d51e0dd26843bd0b16732bdcbe6a9090a415adcc4f50ce848b84/pycryptodome-3.4.4.tar.gz#md5=0ec0e18a61c6b2047500a3f487dbd37f
Best match: pycryptodome 3.4.4
Processing pycryptodome-3.4.4.tar.gz
Writing
C:\Users\XYZZY\AppData\Local\Temp\easy_install-ra7gc2_0\pycryptodome-3.4.4\setup.cfg
Running pycryptodome-3.4.4\setup.py -q bdist_egg --dist-dir
C:\Users\XYZ\AppData\Local\Temp\easy_install-ra7gc2_0\pycryptodome-3.4.4\egg-dist-tmp-qmw_shrh
warning: no files found matching '.separate_namespace'
warning: no support for Intel AESNI instructions
*error: Setup script exited with error: command 'cl.exe' failed: No such
file or directory*

Regards,
Vipul
comment
created
VipPat
username_1
Inspite of failing I was able to install! TY

Regards,
Vipul



On Mon, Mar 20, 2017 at 12:23 PM, Vipul Patel <vipul.g.patel@gmail.com>
wrote:

> Thank you! I ended up downloading your master and making changes. still
> errors on installation. Pasting the log below
>
>
> C:\python-broadlink-master>py setup.py install
> running install
> running bdist_egg
> running egg_info
> creating broadlink.egg-info
> writing broadlink.egg-info\PKG-INFO
> writing dependency_links to broadlink.egg-info\dependency_links.txt
> writing requirements to broadlink.egg-info\requires.txt
> writing top-level names to broadlink.egg-info\top_level.txt
> writing manifest file 'broadlink.egg-info\SOURCES.txt'
> reading manifest file 'broadlink.egg-info\SOURCES.txt'
> writing manifest file 'broadlink.egg-info\SOURCES.txt'
> installing library code to build\bdist.win32\egg
> running install_lib
> running build_py
> creating build
> creating build\lib
> creating build\lib\broadlink
> copying broadlink\__init__.py -> build\lib\broadlink
> creating build\bdist.win32
> creating build\bdist.win32\egg
> creating build\bdist.win32\egg\broadlink
> copying build\lib\broadlink\__init__.py -> build\bdist.win32\egg\broadlink
> byte-compiling build\bdist.win32\egg\broadlink\__init__.py to
> __init__.cpython-36.pyc
> creating build\bdist.win32\egg\EGG-INFO
> copying broadlink.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO
> copying broadlink.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO
> copying broadlink.egg-info\dependency_links.txt ->
> build\bdist.win32\egg\EGG-INFO
> copying broadlink.egg-info\not-zip-safe -> build\bdist.win32\egg\EGG-INFO
> copying broadlink.egg-info\requires.txt -> build\bdist.win32\egg\EGG-INFO
> copying broadlink.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO
> creating dist
> creating 'dist\broadlink-0.3-py3.6.egg' and adding 'build\bdist.win32\egg'
> to it
> removing 'build\bdist.win32\egg' (and everything under it)
> Processing broadlink-0.3-py3.6.egg
> creating c:\python\lib\site-packages\broadlink-0.3-py3.6.egg
> Extracting broadlink-0.3-py3.6.egg to c:\python\lib\site-packages
> Adding broadlink 0.3 to easy-install.pth file
>
> Installed c:\python\lib\site-packages\broadlink-0.3-py3.6.egg
> Processing dependencies for broadlink==0.3
> Searching for pycryptodome==3.4.4
> Reading https://pypi.python.org/simple/pycryptodome/
> Downloading https://pypi.python.org/packages/54/c1/
> 4e8412b3d51e0dd26843bd0b16732bdcbe6a9090a415adcc4f50ce848b84
> /pycryptodome-3.4.4.tar.gz#md5=0ec0e18a61c6b2047500a3f487dbd37f
> Best match: pycryptodome 3.4.4
> Processing pycryptodome-3.4.4.tar.gz
> Writing C:\Users\XYZZY\AppData\Local\Temp\easy_install-ra7gc2_0\
> pycryptodome-3.4.4\setup.cfg
> Running pycryptodome-3.4.4\setup.py -q bdist_egg --dist-dir
> C:\Users\XYZ\AppData\Local\Temp\easy_install-ra7gc2_0\
> pycryptodome-3.4.4\egg-dist-tmp-qmw_shrh
> warning: no files found matching '.separate_namespace'
> warning: no support for Intel AESNI instructions
> *error: Setup script exited with error: command 'cl.exe' failed: No such
> file or directory*
>
> Regards,
> Vipul
>
>
>
>
comment
created
aronsky
username_0
Great! I'm surprised to see there was a problem with installing
pycryptodome smoothly. What was the solution in the end?

On Mar 20, 2017 22:02, "username_1" <notifications@github.com> wrote:

> Inspite of failing I was able to install! TY
>
> Regards,
> Vipul
>
>
>
> On Mon, Mar 20, 2017 at 12:23 PM, Vipul Patel <vipul.g.patel@gmail.com>
> wrote:
>
> > Thank you! I ended up downloading your master and making changes. still
> > errors on installation. Pasting the log below
> >
> >
> > C:\python-broadlink-master>py setup.py install
> > running install
> > running bdist_egg
> > running egg_info
> > creating broadlink.egg-info
> > writing broadlink.egg-info\PKG-INFO
> > writing dependency_links to broadlink.egg-info\dependency_links.txt
> > writing requirements to broadlink.egg-info\requires.txt
> > writing top-level names to broadlink.egg-info\top_level.txt
> > writing manifest file 'broadlink.egg-info\SOURCES.txt'
> > reading manifest file 'broadlink.egg-info\SOURCES.txt'
> > writing manifest file 'broadlink.egg-info\SOURCES.txt'
> > installing library code to build\bdist.win32\egg
> > running install_lib
> > running build_py
> > creating build
> > creating build\lib
> > creating build\lib\broadlink
> > copying broadlink\__init__.py -> build\lib\broadlink
> > creating build\bdist.win32
> > creating build\bdist.win32\egg
> > creating build\bdist.win32\egg\broadlink
> > copying build\lib\broadlink\__init__.py -> build\bdist.win32\egg\
> broadlink
> > byte-compiling build\bdist.win32\egg\broadlink\__init__.py to
> > __init__.cpython-36.pyc
> > creating build\bdist.win32\egg\EGG-INFO
> > copying broadlink.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO
> > copying broadlink.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO
> > copying broadlink.egg-info\dependency_links.txt ->
> > build\bdist.win32\egg\EGG-INFO
> > copying broadlink.egg-info\not-zip-safe ->
> build\bdist.win32\egg\EGG-INFO
> > copying broadlink.egg-info\requires.txt ->
> build\bdist.win32\egg\EGG-INFO
> > copying broadlink.egg-info\top_level.txt ->
> build\bdist.win32\egg\EGG-INFO
> > creating dist
> > creating 'dist\broadlink-0.3-py3.6.egg' and adding
> 'build\bdist.win32\egg'
> > to it
> > removing 'build\bdist.win32\egg' (and everything under it)
> > Processing broadlink-0.3-py3.6.egg
> > creating c:\python\lib\site-packages\broadlink-0.3-py3.6.egg
> > Extracting broadlink-0.3-py3.6.egg to c:\python\lib\site-packages
> > Adding broadlink 0.3 to easy-install.pth file
> >
> > Installed c:\python\lib\site-packages\broadlink-0.3-py3.6.egg
> > Processing dependencies for broadlink==0.3
> > Searching for pycryptodome==3.4.4
> > Reading https://pypi.python.org/simple/pycryptodome/
> > Downloading https://pypi.python.org/packages/54/c1/
> > 4e8412b3d51e0dd26843bd0b16732bdcbe6a9090a415adcc4f50ce848b84
> > /pycryptodome-3.4.4.tar.gz#md5=0ec0e18a61c6b2047500a3f487dbd37f
> > Best match: pycryptodome 3.4.4
> > Processing pycryptodome-3.4.4.tar.gz
> > Writing C:\Users\XYZZY\AppData\Local\Temp\easy_install-ra7gc2_0\
> > pycryptodome-3.4.4\setup.cfg
> > Running pycryptodome-3.4.4\setup.py -q bdist_egg --dist-dir
> > C:\Users\XYZ\AppData\Local\Temp\easy_install-ra7gc2_0\
> > pycryptodome-3.4.4\egg-dist-tmp-qmw_shrh
> > warning: no files found matching '.separate_namespace'
> > warning: no support for Intel AESNI instructions
> > *error: Setup script exited with error: command 'cl.exe' failed: No such
> > file or directory*
> >
> > Regards,
> > Vipul
> >
> >
> >
> >
comment
created
VipPat
username_1
Did not change much. Tried it again using VS2015 x86 command prompt ( Still
received the same error) ,  Ended up looking in the site-packages directory
and found the broadlink package there, so was good to go inspite of the
error.

Regards,
Vipul



On Mon, Mar 20, 2017 at 1:36 PM, Lev Aronsky <notifications@github.com>
wrote:

> Great! I'm surprised to see there was a problem with installing
> pycryptodome smoothly. What was the solution in the end?
>
>
> On Mar 20, 2017 22:02, "username_1" <notifications@github.com> wrote:
>
> > Inspite of failing I was able to install! TY
> >
> > Regards,
> > Vipul
> >
> >
> >
> > On Mon, Mar 20, 2017 at 12:23 PM, Vipul Patel <vipul.g.patel@gmail.com>
> > wrote:
> >
> > > Thank you! I ended up downloading your master and making changes. still
> > > errors on installation. Pasting the log below
> > >
> > >
> > > C:\python-broadlink-master>py setup.py install
> > > running install
> > > running bdist_egg
> > > running egg_info
> > > creating broadlink.egg-info
> > > writing broadlink.egg-info\PKG-INFO
> > > writing dependency_links to broadlink.egg-info\dependency_links.txt
> > > writing requirements to broadlink.egg-info\requires.txt
> > > writing top-level names to broadlink.egg-info\top_level.txt
> > > writing manifest file 'broadlink.egg-info\SOURCES.txt'
> > > reading manifest file 'broadlink.egg-info\SOURCES.txt'
> > > writing manifest file 'broadlink.egg-info\SOURCES.txt'
> > > installing library code to build\bdist.win32\egg
> > > running install_lib
> > > running build_py
> > > creating build
> > > creating build\lib
> > > creating build\lib\broadlink
> > > copying broadlink\__init__.py -> build\lib\broadlink
> > > creating build\bdist.win32
> > > creating build\bdist.win32\egg
> > > creating build\bdist.win32\egg\broadlink
> > > copying build\lib\broadlink\__init__.py -> build\bdist.win32\egg\
> > broadlink
> > > byte-compiling build\bdist.win32\egg\broadlink\__init__.py to
> > > __init__.cpython-36.pyc
> > > creating build\bdist.win32\egg\EGG-INFO
> > > copying broadlink.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO
> > > copying broadlink.egg-info\SOURCES.txt ->
> build\bdist.win32\egg\EGG-INFO
> > > copying broadlink.egg-info\dependency_links.txt ->
> > > build\bdist.win32\egg\EGG-INFO
> > > copying broadlink.egg-info\not-zip-safe ->
> > build\bdist.win32\egg\EGG-INFO
> > > copying broadlink.egg-info\requires.txt ->
> > build\bdist.win32\egg\EGG-INFO
> > > copying broadlink.egg-info\top_level.txt ->
> > build\bdist.win32\egg\EGG-INFO
> > > creating dist
> > > creating 'dist\broadlink-0.3-py3.6.egg' and adding
> > 'build\bdist.win32\egg'
> > > to it
> > > removing 'build\bdist.win32\egg' (and everything under it)
> > > Processing broadlink-0.3-py3.6.egg
> > > creating c:\python\lib\site-packages\broadlink-0.3-py3.6.egg
> > > Extracting broadlink-0.3-py3.6.egg to c:\python\lib\site-packages
> > > Adding broadlink 0.3 to easy-install.pth file
> > >
> > > Installed c:\python\lib\site-packages\broadlink-0.3-py3.6.egg
> > > Processing dependencies for broadlink==0.3
> > > Searching for pycryptodome==3.4.4
> > > Reading https://pypi.python.org/simple/pycryptodome/
> > > Downloading https://pypi.python.org/packages/54/c1/
> > > 4e8412b3d51e0dd26843bd0b16732bdcbe6a9090a415adcc4f50ce848b84
> > > /pycryptodome-3.4.4.tar.gz#md5=0ec0e18a61c6b2047500a3f487dbd37f
> > > Best match: pycryptodome 3.4.4
> > > Processing pycryptodome-3.4.4.tar.gz
> > > Writing C:\Users\XYZZY\AppData\Local\Temp\easy_install-ra7gc2_0\
> > > pycryptodome-3.4.4\setup.cfg
> > > Running pycryptodome-3.4.4\setup.py -q bdist_egg --dist-dir
> > > C:\Users\XYZ\AppData\Local\Temp\easy_install-ra7gc2_0\
> > > pycryptodome-3.4.4\egg-dist-tmp-qmw_shrh
> > > warning: no files found matching '.separate_namespace'
> > > warning: no support for Intel AESNI instructions
> > > *error: Setup script exited with error: command 'cl.exe' failed: No
> such
> > > file or directory*
>
> > >
> > > Regards,
> > > Vipul
> > >
> > >
> > >
> > >
comment
created
mjg59
username_2
This should now be unnecessary - #78 avoids the need for C code here at all. Let me know if using pyaes doesn't work for you?
comment
created
aronsky
username_0
#78 looks like a good alternative, but I'm not sure about the setup script there - it looks like on a clean Python installation, it'll attempt to import ```pyaes```, and once it fails, will try to install ```pycrypto```, going back to the same issue of ```pycrypto``` not being easily installable on Windows.

If ```pyaes``` works, why not ditch ```pycrypto``` altogether?
comment