eth-brownie / brownie

A Python-based development and testing framework for smart contracts targeting the Ethereum Virtual Machine.
https://eth-brownie.readthedocs.io
MIT License
2.64k stars 550 forks source link

Error installing eth-brownie because clang failed with exit code 1 #1300

Closed harshagw closed 5 months ago

harshagw commented 2 years ago

Environment information

What was wrong?

Please include information like:

PIP STDERR

WARNING: The candidate selected for download or install is a yanked version: 'protobuf' candidate (version 3.18.0 at https://files.pythonhosted.org/packages/74/4e/9f3cb458266ef5cdeaa1e72a90b9eda100e3d1803cbd7ec02f0846da83c3/protobuf-3.18.0-py2.py3-none-any.whl#sha256=615099e52e9fbc9fde00177267a94ca820ecf4e80093e390753568b7d8cb3c1a (from https://pypi.org/simple/protobuf/)) Reason for being yanked: This version claims to support Python 2 but does not ERROR: Command errored out with exit status 1: command: /Users/harsh/.local/pipx/venvs/eth-brownie/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/gn/_05z9lgx1rx4p1d3nqw17s_80000gn/T/pip-install-s2iqcio1/cytoolz_96a41feab75043cc8975720c707803b4/setup.py'"'"'; file='"'"'/private/var/folders/gn/_05z9lgx1rx4p1d3nqw17s_80000gn/T/pip-install-s2iqcio1/cytoolz_96a41feab75043cc8975720c707803b4/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'"'"'))' bdist_wheel -d /private/var/folders/gn/_05z9lgx1rx4p1d3nqw17s_80000gn/T/pip-wheel-9pqoaeb0 cwd: /private/var/folders/gn/_05z9lgx1rx4p1d3nqw17s_80000gn/T/pip-install-s2iqcio1/cytoolz_96a41feab75043cc8975720c707803b4/ Complete output (75 lines): ALERT: Cython not installed. Building without Cython. running bdist_wheel running build running build_py creating build creating build/lib.macosx-11-arm64-3.10 creating build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/compatibility.py -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/utils_test.py -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/_version.py -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/init.py -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/_signatures.py -> build/lib.macosx-11-arm64-3.10/cytoolz creating build/lib.macosx-11-arm64-3.10/cytoolz/curried copying cytoolz/curried/operator.py -> build/lib.macosx-11-arm64-3.10/cytoolz/curried copying cytoolz/curried/init.py -> build/lib.macosx-11-arm64-3.10/cytoolz/curried copying cytoolz/curried/exceptions.py -> build/lib.macosx-11-arm64-3.10/cytoolz/curried copying cytoolz/itertoolz.pyx -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/dicttoolz.pyx -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/functoolz.pyx -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/recipes.pyx -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/utils.pyx -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/utils.pxd -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/init.pxd -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/recipes.pxd -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/functoolz.pxd -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/dicttoolz.pxd -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/cpython.pxd -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/itertoolz.pxd -> build/lib.macosx-11-arm64-3.10/cytoolz creating build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_none_safe.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_utils.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_curried.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_compatibility.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_embedded_sigs.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_functoolz.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_inspect_args.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_doctests.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_tlz.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_signatures.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/dev_skip_test.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_recipes.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_docstrings.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_dev_skip_test.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_dicttoolz.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_serialization.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_curried_toolzlike.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_itertoolz.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests running build_ext building 'cytoolz.dicttoolz' extension creating build/temp.macosx-11-arm64-3.10 creating build/temp.macosx-11-arm64-3.10/cytoolz clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -I/opt/homebrew/include -I/opt/homebrew/opt/openssl@1.1/include -I/opt/homebrew/opt/sqlite/include -I/Users/harsh/.local/pipx/venvs/eth-brownie/include -I/opt/homebrew/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c cytoolz/dicttoolz.c -o build/temp.macosx-11-arm64-3.10/cytoolz/dicttoolz.o clang -bundle -undefined dynamic_lookup -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk build/temp.macosx-11-arm64-3.10/cytoolz/dicttoolz.o -L/opt/homebrew/lib -L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/sqlite/lib -o build/lib.macosx-11-arm64-3.10/cytoolz/dicttoolz.cpython-310-darwin.so building 'cytoolz.functoolz' extension clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -I/opt/homebrew/include -I/opt/homebrew/opt/openssl@1.1/include -I/opt/homebrew/opt/sqlite/include -I/Users/harsh/.local/pipx/venvs/eth-brownie/include -I/opt/homebrew/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c cytoolz/functoolz.c -o build/temp.macosx-11-arm64-3.10/cytoolz/functoolz.o cytoolz/functoolz.c:23087:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration] ret = _PyGen_Send((PyGenObject)yf, value == Py_None ? NULL : value); ^ cytoolz/functoolz.c:23087:17: warning: incompatible integer to pointer conversion assigning to 'PyObject ' (aka 'struct _object ') from 'int' [-Wint-conversion] ret = _PyGen_Send((PyGenObject)yf, value == Py_None ? NULL : value); ^ ~~~~~~~~~~~~~~ cytoolz/functoolz.c:23092:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration] ret = _PyGen_Send((PyGenObject)yf, value == Py_None ? NULL : value); ^ cytoolz/functoolz.c:23092:17: warning: incompatible integer to pointer conversion assigning to 'PyObject ' (aka 'struct _object ') from 'int' [-Wint-conversion] ret = _PyGen_Send((PyGenObject)yf, value == Py_None ? NULL : value); ^ ~~~~~~~~~~~~~~ cytoolz/functoolz.c:23176:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration] ret = _PyGen_Send((PyGenObject)yf, NULL); ^ cytoolz/functoolz.c:23176:17: warning: incompatible integer to pointer conversion assigning to 'PyObject ' (aka 'struct _object ') from 'int' [-Wint-conversion] ret = _PyGen_Send((PyGenObject)yf, NULL); ^ ~~~~~~~ 3 warnings and 3 errors generated. error: command '/usr/bin/clang' failed with exit code 1

ERROR: Failed building wheel for cytoolz ERROR: Command errored out with exit status 1: command: /Users/harsh/.local/pipx/venvs/eth-brownie/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/gn/_05z9lgx1rx4p1d3nqw17s_80000gn/T/pip-install-s2iqcio1/cytoolz_96a41feab75043cc8975720c707803b4/setup.py'"'"'; file='"'"'/private/var/folders/gn/_05z9lgx1rx4p1d3nqw17s_80000gn/T/pip-install-s2iqcio1/cytoolz_96a41feab75043cc8975720c707803b4/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 /private/var/folders/gn/_05z9lgx1rx4p1d3nqw17s_80000gn/T/pip-record-jrma5l4v/install-record.txt --single-version-externally-managed --compile --install-headers /Users/harsh/.local/pipx/venvs/eth-brownie/include/site/python3.10/cytoolz cwd: /private/var/folders/gn/_05z9lgx1rx4p1d3nqw17s_80000gn/T/pip-install-s2iqcio1/cytoolz_96a41feab75043cc8975720c707803b4/ Complete output (75 lines): ALERT: Cython not installed. Building without Cython. running install running build running build_py creating build creating build/lib.macosx-11-arm64-3.10 creating build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/compatibility.py -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/utils_test.py -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/_version.py -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/init.py -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/_signatures.py -> build/lib.macosx-11-arm64-3.10/cytoolz creating build/lib.macosx-11-arm64-3.10/cytoolz/curried copying cytoolz/curried/operator.py -> build/lib.macosx-11-arm64-3.10/cytoolz/curried copying cytoolz/curried/init.py -> build/lib.macosx-11-arm64-3.10/cytoolz/curried copying cytoolz/curried/exceptions.py -> build/lib.macosx-11-arm64-3.10/cytoolz/curried copying cytoolz/itertoolz.pyx -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/dicttoolz.pyx -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/functoolz.pyx -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/recipes.pyx -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/utils.pyx -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/utils.pxd -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/init.pxd -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/recipes.pxd -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/functoolz.pxd -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/dicttoolz.pxd -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/cpython.pxd -> build/lib.macosx-11-arm64-3.10/cytoolz copying cytoolz/itertoolz.pxd -> build/lib.macosx-11-arm64-3.10/cytoolz creating build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_none_safe.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_utils.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_curried.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_compatibility.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_embedded_sigs.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_functoolz.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_inspect_args.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_doctests.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_tlz.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_signatures.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/dev_skip_test.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_recipes.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_docstrings.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_dev_skip_test.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_dicttoolz.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_serialization.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_curried_toolzlike.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests copying cytoolz/tests/test_itertoolz.py -> build/lib.macosx-11-arm64-3.10/cytoolz/tests running build_ext building 'cytoolz.dicttoolz' extension creating build/temp.macosx-11-arm64-3.10 creating build/temp.macosx-11-arm64-3.10/cytoolz clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -I/opt/homebrew/include -I/opt/homebrew/opt/openssl@1.1/include -I/opt/homebrew/opt/sqlite/include -I/Users/harsh/.local/pipx/venvs/eth-brownie/include -I/opt/homebrew/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c cytoolz/dicttoolz.c -o build/temp.macosx-11-arm64-3.10/cytoolz/dicttoolz.o clang -bundle -undefined dynamic_lookup -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk build/temp.macosx-11-arm64-3.10/cytoolz/dicttoolz.o -L/opt/homebrew/lib -L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/sqlite/lib -o build/lib.macosx-11-arm64-3.10/cytoolz/dicttoolz.cpython-310-darwin.so building 'cytoolz.functoolz' extension clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -I/opt/homebrew/include -I/opt/homebrew/opt/openssl@1.1/include -I/opt/homebrew/opt/sqlite/include -I/Users/harsh/.local/pipx/venvs/eth-brownie/include -I/opt/homebrew/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c cytoolz/functoolz.c -o build/temp.macosx-11-arm64-3.10/cytoolz/functoolz.o cytoolz/functoolz.c:23087:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration] ret = _PyGen_Send((PyGenObject)yf, value == Py_None ? NULL : value); ^ cytoolz/functoolz.c:23087:17: warning: incompatible integer to pointer conversion assigning to 'PyObject ' (aka 'struct _object ') from 'int' [-Wint-conversion] ret = _PyGen_Send((PyGenObject)yf, value == Py_None ? NULL : value); ^ ~~~~~~~~~~~~~~ cytoolz/functoolz.c:23092:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration] ret = _PyGen_Send((PyGenObject)yf, value == Py_None ? NULL : value); ^ cytoolz/functoolz.c:23092:17: warning: incompatible integer to pointer conversion assigning to 'PyObject ' (aka 'struct _object ') from 'int' [-Wint-conversion] ret = _PyGen_Send((PyGenObject)yf, value == Py_None ? NULL : value); ^ ~~~~~~~~~~~~~~ cytoolz/functoolz.c:23176:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration] ret = _PyGen_Send((PyGenObject)yf, NULL); ^ cytoolz/functoolz.c:23176:17: warning: incompatible integer to pointer conversion assigning to 'PyObject ' (aka 'struct _object ') from 'int' [-Wint-conversion] ret = _PyGen_Send((PyGenObject)yf, NULL); ^ ~~~~~~~ 3 warnings and 3 errors generated. error: command '/usr/bin/clang' failed with exit code 1

ERROR: Command errored out with exit status 1: /Users/harsh/.local/pipx/venvs/eth-brownie/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/gn/_05z9lgx1rx4p1d3nqw17s_80000gn/T/pip-install-s2iqcio1/cytoolz_96a41feab75043cc8975720c707803b4/setup.py'"'"'; file='"'"'/private/var/folders/gn/_05z9lgx1rx4p1d3nqw17s_80000gn/T/pip-install-s2iqcio1/cytoolz_96a41feab75043cc8975720c707803b4/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 /private/var/folders/gn/_05z9lgx1rx4p1d3nqw17s_80000gn/T/pip-record-jrma5l4v/install-record.txt --single-version-externally-managed --compile --install-headers /Users/harsh/.local/pipx/venvs/eth-brownie/include/site/python3.10/cytoolz Check the logs for full command output.

How can it be fixed?

Fill this in if you know how the bug could be fixed.

jeffhodde commented 2 years ago

I'm getting the same thing...

kyzooghost commented 2 years ago

Same - get this error, and cannot get eth-brownie installed on a Macbook Air 2020 with M1 chip no matter what method I try

  1. pipx install eth-brownie
  2. python -m venv venv => source venv/bin/activate => pip3 install eth-brownie
  3. Git cloning the eth-brownie repo and running python3 setup.py install
kyzooghost commented 2 years ago

Solution here worked for me

https://github.com/eth-brownie/brownie/issues/1315

bhtru commented 2 years ago

Solution here worked for me

1315

Tried this to no luck unfortunately. Crazy thing is the installs worked fine on one macbook for me and then I transitioned my dev env to another machine and now I'm getting this error. Can't for the life of me figure this out.

nilsbunger commented 2 years ago

You're on an M1 mac just like me. I also hit this with Python 3.10. Can you try Python 3.9? For example: pipx install eth-brownie --python /opt/homebrew/bin/python3.9

I noticed my pipx was installed via brew and really wants to use python 3.10 (see this issue)

The underlying issue seems to be in cytoolz here

bhtru commented 2 years ago

@nilsbunger Python 3.9 works for me and yes I had the same issue where my system really wanted to use 3.10.0 as well. Using pyenv to manage the version didn't work either. I had to uninstall 3.10.0 and do a fresh 3.9.5 install.

Thanks for the response!

elcolie commented 2 years ago

Solution here worked for me

1315

Thank you. It works! I use 3.9.1 pip install eth-brownie

sambacha commented 2 years ago

Here is a script to properly install, configure and use python of mac osx (m1 and intel):

Dont use homebrew to install python versions, install pyenv and use that to version manage your python installs (just like you would use nvm to manage nodejs)

This script installs some prereq's you would need for CPython and properly generates the needed dylib's for OSX so that your using GCC and not clang compiler.

After you install using pyenv and invoke the pyenv shell command you can install pipx and eth-brownie without worry.

Note: pretty sure eth-brownie GUI will need some additional dependencies on OSX to work properly.

#!/usr/bin/env bash

# you must have homebrew installed and be using bash for your shell, you can use zsh (that is the default)

# bash --version does not return the actual tty env your in
echo $BASH_VERSION
brew --version || exit 1

BREW_HOME=$(brew --prefix)

# for cython
echo "installing gnu core utils and gcc"
brew install core-utils
export PATH="$(brew --prefix coreutils)/libexec/gnubin:/usr/local/bin:$PATH"
brew install gcc
brew update

# for libc6-dev header files
brew install openssl

brew update
echo "installing python env manager..."
brew install pyenv
sleep 1
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
exec $SHELL

# needed for proper dylib
echo "configuring python install..."
env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.8.12

# python
export PATH="${BREW_HOME}/opt/python/libexec/bin:$PATH"
unset BREW_HOME

echo "USAGE: pyenv shell 3.8.12"
echo "HELP: pyenv help"
exit 0
AlaiY95 commented 2 years ago

I had the same issue with Python 3.10.0. I downgraded to Python3.9.7 and was able to build cytoolz wheel and eth-brownie installation worked!

sashaaldrick commented 2 years ago

@nilsbunger worked perfectly for me thank you!