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

"pip install" fails with Python 3.8 (amd64) on Windows 10 #150

Closed
nmantani opened this issue Jun 29, 2020 · 4 comments
Closed

"pip install" fails with Python 3.8 (amd64) on Windows 10 #150

nmantani opened this issue Jun 29, 2020 · 4 comments

Comments

@nmantani
Copy link

Hello,

I use Python 3.8.3 (amd64) on Windows 10.
When I tried to install yara-python 4.0.2 with pip, I got the following error.
I was able to successfully install it with Python 3.7.8 (amd64).

PS C:\Users\user\Desktop> py -3
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> ^Z

PS C:\Users\user\Desktop> py -3 -m pip install yara-python
Collecting yara-python
  Downloading yara-python-4.0.2.tar.gz (405 kB)
     |████████████████████████████████| 405 kB 364 kB/s
Could not build wheels for yara-python, since package 'wheel' is not installed.
Installing collected packages: yara-python
    Running setup.py install for yara-python ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\user\AppData\Local\Programs\Python\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-06j662xr\\yara-python\\setup.py'"'"'; __file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-06j662xr\\yara-python\\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\user\AppData\Local\Temp\pip-record-kpjcfvu6\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\user\AppData\Local\Programs\Python\Python38\Include\yara-python'
         cwd: C:\Users\user\AppData\Local\Temp\pip-install-06j662xr\yara-python\
    Complete output (4 lines):
    running install
    running build
    running build_ext
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\user\AppData\Local\Programs\Python\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-06j662xr\\yara-python\\setup.py'"'"'; __file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-06j662xr\\yara-python\\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\user\AppData\Local\Temp\pip-record-kpjcfvu6\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\user\AppData\Local\Programs\Python\Python38\Include\yara-python' Check the logs for full command output.
WARNING: You are using pip version 20.1; however, version 20.1.1 is available.
You should consider upgrading via the 'C:\Users\user\AppData\Local\Programs\Python\Python38\python.exe -m pip install --upgrade pip' command.
PS C:\Users\user\Desktop>

So I tried to manually download and install the wheel file (I got the download URL from https://pypi.org/project/yara-python/#files), I got the following error.

PS C:\Users\user\Desktop> curl -o yara_python-4.0.2-cp38-cp38m-win_amd64.whl  https://files.pythonhosted.org/packages/a1/f4/572ec37bca6019d6666351f36a3809d4c46510e2c9c3a3f8ac4c7f670704/yara_python-4.0.2-cp38-cp38m-win_amd64.whl
PS C:\Users\user\Desktop> py -3 -m pip install .\yara_python-4.0.2-cp38-cp38m-win_amd64.whl
ERROR: yara_python-4.0.2-cp38-cp38m-win_amd64.whl is not a supported wheel on this platform.
WARNING: You are using pip version 20.1; however, version 20.1.1 is available.
You should consider upgrading via the 'C:\Users\user\AppData\Local\Programs\Python\Python38\python.exe -m pip install --upgrade pip' command.
PS C:\Users\user\Desktop>

Finally I was able to install the wheel file by renaming it ("cp38m" -> "cp38").

PS C:\Users\user\Desktop> Move-Item .\yara_python-4.0.2-cp38-cp38m-win_amd64.whl .\yara_python-4.0.2-cp38-cp38-win_amd64.whl
PS C:\Users\user\Desktop> py -3 -m pip install .\yara_python-4.0.2-cp38-cp38-win_amd64.whl
Processing c:\users\user\desktop\yara_python-4.0.2-cp38-cp38-win_amd64.whl
Installing collected packages: yara-python
Successfully installed yara-python-4.0.2
WARNING: You are using pip version 20.1; however, version 20.1.1 is available.
You should consider upgrading via the 'C:\Users\user\AppData\Local\Programs\Python\Python38\python.exe -m pip install --upgrade pip' command.
PS C:\Users\user\Desktop> py -3
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import yara
>>> ^Z

PS C:\Users\user\Desktop>

A similar issue of Coverage.py:
nedbat/coveragepy#949

This change in Python 3.8 may be related to the error:
https://docs.python.org/dev/whatsnew/3.8.html#build-and-c-api-changes

Building yara-python wheel files with a newer version of wheel may fix the error.
pypa/wheel#303

I use yara-python in my malware analysis tool FileInsight-plugins (https://github.com/nmantani/FileInsight-plugins/) to use YARA in McAfee FileInsight hex editor. Thank you very much for developing!

@JhonJohnatan
Copy link

+1

@nmantani
Copy link
Author

Hello,

Thank you for updating wheel files at pypi.org to 4.0.3. However, the error that I reported is not fixed yet. The wheel file name for Python 3.8 should be yara_python-4.0.3-cp38-cp38-win_amd64.whl (please change "cp38m" to "cp38") .

@plusvic
Copy link
Member

plusvic commented Jan 28, 2021

Fixed in 4.0.4

@plusvic plusvic closed this as completed Jan 28, 2021
@nmantani
Copy link
Author

Thank you so much!

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

3 participants