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

unable to install pyethash #131

Open
mohsin5432 opened this issue Nov 7, 2021 · 14 comments
Open

unable to install pyethash #131

mohsin5432 opened this issue Nov 7, 2021 · 14 comments

Comments

@mohsin5432
Copy link

Running setup.py install for pyethash ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\mohsin\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Mohsin\AppData\Local\Temp\pip-install-yfm6_fjc\pyethash_25ac1e12a7a742309e1303ec7f4164a4\setup.py'"'"'; file='"'"'C:\Users\Mohsin\AppData\Local\Temp\pip-install-yfm6_fjc\pyethash_25ac1e12a7a742309e1303ec7f4164a4\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\Mohsin\AppData\Local\Temp\pip-record-cgsqj6of\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\mohsin\appdata\local\programs\python\python39\Include\pyethash'
cwd: C:\Users\Mohsin\AppData\Local\Temp\pip-install-yfm6_fjc\pyethash_25ac1e12a7a742309e1303ec7f4164a4
Complete output (27 lines):
running install
running build
running build_ext
building 'pyethash' extension
creating build
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\src
creating build\temp.win-amd64-3.9\Release\src\libethash
creating build\temp.win-amd64-3.9\Release\src\python
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\mohsin\appdata\local\programs\python\python39\include -Ic:\users\mohsin\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt /Tcsrc/libethash/internal.c /Fobuild\temp.win-amd64-3.9\Release\src/libethash/internal.obj -Isrc/ -std=gnu99 -Wall
cl : Command line warning D9002 : ignoring unknown option '-std=gnu99'
internal.c
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\corecrt.h(212): warning C4668: '__cplusplus' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio.h(1833): warning C4710: 'int sprintf_s(char *const ,const size_t,const char *const ,...)': function not inlined
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio.h(1833): note: see declaration of 'sprintf_s'
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\mohsin\appdata\local\programs\python\python39\include -Ic:\users\mohsin\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt /Tcsrc/libethash/io.c /Fobuild\temp.win-amd64-3.9\Release\src/libethash/io.obj -Isrc/ -std=gnu99 -Wall
cl : Command line warning D9002 : ignoring unknown option '-std=gnu99'
io.c
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\corecrt.h(212): warning C4668: '__cplusplus' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio.h(1833): warning C4710: 'int sprintf_s(char *const ,const size_t,const char *const ,...)': function not inlined
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio.h(1833): note: see declaration of 'sprintf_s'
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\mohsin\appdata\local\programs\python\python39\include -Ic:\users\mohsin\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt /Tcsrc/libethash/io_win32.c /Fobuild\temp.win-amd64-3.9\Release\src/libethash/io_win32.obj -Isrc/ -std=gnu99 -Wall
cl : Command line warning D9002 : ignoring unknown option '-std=gnu99'
io_win32.c
c1: fatal error C1083: Cannot open source file: 'src/libethash/io_win32.c': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\mohsin\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Mohsin\AppData\Local\Temp\pip-install-yfm6_fjc\pyethash_25ac1e12a7a742309e1303ec7f4164a4\setup.py'"'"'; file='"'"'C:\Users\Mohsin\AppData\Local\Temp\pip-install-yfm6_fjc\pyethash_25ac1e12a7a742309e1303ec7f4164a4\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\Mohsin\AppData\Local\Temp\pip-record-cgsqj6of\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\mohsin\appdata\local\programs\python\python39\Include\pyethash' Check the logs for full command output.

@Dilshan1997
Copy link

Yeah, I also got that error message..plz someone help to fix this problem.

@delphee
Copy link

delphee commented Dec 24, 2021

Me too. Anyone have any luck yet?

@RNateWorkman
Copy link

I'm having the same problem and hoping someone can help. I'm not that great at exceptions, but believe that the issue has something to do with that when the package installer gets to the "io_win32.c" file it fails because it looks for the file in the root directory "Program Files (x86)" and not x64.

Hopefully somebody can help clean that explanation up.

@thedogrex
Copy link

I think it is x86 / x64 compability error.

I've used python 3.9.0 and these steps worked for me
(with py-evm project on python https://github.com/ethereum/py-evm):

  1. Download pyethash 0.1.27:
    https://pypi.org/project/pyethash/0.1.27/#files
    and unpack archive in lib folder in your project. I've unpacked at /virtualenv/Lib/site-packages/pyethash-0.1.27 folder

  2. Download ethash from git:
    https://github.com/ethereum/ethash

  3. Copy all files form ethash folder to /virtualenv/Lib/site-packages/pyethash-0.1.27

  4. Change /pyethash-0.1.27/src/libethash/mmap.h add this code to the end of file:

#pragma comment(lib, "Shell32.lib")
  1. Change pyethash-0.1.27\src\python\core.c file - replace #include <alloca.h> by the code:
#if defined(_WIN32) || defined(WIN32)
#include <malloc.h>
#else
#include <alloca.h>
#endif
  1. Zip /virtualenv/Lib/site-packages/pyethash-0.1.27 folder and remove that folder (zip archive will stay).

  2. Run pip install for new created zip /virtualenv/Lib/site-packages/pyethash-0.1.27.zip

  3. It can conflict with versions: ethash have 0.1.23 version instead of 0.1.27, i just changed my requerements to 0.1.23 and it worked for me. You can try to copy not all files (from ethhash to pyethhash), just files one by one that breaks the compilation.

@rayeaster
Copy link

I think it is x86 / x64 compability error.

I've used python 3.9.0 and these steps worked for me (with py-evm project on python https://github.com/ethereum/py-evm):

  1. Download pyethash 0.1.27:
    https://pypi.org/project/pyethash/0.1.27/#files
    and unpack archive in lib folder in your project. I've unpacked at /virtualenv/Lib/site-packages/pyethash-0.1.27 folder
  2. Download ethash from git:
    https://github.com/ethereum/ethash
  3. Copy all files form ethash folder to /virtualenv/Lib/site-packages/pyethash-0.1.27
  4. Change /pyethash-0.1.27/src/libethash/mmap.h add this code to the end of file:
#pragma comment(lib, "Shell32.lib")
  1. Change pyethash-0.1.27\src\python\core.c file - replace #include <alloca.h> by the code:
#if defined(_WIN32) || defined(WIN32)
#include <malloc.h>
#else
#include <alloca.h>
#endif
  1. Zip /virtualenv/Lib/site-packages/pyethash-0.1.27 folder and remove that folder (zip archive will stay).
  2. Run pip install for new created zip /virtualenv/Lib/site-packages/pyethash-0.1.27.zip
  3. It can conflict with versions: ethash have 0.1.23 version instead of 0.1.27, i just changed my requerements to 0.1.23 and it worked for me. You can try to copy not all files (from ethhash to pyethhash), just files one by one that breaks the compilation.

for step 8, you could simply modify version to 0.1.27 in the setup.py file within the pyethash-0.1.27 folder

....
setup(
    name='pyethash',
    author="Matthew Wampler-Doty",
    author_email="[email protected]",
    license='GPL',
    version='0.1.27',
    url='https://github.com/ethereum/ethash',
    download_url='https://github.com/ethereum/ethash/tarball/v23',
    description=('Python wrappers for ethash, the ethereum proof of work'
                 'hashing function'),
    ext_modules=[pyethash],
)

@kpoman
Copy link

kpoman commented Jan 3, 2023

I think it is x86 / x64 compability error.
I've used python 3.9.0 and these steps worked for me (with py-evm project on python https://github.com/ethereum/py-evm):

  1. Download pyethash 0.1.27:
    https://pypi.org/project/pyethash/0.1.27/#files
    and unpack archive in lib folder in your project. I've unpacked at /virtualenv/Lib/site-packages/pyethash-0.1.27 folder
  2. Download ethash from git:
    https://github.com/ethereum/ethash
  3. Copy all files form ethash folder to /virtualenv/Lib/site-packages/pyethash-0.1.27
  4. Change /pyethash-0.1.27/src/libethash/mmap.h add this code to the end of file:
#pragma comment(lib, "Shell32.lib")
  1. Change pyethash-0.1.27\src\python\core.c file - replace #include <alloca.h> by the code:
#if defined(_WIN32) || defined(WIN32)
#include <malloc.h>
#else
#include <alloca.h>
#endif
  1. Zip /virtualenv/Lib/site-packages/pyethash-0.1.27 folder and remove that folder (zip archive will stay).
  2. Run pip install for new created zip /virtualenv/Lib/site-packages/pyethash-0.1.27.zip
  3. It can conflict with versions: ethash have 0.1.23 version instead of 0.1.27, i just changed my requerements to 0.1.23 and it worked for me. You can try to copy not all files (from ethhash to pyethhash), just files one by one that breaks the compilation.

for step 8, you could simply modify version to 0.1.27 in the setup.py file within the pyethash-0.1.27 folder

....
setup(
    name='pyethash',
    author="Matthew Wampler-Doty",
    author_email="[email protected]",
    license='GPL',
    version='0.1.27',
    url='https://github.com/ethereum/ethash',
    download_url='https://github.com/ethereum/ethash/tarball/v23',
    description=('Python wrappers for ethash, the ethereum proof of work'
                 'hashing function'),
    ext_modules=[pyethash],
)

Worked fine. Simpler entering the folder and executing python setup.py install ...

@imtypist
Copy link

imtypist commented Apr 4, 2023

Works for me, too. (python 3.9.7, win11)
Thanks for solutions!

@abarbatei
Copy link

For people coming here after years and suffering. I used Python 3.11 and made the .egg 522abb85a345d4751b43418fd4bc36ee15e6d6c0311ddd8f7f0b7d64cb8681f6 *pyethash-0.1.27-py3.11-win-amd64.egg
https://www.virustotal.com/gui/file/522abb85a345d4751b43418fd4bc36ee15e6d6c0311ddd8f7f0b7d64cb8681f6
pyethash-0.1.27-py3.11-win-amd64.egg.zip
(can't upload .egg directly, check the sha256 hash of the .egg file not the zip for confirmation)
Still don't know why anybody didn't upload it somewhere up until now

@caomingpei
Copy link

Thanks a lot, worked for me (python 3.10, win11)

@maritogaleano
Copy link

For people coming here after years and suffering. I used Python 3.11 and made the .egg 522abb85a345d4751b43418fd4bc36ee15e6d6c0311ddd8f7f0b7d64cb8681f6 *pyethash-0.1.27-py3.11-win-amd64.egg https://www.virustotal.com/gui/file/522abb85a345d4751b43418fd4bc36ee15e6d6c0311ddd8f7f0b7d64cb8681f6 pyethash-0.1.27-py3.11-win-amd64.egg.zip (can't upload .egg directly, check the sha256 hash of the .egg file not the zip for confirmation) Still don't know why anybody didn't upload it somewhere up until now

I am having the same problem I have Python 3.10.
and Windows 11, how do I install the file with the egg extension?

@andrewcharlwood
Copy link

For people coming here after years and suffering. I used Python 3.11 and made the .egg 522abb85a345d4751b43418fd4bc36ee15e6d6c0311ddd8f7f0b7d64cb8681f6 *pyethash-0.1.27-py3.11-win-amd64.egg https://www.virustotal.com/gui/file/522abb85a345d4751b43418fd4bc36ee15e6d6c0311ddd8f7f0b7d64cb8681f6 pyethash-0.1.27-py3.11-win-amd64.egg.zip (can't upload .egg directly, check the sha256 hash of the .egg file not the zip for confirmation) Still don't know why anybody didn't upload it somewhere up until now

I am having the same problem I have Python 3.10. and Windows 11, how do I install the file with the egg extension?

Not sure if this will work with windows 11 - but this is py 3.10 built on windows 10 - it's the zip file as per @thedogrex's instructions, so you can start at step 7

https://www.virustotal.com/gui/file/b774c679e808251785b870b38c19bbee3edebca94396efb6083edfb66e4d7dd8?nocache=1

pyethash-0.1.27.zip

@Nov1kov
Copy link

Nov1kov commented Jan 17, 2024

An even simpler option is to use a prepared fork with all of the above changes:

pip install https://codeload.github.com/Nov1kov/ethash/zip/refs/heads/master

@DevWand
Copy link

DevWand commented Jan 28, 2024

Uma opção ainda mais simples é usar um garfo preparado com todas as alterações acima:

pip install https://codeload.github.com/Nov1kov/ethash/zip/refs/heads/master

Thanks, perfect

@theexcelrobin
Copy link

An even simpler option is to use a prepared fork with all of the above changes:

pip install https://codeload.github.com/Nov1kov/ethash/zip/refs/heads/master

Perfecto. Thanks a lot

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