Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Changes for windows #104

Open
philippdonabauer opened this issue Oct 29, 2017 · 7 comments
Open

Changes for windows #104

philippdonabauer opened this issue Oct 29, 2017 · 7 comments

Comments

@philippdonabauer
Copy link

To make it useable under Windows please change Following lines. Then it works for Python!

In file mmap_win32.c add following code:
#pragma comment(lib, "Shell32.lib")

and in python/core.c change the #include <alloca.h> in:
#if defined(_WIN32) || defined(WIN32) #include <malloc.h> #else #include <alloca.h> #endif

Thanks!

@fireflystorm
Copy link

@philippdonabauer thanks for the workaround. It worked for me.

I will just post some step-by-step instructions to make it easier for anyone else to get this going.

Installing ethash on Windows:

  1. Clone the project from github
  2. Open \src\libethash\mmap_win32.c for editing
  3. Add the following after the last #include statement
    #pragma comment(lib, "Shell32.lib")
  4. Open \src\python\core.c
  5. Replace:
    #include <alloca.h>
    with:
    #if defined(_WIN32) || defined(WIN32)
    #include <malloc.h>
    #else
    #include <alloca.h>
    #endif
  6. Run the following in the source code main folder
    setup.py install

This should successsfully install ethash under Windows.

@f-lub
Copy link

f-lub commented Apr 12, 2018

thanks for the workaround, it enabled me to continue to build microraiden on windows 10. Any good method to quickly check if ethash works correctly using this workaoround?

@guylando
Copy link

Those who get "Unable to find vcvarsall.bat" error when running "setup.py install" from instructions above, run this:

python.exe -u -c "import setuptools, tokenize;__file__='C:\\test\\ethash\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --compile

where python.exe is python 3 and ethash is in c:\test or otherwise modify the path in this code

@smitpancholi
Copy link

@philippdonabauer thanks for the workaround. It worked for me.

I will just post some step-by-step instructions to make it easier for anyone else to get this going.

Installing ethash on Windows:

1. Clone the project from github

2. Open \src\libethash\mmap_win32.c for editing

3. Add the following after the last #include statement
   #pragma comment(lib, "Shell32.lib")

4. Open \src\python\core.c

5. Replace:
   #include <alloca.h>
   with:
   #if defined(_WIN32) || defined(WIN32)
   #include <malloc.h>
   #else
   #include <alloca.h>
   #endif

6. Run the following in the source code main folder
   setup.py install

This should successsfully install ethash under Windows.

Thanks, it worked for me but i am finding it difficult to solve another problem.
I am trying to install nucypher with pip in virtual env
--> pip install nucypher
it shows me this error :
ERROR: Failed building wheel for pyethash
Running setup.py clean for pyethash
Failed to build pyethash
Installing collected packages: pyethash, py-evm, nucypher
Found existing installation: pyethash 0.1.23
ERROR: Cannot uninstall 'pyethash'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

Thanks in advanced.

@Ita97
Copy link

Ita97 commented Jul 16, 2020

@philippdonabauer thanks for the workaround. It worked for me.

I will just post some step-by-step instructions to make it easier for anyone else to get this going.

Installing ethash on Windows:

  1. Clone the project from github
  2. Open \src\libethash\mmap_win32.c for editing
  3. Add the following after the last #include statement
    #pragma comment(lib, "Shell32.lib")
  4. Open \src\python\core.c
  5. Replace:
    #include <alloca.h>
    with:
    #if defined(_WIN32) || defined(WIN32)
    #include <malloc.h>
    #else
    #include <alloca.h>
    #endif
  6. Run the following in the source code main folder
    setup.py install

This should successsfully install ethash under Windows.

I have followed the instruction and reload the PC. The error, by the way, is still there.
Other ideas?


Building wheels for collected packages: pyethash
Building wheel for pyethash (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\loren\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\loren\AppData\Local\Temp\pip-install-2gbzmvho\pyethash\setup.py'"'"'; file='"'"'C:\Users\loren\AppData\Local\Temp\pip-install-2gbzmvho\pyethash\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\loren\AppData\Local\Temp\pip-wheel-6sm_foop'
cwd: C:\Users\loren\AppData\Local\Temp\pip-install-2gbzmvho\pyethash
Complete output (46 lines):
running bdist_wheel
running build
running build_ext
building 'pyethash' extension
creating build
creating build\temp.win32-3.8
creating build\temp.win32-3.8\Release
creating build\temp.win32-3.8\Release\src
creating build\temp.win32-3.8\Release\src\python
creating build\temp.win32-3.8\Release\src\libethash
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.25.28610\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\loren\appdata\local\programs\python\python38-32\include -Ic:\users\loren\appdata\local\programs\python\python38-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.25.28610\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/python/core.c /Fobuild\temp.win32-3.8\Release\src/python/core.obj -Isrc/ -std=gnu99 -Wall
cl : warning della riga di comando D9002 : l'opzione sconosciuta '-std=gnu99' verr… ignorata
core.c
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\corecrt_io.h(49): warning C4820: '_finddata32i64_t': '4' byte di spaziatura interna aggiunti dopo membro dati 'name'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\corecrt_io.h(54): warning C4820: '_finddata64i32_t': '4' byte di spaziatura interna aggiunti dopo membro dati 'attrib'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\corecrt_io.h(64): warning C4820: '__finddata64_t': '4' byte di spaziatura interna aggiunti dopo membro dati 'attrib'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\corecrt_io.h(69): warning C4820: '__finddata64_t': '4' byte di spaziatura interna aggiunti dopo membro dati 'name'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\time.h(36): warning C4820: '_timespec64': '4' byte di spaziatura interna aggiunti dopo membro dati 'tv_nsec'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\time.h(43): warning C4820: 'timespec': '4' byte di spaziatura interna aggiunti dopo membro dati 'tv_nsec'
c:\users\loren\appdata\local\programs\python\python38-32\include\pytime.h(123): warning C4115: 'timeval': definizione di tipo denominato tra parentesi
c:\users\loren\appdata\local\programs\python\python38-32\include\pytime.h(188): warning C4820: '': '4' byte di spaziatura interna aggiunti dopo membro dati 'adjustable'
c:\users\loren\appdata\local\programs\python\python38-32\include\bytesobject.h(41): warning C4820: '': '3' byte di spaziatura interna aggiunti dopo membro dati 'ob_sval'
c:\users\loren\appdata\local\programs\python\python38-32\include\cpython/unicodeobject.h(625): warning C4820: '': '2' byte di spaziatura interna aggiunti dopo membro dati 'readonly'
c:\users\loren\appdata\local\programs\python\python38-32\include\longintrepr.h(88): warning C4820: '_longobject': '2' byte di spaziatura interna aggiunti dopo membro dati 'ob_digit'
c:\users\loren\appdata\local\programs\python\python38-32\include\cpython/dictobject.h(22): warning C4820: '': '4' byte di spaziatura interna aggiunti dopo membro dati 'ma_used'
c:\users\loren\appdata\local\programs\python\python38-32\include\cpython/pystate.h(64): warning C4820: '_ts': '2' byte di spaziatura interna aggiunti dopo membro dati 'recursion_critical'
c:\users\loren\appdata\local\programs\python\python38-32\include\cpython/pystate.h(133): warning C4820: '_ts': '4' byte di spaziatura interna aggiunti dopo membro dati 'context'
c:\users\loren\appdata\local\programs\python\python38-32\include\genobject.h(35): warning C4820: '': '3' byte di spaziatura interna aggiunti dopo membro dati 'gi_running'
c:\users\loren\appdata\local\programs\python\python38-32\include\genobject.h(55): warning C4820: '': '3' byte di spaziatura interna aggiunti dopo membro dati 'cr_running'
c:\users\loren\appdata\local\programs\python\python38-32\include\genobject.h(72): warning C4820: '': '3' byte di spaziatura interna aggiunti dopo membro dati 'ag_running'
c:\users\loren\appdata\local\programs\python\python38-32\include\cpython/pyerrors.h(19): warning C4820: '': '3' byte di spaziatura interna aggiunti dopo membro dati 'suppress_context'
c:\users\loren\appdata\local\programs\python\python38-32\include\cpython/pyerrors.h(23): warning C4820: '': '3' byte di spaziatura interna aggiunti dopo membro dati 'suppress_context'
c:\users\loren\appdata\local\programs\python\python38-32\include\cpython/pyerrors.h(33): warning C4820: '': '3' byte di spaziatura interna aggiunti dopo membro dati 'suppress_context'
c:\users\loren\appdata\local\programs\python\python38-32\include\cpython/pyerrors.h(40): warning C4820: '': '3' byte di spaziatura interna aggiunti dopo membro dati 'suppress_context'
c:\users\loren\appdata\local\programs\python\python38-32\include\cpython/pyerrors.h(49): warning C4820: '': '3' byte di spaziatura interna aggiunti dopo membro dati 'suppress_context'
c:\users\loren\appdata\local\programs\python\python38-32\include\cpython/pyerrors.h(54): warning C4820: '': '3' byte di spaziatura interna aggiunti dopo membro dati 'suppress_context'
c:\users\loren\appdata\local\programs\python\python38-32\include\cpython/pyerrors.h(66): warning C4820: '': '3' byte di spaziatura interna aggiunti dopo membro dati 'suppress_context'
c:\users\loren\appdata\local\programs\python\python38-32\include\code.h(69): warning C4820: '': '3' byte di spaziatura interna aggiunti dopo membro dati 'co_opcache_size'
c:\users\loren\appdata\local\programs\python\python38-32\include\fileutils.h(73): warning C4820: '_Py_stat_struct': '4' byte di spaziatura interna aggiunti dopo membro dati 'st_dev'
c:\users\loren\appdata\local\programs\python\python38-32\include\fileutils.h(75): warning C4820: '_Py_stat_struct': '2' byte di spaziatura interna aggiunti dopo membro dati 'st_mode'
c:\users\loren\appdata\local\programs\python\python38-32\include\fileutils.h(79): warning C4820: '_Py_stat_struct': '4' byte di spaziatura interna aggiunti dopo membro dati 'st_rdev'
c:\users\loren\appdata\local\programs\python\python38-32\include\fileutils.h(82): warning C4820: '_Py_stat_struct': '4' byte di spaziatura interna aggiunti dopo membro dati 'st_atime_nsec'
c:\users\loren\appdata\local\programs\python\python38-32\include\fileutils.h(84): warning C4820: '_Py_stat_struct': '4' byte di spaziatura interna aggiunti dopo membro dati 'st_mtime_nsec'
c:\users\loren\appdata\local\programs\python\python38-32\include\fileutils.h(88): warning C4820: '_Py_stat_struct': '4' byte di spaziatura interna aggiunti dopo membro dati 'st_reparse_tag'
src/python/core.c(2): fatal error C1083: Non Š possibile aprire il file inclusione: 'alloca.h': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.25.28610\bin\HostX86\x86\cl.exe' failed with exit status 2

ERROR: Failed building wheel for pyethash
Running setup.py clean for pyethash
Failed to build pyethash
Installing collected packages: pyethash, ethereum, eth-hash
Attempting uninstall: pyethash
Found existing installation: pyethash 0.1.23
ERROR: Cannot uninstall 'pyethash'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

@code-war1
Copy link

Instead of : "w3[tester]"
Usse: from web3 import EthereumTesterProvider
Then you can initialise an instance with it.

@philippdonabauer
Copy link
Author

Hy im sorry im not sure that any of the workarounds will work now.. I created this ticket 6 Years ago ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants