Trouble installing and importing pyHook - python

This is my first question on this site so I hope I format this correctly. I also am very new to programming so bear with my lack of knowledge, thank you!
I'm trying to install pyHook like so and I keep getting this error message:
C:\Python27>py -2.7 -m pip install pyHook-1.5.1-cp27-cp27M-win_amd64.whl
pyHook-1.5.1-cp27-cp27M-win_amd64.whl is not a supported wheel on this platform.
I have python 2.7.14 as you can see from below:
Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:25:58) [MSC v.1500 64 bit
(AMD64)] on win32
Just in case, I tried updating pip and It said it was up to date. I also tried install this version of the .whl and I get the same error:
C:\Python27>py -2.7 -m pip install pyHook-1.5.1-cp27-cp27m-win32.whl
pyHook-1.5.1-cp27-cp27m-win32.whl is not a supported wheel on this platform.
From reading online I believe cp27 indicates its for python 2.7 and to be safe I tried the 64 bit and 32 bit files, but nothing seems to work. If anyone could offer up any solutions or advice, it would be greatly appreciated!

I installed Python 2.7, then pyHook and was able to get it working following these exact steps.
Note, I was using Anaconda to create the Python 2.7 environment and Windows 10 is my OS.
conda create -n python27 python=2.7 This created a new conda environment with python 2.7.14.
activate python27
python -m pip install --upgrade pip This installed pip version 10.0.0
Downloaded pyHook from the unofficial windows binaries.
Specifically: pyHook-1.5.1-cp27-cp27m-win_amd64.whl
Navigated to downloads folder in command prompt
pip install pyHook-1.5.1-cp27-cp27m-win_amd64.whl
That installed it properly with no error messages. Hope that helps. My guess is that the new pip version fixes it, or there is a problem with how you are installing Python 2.7, so try Anaconda (or miniconda if you want to keep it light)
I was also able to import it with no problem after these steps.

Many binaries depend on numpy-1.13+mkl and the Microsoft Visual C++ 2008 (x64, x86, and SP1 for CPython 2.7), Visual C++ 2010 (x64, x86, for CPython 3.4), or the Visual C++ 2017 (x64 or x86 for CPython 3.5, 3.6, and 3.7) redistributable packages.
Install numpy+mkl before other packages that depend on it.
I have Microsoft Visual C++ 2008.I just do this,
python -m pip install numpy-1.13.3+mkl-cp27-cp27m-win_amd64.whl
python -m pip install pyHook-1.5.1-cp27-cp27m-win_amd64.whl
then it work.

Related

pycharm django install mysqlclient failed

I start a Django project by Pycharm and require to use the Mysql as database, there is somthing wrong with installing the mysqlclient package.I have searched the info and downloaded the package from www.lfd.uci.edu.When I pip install the .whl file,it told me not match the platform. But I use the same package to pip install in cmd sucessfully. I wonder there is something different between the venv and local? the detail screenshot as below:
my venv Python version:
Python 3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
I have try some different version mysqlclient
pip install mysqlclient-1.4.6-cp38-cp38-win32.whl
pip install mysqlclient-1.4.6-cp38-cp38-win_amd64.whl
both of above are wrong as below:
mysqlclient-1.4.6-cp38-cp38-win_amd64.whl is not a supported wheel on this platform.
I don`t have the enough reputation to post the image,I just can let them as a tags.I hope someone can help me out.Thanks for reading this question.
use
pip install mysqlclient
When you already compilred packages on your system it shouldn't cause a problem.
See for more information
If you need an older Version
pip install mysqlclient==1.4.6

Can't install pytorch with pip on Windows

I'm trying to install Pytorch with Windows and I'm using the commands of the official site
https://pytorch.org/get-started/locally/
pip3 install torch==1.2.0 torchvision==0.4.0 -f https://download.pytorch.org/whl/torch_stable.html
This is the command if I choose Windows, Cuda 10.0, and Python 3.7
But if I run this I get the error message:
ERROR: Could not find a version that satisfies the requirement torch==1.2.0 (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
ERROR: No matching distribution found for torch==1.2.0
So why does this happen?
My pip is version 19.2 and I am in a newly installed python 3.7 environment
I tried multiple solutions and it wasn't working on Windows 10 until I tried this:
pip install torch==1.5.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
If you want your GPU enabled then remove the "+CPU":
pip install torch==1.5.0 -f https://download.pytorch.org/whl/torch_stable.html
The most likely reason for Your issue is a 32-bit installation of python, while the torch libraries rely on having a 64-bit version. I had exactly the same issue.
Just start python from command line and observe
C:\Users\marci>python
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32
My installation now shows 64 bits. If Yours shows 32, then install 64-bit python. I used this link: Official python 64-bit Windows installer
So you have Cuda 10 installed? If you do, try this:
pip3 install https://download.pytorch.org/whl/cu100/torch-1.2.0-cp37-cp37m-win_amd64.whl
followed by:
pip3 install torchvision
To check if it was installed properly, type this into your command line:
python
followed by:
from __future__ import print_function
import torch
x = torch.rand(5, 3)
print(x)
If you get this output:
tensor([[0.3380, 0.3845, 0.3217],
[0.8337, 0.9050, 0.2650],
[0.2979, 0.7141, 0.9069],
[0.1449, 0.1132, 0.1375],
[0.4675, 0.3947, 0.1426]])
PyTorch was installed correctly!
I had the same issue, and what I noticed is that I was using Python 3.8.1 and the latest PyTorch was for Python 3.7.
I uninstalled Python 3.8.1 and installed 3.7.6 and voila, it worked!
Not sure if this is your case, but it helped me.
pip install torch==1.2.0+cpu torchvision==0.4.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
Please use this, worked out for me.
Try installing via .whl file from Christoph Gohlke's repo at this link: https://www.lfd.uci.edu/~gohlke/pythonlibs/
Make sure you get the right one for your python version (cp37 at the bottom).
Navigate to the file or save it to your working directory, then use
pip3 install path-to-file.whl
Link to .whl file on page
The most likely reason for Your issue is a 32-bit installation of python, while the torch libraries rely on having a 64-bit version. I had exactly the same issue.
Just start python from command line and observe
C:\Users\marci>python
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32
My installation now shows 64 bits. If Yours shows 32, then install 64-bit python. I used this link: Official python 64-bit Windows installer
it is the best answer
Go here https://pytorch.org/get-started/previous-versions/ and find the appropriate command for the version you want.
But first it is best to create an virtual environment with the right version of python
conda create -n you_env_name python=?.?.?
Then activate the environment
conda activate your_env_name
try the following in your IDE command prompt then restart the IDE:
conda install pytorch -c pytorch
it's because your python version is 32bit while you're trying to download a 64bit version of Pytorch, navigate to pytorch_whl_page and choose an appreciate version of Pytorch
or reinstall python from the official Python page to a 64bit version
You will find the correct code to run on the PyTorch website.
There, you can choose your OS, platform, pip, conda and other customisation.
For example, the code to install the PyTorch package on Windows using pip and the CUDA 10.2 platform is (without the quotes:
"pip3 install torch==1.9.0+cu102 torchvision==0.10.0+cu102 torchaudio===0.9.0 -f https://download.pytorch.org/whl/torch_stable.html"
Just downgrade your python version. I was using Python 3.10 then I uninstalled that and reinstalled python 3.7. It started working for me
PyTorch is now torch.
import torch
print(help("torch"))

How to install packages/modules in IronPython

I am new to IronPython. Thanks for you help and patience.
I installed IronPython 2.7 from http://ironpython.net/ in Visual Studio 2015.
I also installed Python 2.7.6 and anaconda.
I tried the following solution and it didn't work. Installing Python Packages - IronPython
I am wondering can IronPython use the modules installed by anaconda directly?
The packages I tried to install are numpy,scipy,pandas,sklearn. I saw a document in 2012 pointed out that sklearn is not supported in IronPython. Is it still the case?
Thanks.
depend on IronPython official website http://ironpython.net/blog/2014/12/07/pip-in-ironpython-275.html
you can follow the following steps
Step1
add path of ironPython installation to system path
Step2
run cmd as administrator and type the following command
ipy -X:Frames -m ensurepip
now you can install everything is done, you can simply add any package by following command
ipy -X:Frames -m pip install Package

Python(x,y): MinGW installation - MWE

Background
I reinstalled Python(x,y) on my Windows 7 machine. When I finished the installation I wanted to upgrade all packages using pip. But the mingw compiler gives some weird error messages.
My last question could hopefully get resolved by this issue: Python: Install sip
Therefore I checked out an example online that builds C code for Python using mingw. But it failed - that might be an indication that mingw is not working as intended. I have some details if this helps anything:
mingw32-make --version 3.82.90
gcc --version 4.8.1
python --version 2.7.10
I configured Python (C:\Python27\Lib\distutils\distutils.cfg) according to the qutip installation guide and https://docs.python.org/2/install/#location-and-names-of-config-files.
Issue
I want to test my mingw installation since I cannot upgrade the Python packages with pip. Please give me some tested code to check if my installation is working properly together with Python.

PyCrypto install error on Windows

I am trying to install PyCrypto 2.6 Library on my computer. But I keep getting the following error
D:\Software\Python\package\pycrypto-2.6>python setup.py build
running build
running build_py
running build_ext
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Random.OSRNG.winrandom' extension
error: Unable to find vcvarsall.bat
My System has
Windows 8 Pro 64-bit, Visual Studio Enterprise 2012 and Python 3.3
To fix the error I tried to set the Environment Variable VS90COMNTOOLS=%VS110COMNTOOLS% as advised by fmuecke in the post error: Unable to find vcvarsall.bat but it didn't work for me.
Can any one please advise me how to fix this error.
FYI, I don't to install VC2008 etc..
I managed to install PyCrypto 2.6 by using the prebuilt binary for Python3.3 from The Voidspace Python Modules.
It doesn't actually fix the error: Unable to find vcvarsall.bat for other package which don't have a prebuilt binaries available.
However it eliminates the need to build PyCrypto package, allowing me to install PyCrypto on my system without getting the error.
I've just used
https://www.microsoft.com/en-gb/download/details.aspx?id=44266
with setuptools > 6.0 and run
'pip install pycrypto'
and it worked
I know this is an old question, but I also need today much time to get paramiko wokring.
I want to use Python 3.4 and on voidspace, there are no prebuild binaries for 3.4.
Finally, I got a wokring pycrypto by installing "Microsoft Studio Express 2010 C++" and run from the pycrypto 2.7 folder:
python setup.py build --compiler msvc
python setup.py install
python setup.py bdist_wininst
All the "tricks" with enviroment variables doesn't work for me.
If it helps somebody, all the thanks goes to:
http://flintux.wordpress.com/2014/04/30/pycrypto-for-python-3-4-on-windows-7-64bit/
For Python 3.5 you can do this:
Install a PyCrypto binary from this site :
https://github.com/sfbahr/PyCrypto-Wheels
The best way to do it, is:
64bits Python
c:\Python35\Scripts\pip.exe install --use-wheel --no-index --find-links=https://github.com/sfbahr/PyCrypto-Wheels/raw/master/pycrypto-2.6.1-cp35-none-win_amd64.whl pycrypto
32bits Python
c:\Python35\Scripts\pip.exe install --use-wheel --no-index --find-links=https://github.com/sfbahr/PyCrypto-Wheels/raw/master/pycrypto-2.6.1-cp35-none-win32.whl pycrypto
Of course replace c:\Python35\Scripts\pip.exe by your python pip path
To know your python version, run python and look at the architecture displayed between brackets:
C:\Users\utilisateur>python
Python 3.5.1 |Anaconda 4.0.0 (64-bit)| (default, Feb 16 2016, 09:49:46) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Hope this can help.
You may install mingw64 and then run from the PyCrypto unzipped files directory:
python setup.py build --compiler=mingw32
Updated answer for 2021 (many other answers are outdated)
Python 2.7 is EOL (end-of-life), and Microsoft has removed the download link for the Visual C++ 8.0 compiler, which was needed for compiling native Python 2.7 modules (and which they later called something like "C++ compiler for Python 2.7", VCForPython27.msi). Therefore pip install pycrypto no longer works.
To see for yourserlf, check out this answer with a now defunct download link. Don't search for VCForPython27 on GitHub - you will find projects, but they are not official Microsoft projects, so you may want to stay away from those.
If you find yourself in this situation, then seriously, it's high time to migrate to Python 3. Don't download old builds of PyCrypto or Visual C++ 8.0 from random websites or from web archive links, especially not since this is a library for cryptography that should be kept up to date.
I am using Windows 10 - All I needed to do was update my system with Visual C++ Build Tools 2015 which I found on this page: https://blogs.msdn.microsoft.com/pythonengineering/2016/04/11/unable-to-find-vcvarsall-bat/
About mid-page, you will see some download options - choose your python version and download the correct package
I then re-imported the program I was trying to install and NO more error! Woohoo!
if you are
VS 2010
SET VS90COMNTOOLS=%VS100COMNTOOLS%
VS 2012
SET VS90COMNTOOLS=%VS110COMNTOOLS%
VS 2013
SET VS90COMNTOOLS=%VS120COMNTOOLS%
and then
python setup.py install

Categories

Resources