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

Install failing with dependancy pyethash missing alloca.h #5

Open
donal6343 opened this issue Feb 7, 2016 · 11 comments
Open

Install failing with dependancy pyethash missing alloca.h #5

donal6343 opened this issue Feb 7, 2016 · 11 comments

Comments

@donal6343
Copy link

src/python/core.c fatal error C1083: Cannot open include file: 'Alloca.h'

@maurycyp
Copy link
Contributor

Hi @donal6343 , could you provide more info (OS, installation method, etc). I am able to install ethjsonrpc 0.2.7 from PyPI (pip install ethjsonrpc) and by cloning the repo and running python setup.py install.

@donal6343
Copy link
Author

Windows 8, pip install ethjsonrpc or on the Mac, same issue

@donal6343
Copy link
Author

I think its related to the ethash install https://github.com/ethereum/ethash/blob/master/src/python/core.c

@jimkberry
Copy link

The ethash code is C99, which is not well-supported under Windows.

@donal6343
Copy link
Author

Any way to get around this? Really want to install this

@jimkberry
Copy link

Back when I was messing with it I converted all of the ethash C99 to C++ (not hard if you are a C++ programmer) but that was not so much for pyethereum as it was for compiling a miner. There are other pyethereum hangups under Windows, if I recall (leveldb seems to me was a problem.)

@goon034
Copy link

goon034 commented May 15, 2016

That dependecy (pyethash) seems to be the hangup for me too. I wanted to start relaying for btcrelay but I tried to install pyethash and secp256k1 and both of them are really causing issues. I cloned the pyethash into my venv and tried inputing:

python install setup.py

However, I ran into issues with finding vcvarsall.bat. Is there a fix?

@golyalpha
Copy link

@goon034 secp256k1 does cause issues on windows, you should install secp256k1-transient instead (until it gets merged into the secp256k1).

@jimkberry
Copy link

Note that under Windows you can skip the c_secp256k1 install (comment it out) and code from the bitcoin package will be used as a fallback.

@ferret-guy
Copy link

After I struggled with this issue for a long time I realized that ethjsonrpc only uses the utils and abi py files from pyethereum and does not need all the other stuff from there. I have created a branch for my own uses here: https://github.com/LiteID/ethjsonrpc/tree/master/ethjsonrpc that just includes thease files. After looking at the licensing pyethereum code is compatible with ethjsonrpc and could be included.

tldr: we only need some files and you can get a version that works in python 2.7 at lease from https://github.com/LiteID/ethjsonrpc/tree/master/ethjsonrpc (let me know if this is a solution that would work for you guys and I can make a pull request)

@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.

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

7 participants