8

I set up my development environment on Fedora 35 and when I run any brownie command such as $ brownie console or even brownie --version I get the following error:

Traceback (most recent call last):
  File "/home/philippbunke/.local/bin/brownie", line 5, in <module>
    from brownie._cli.__main__ import main
  File "/home/philippbunke/.local/pipx/venvs/eth-brownie/lib64/python3.10/site-packages/brownie/__init__.py", line 6, in <module>
    from brownie.project import compile_source, run
  File "/home/philippbunke/.local/pipx/venvs/eth-brownie/lib64/python3.10/site-packages/brownie/project/__init__.py", line 3, in <module>
    from .main import (  # NOQA 401
  File "/home/philippbunke/.local/pipx/venvs/eth-brownie/lib64/python3.10/site-packages/brownie/project/main.py", line 44, in <module>
    from brownie.network import web3
  File "/home/philippbunke/.local/pipx/venvs/eth-brownie/lib64/python3.10/site-packages/brownie/network/__init__.py", line 4, in <module>
    from .account import Accounts
  File "/home/philippbunke/.local/pipx/venvs/eth-brownie/lib64/python3.10/site-packages/brownie/network/account.py", line 12, in <module>
    import eth_account
  File "/home/philippbunke/.local/pipx/venvs/eth-brownie/lib64/python3.10/site-packages/eth_account/__init__.py", line 1, in <module>
    from eth_account.account import (  # noqa: F401
  File "/home/philippbunke/.local/pipx/venvs/eth-brownie/lib64/python3.10/site-packages/eth_account/account.py", line 8, in <module>
    from cytoolz import (
  File "/home/philippbunke/.local/pipx/venvs/eth-brownie/lib64/python3.10/site-packages/cytoolz/__init__.py", line 3, in <module>
    from .functoolz import *
ImportError: /home/philippbunke/.local/pipx/venvs/eth-brownie/lib64/python3.10/site-packages/cytoolz/functoolz.cpython-310-x86_64-linux-gnu.so: undefined symbol: _PyGen_Send

Setup:
Python=3.10.1
Cython=0.29.26
gcc/gcc-c=11.2.1-7.fc35.x86_64
Ganache CLI=v6.12.2

$ pipx list

venvs are in /home/philippbunke/.local/pipx/venvs
apps are exposed on your $PATH at /home/philippbunke/.local/bin
   package eth-brownie 1.16.4, Python 3.10.1
    - brownie

$ $PATH

/home/philippbunke/.local/bin:/home/philippbunke/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/var/lib/snapd/snap/bin

I have spent a whole day trying to fix this error, please help me out!

PhilippB
  • 331
  • 2
  • 8
  • You need to recompile `functoolz` with a recent version of Cython (or download a version of functoolz where this has been done). This was an incompatibility between earlier versions of Cython and Python 3.10. – DavidW Dec 22 '21 at 18:06
  • See https://github.com/pytoolz/cytoolz/issues/151 (which I think is the same issue) – DavidW Dec 22 '21 at 18:10
  • @DavidW I installed the latest version of `functoolz` using `pip install functoolz` but I still get the same error. I have no idea how I would recompile the package myself, do you have other suggestions? I found this post myself (should have linked it in the question though), but from my understanding, the issue could only be solved by downgrading python. – PhilippB Dec 22 '21 at 18:56
  • Rough (untested) outline: uninstall functoolz with pip (just to be sure); download the most recent source release (https://github.com/pytoolz/cytoolz/tags); run [setup.py](https://github.com/pytoolz/cytoolz/blob/master/setup.py) with `python setup.py --with-cython install` – DavidW Dec 22 '21 at 19:11
  • I just did that and it seems to have installed correctly as shown below, however, I still get the same error :( `Installed /usr/local/lib64/python3.10/site-packages/toolz-0.11.2-py3.10.egg` `Finished processing dependencies for cytoolz==0.11.2` – PhilippB Dec 22 '21 at 20:07
  • I'm glad you got it sorted in the end. Oddly it seems to work fine for me (new 3.10 virtualenv, just installing cytoolz from pip, it imports correctly). So I dunno what's gone wrong – DavidW Dec 22 '21 at 20:58

1 Answers1

6

The problem here seems to be Python 3.10.1!

I used anaconda to create a new virtual environment with Python 3.8.12, installed brownie using pipx install --python python3.8 eth-brownie and it worked!

The trick here was, to also tell pipx to use another python version, otherwise it would create a dependency to the global python version, which is python 3.10 in my case.

PhilippB
  • 331
  • 2
  • 8
  • Honestly, I see NO reason to use pipx in conda environment. It's like installing a podman inside a docker container. But it looks like there are others and it works, so keep up...... – nosbor Feb 16 '22 at 18:13
  • Maybe you're right, I can' tell. I did it that way because I wanted to keep my base environment clean and using pipx was the suggested installation method in the brownie docs. – PhilippB Feb 18 '22 at 12:59